Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests to cover what is testable in SelfUpdate command #250

Merged
merged 2 commits into from
Feb 11, 2024

Conversation

stronk7
Copy link
Member

@stronk7 stronk7 commented Oct 11, 2023

Note that only helper methods can be tested for that command, not the execution of the update itself (it has to happen within a PHAR). And it doesn't make much sense to start mocking lots of stuff for that.

Some integration tests @ CIS will be in charge of
covering the real execution instead. Coming soon.

@codecov
Copy link

codecov bot commented Oct 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8124fe7) 84.77% compared to head (a79ed0a) 85.08%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #250      +/-   ##
============================================
+ Coverage     84.77%   85.08%   +0.31%     
  Complexity      720      720              
============================================
  Files            75       75              
  Lines          2226     2226              
============================================
+ Hits           1887     1894       +7     
+ Misses          339      332       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

kabalin
kabalin previously approved these changes Oct 11, 2023
@stronk7
Copy link
Member Author

stronk7 commented Oct 11, 2023

Thanks @kabalin,

I'm going to keep this on hold until we have a couple of releases with the self-update command working. Only then we'll be able to add some integration (GHA) test to verify that it's working as expected.

Ciao :-)

@stronk7
Copy link
Member Author

stronk7 commented Jan 11, 2024

Ok, now that we have > 2 releases supporting the selfupdate command, we can add some simple integration tests for it.

I've added a second commit that just:

  • downloads the 4.1.8 (first version with the command working) moodle-plugin-ci.phar asset.
  • runs selfupdate to become updated to actual.
  • runs selfupdate --rollback to go back to the original 4.1.8.

They seem to be passing... so I'm going to make this PR ready for review, it includes both the original unit tests and the new integration tests.

Ciao :-)

@stronk7 stronk7 marked this pull request as ready for review January 11, 2024 16:43
Note that only helper methods can be tested for that command, not
the execution of the update itself (it has to happen within a PHAR).
And it doesn't make much sense to start mocking lots of stuff for that.

Some integration tests @ CIS will be in charge of
covering the real execution instead. Coming soon.
We just start with the 4.1.8 release that was
the first supporting the selfupdate command.

Then we upgrade to actual and then rollback
to confirm that we are back to the original one.

That should be enough to have it continuously covered.
@stronk7
Copy link
Member Author

stronk7 commented Feb 11, 2024

I'm sef-merging this upstream now, just to have the selfupdate command covered and detect any potential regression, specifically when bumping various components versions.

Ciao .-)

@stronk7 stronk7 merged commit ce309ac into moodlehq:main Feb 11, 2024
22 checks passed
@stronk7 stronk7 deleted the test_self_update branch February 11, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants