-
Notifications
You must be signed in to change notification settings - Fork 27
Harden cleanup on CI to avoid filesystem bottlenecks #319
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -745,8 +745,10 @@ public function beforeScenario( BeforeScenarioScope $scope ): void { | |||||||||||||
| public function afterScenario( AfterScenarioScope $scope ): void { | ||||||||||||||
|
|
||||||||||||||
| if ( self::$run_dir ) { | ||||||||||||||
| // Remove altered WP install, unless there's an error. | ||||||||||||||
| if ( $scope->getTestResult()->getResultCode() <= 10 ) { | ||||||||||||||
| // Remove altered WP install, unless there's an error (and we are not on CI). | ||||||||||||||
| $is_ci = getenv( 'CI' ); | ||||||||||||||
| $is_debug = getenv( 'WP_CLI_TEST_DEBUG_BEHAT_ENV' ); | ||||||||||||||
|
Comment on lines
+748
to
+750
|
||||||||||||||
| // Remove altered WP install, unless there's an error (and we are not on CI). | |
| $is_ci = getenv( 'CI' ); | |
| $is_debug = getenv( 'WP_CLI_TEST_DEBUG_BEHAT_ENV' ); | |
| // Remove altered WP install, unless there's an error (and we are not on CI, or debug override is enabled). | |
| $is_ci = filter_var( getenv( 'CI' ) ?: false, FILTER_VALIDATE_BOOLEAN ); | |
| $is_debug = filter_var( getenv( 'WP_CLI_TEST_DEBUG_BEHAT_ENV' ) ?: false, FILTER_VALIDATE_BOOLEAN ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with how other environment variables are checked in this file (e.g.,
running_with_code_coverage()on line 283), and to make the boolean check more robust, it would be better to explicitly check for'true'or'1'. Usinggetenv()directly in a boolean context can have surprising results depending on what the environment variable is set to (e.g.,'0'or'false').