Clean up test extraction folders in tear_down - #136
Merged
Merged
Conversation
Tests created uploads/exelearning/{hash}/ fixtures with fixed hashes and
removed them inline, after assertions. A run that failed or was aborted
mid-test left the folder in the persistent wp-env uploads directory, so
ElpUploadHandlerTest::test_delete_extracted_folder_nonexistent_dir failed on
the next full-suite run. Register every fixture path for tear_down cleanup and
give the 'missing folder' test a unique hash.
Contributor
Test in WordPress PlaygroundTest the plugin with the code from this branch:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #136 +/- ##
=========================================
Coverage 96.87% 96.87%
Complexity 864 864
=========================================
Files 39 39
Lines 4323 4323
=========================================
Hits 4188 4188
Misses 135 135
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of a stack of eight small PRs from a modernization/security pass. Each PR targets the previous branch; merge them in order.
Problem
ElpUploadHandlerTest::test_delete_extracted_folder_nonexistent_dirfailed intermittently on full-suite runs and passed when run alone.Several tests create
uploads/exelearning/{hash}/fixtures with fixed hashes (ffff…,aaaa…,cccc…,7777…). They remove the fixtures inline, after the assertions, or not at all. The wp-env uploads directory persists across runs, so an aborted or failing run left, for example,ffff…f/behind (fromRestApiTest::test_save_elp_file_cleanup_with_old_extraction). That broke the precondition of the handler test on the next run.Change
ElpUploadHandlerTest,RestApiTestandShortcodesTestregister every fixture path and delete it intear_down(). This is the patternStaleContentRedirectTestalready uses, withExeLearning_Styles_Service::recursive_delete().Tests only; no runtime change.
Verification
ffff…f/index.htmlwas seeded by hand in the tests container. The full suite then ran green twice in a row:OK (943 tests, 2074 assertions).uploads/exelearning/leftovers after the runs.Stack