-
Notifications
You must be signed in to change notification settings - Fork 28
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
Fix sporadic test failure #204
Merged
Merged
Conversation
This file contains 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
If the cli_spec.rb's set_replication specs ran on macOS before database_replication_standby_spec.rb's register_standby_server specs, the former would create a $CHILD_STATUS var with a failing result. Then when the register_standby_server spec would run it stubs the forking call, but doesn't stub $CHILD_STATUS, resulting in a call to $CHILD_STATUS.success? which would return false. While we could change the test to also stub $CHILD_STATUS.success? to return true, this only works on Ruby 2.7. On Ruby 3.0 this fails with a modify frozen object error. Instead, what we can do is use Process.wait2 instead of Process.wait+$CHILD_STATUS.success? This way, we can stub the status object as well.
Note that running the specs with 3.0 produces a lot of errors, but they are unrelated to this specific error. |
|
agrare
approved these changes
Mar 20, 2023
Checked commit Fryguy@2e404e7 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint lib/manageiq/appliance_console/database_replication.rb
spec/cli_spec.rb
|
jrafanie
pushed a commit
that referenced
this pull request
Jun 30, 2023
Fix sporadic test failure (cherry picked from commit f43972a)
Fryguy
added a commit
that referenced
this pull request
Feb 7, 2024
Fixed - Fix sporadic test failure [#204] - Remove MIQ specific gem source [#209] - Double escape @ in realm to avoid shell interpretation [#211] - Move gem name loader to proper namespaced location [#208] - Separate kerberos from service principal name and use correctly [#215] - Add manageiq user to allowed_uids for sssd [#220] - Remove warning about using pg_dump [#221] - Fix specs where AwesomeSpawn private interface changed [#224] - Change the Name of the CA from something to ApplianceCA [#228] - Fix YAML.load_file failing on aliases [#234] Added - Make backward compatible changes to work with repmgr13 - version 5.2.1 [#192] - Support Ruby 3.0 [#206] - Support Ruby 3.1 [#227] - Allow rails 7 gems in gemspec [#226] Changed - Update to Highline 2.1.0 [#201] - Clean up test output (highline and stdout messages) [#210] Removed - Drop Ruby 2.7 [#223]
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.
If the cli_spec.rb's set_replication specs ran on macOS before database_replication_standby_spec.rb's register_standby_server specs, the former would create a $CHILD_STATUS var with a failing result. Then when the register_standby_server spec would run it stubs the forking call, but doesn't stub $CHILD_STATUS, resulting in a call to $CHILD_STATUS.success? which would return false.
While we could change the test to also stub $CHILD_STATUS.success? to return true, this only works on Ruby 2.7. On Ruby 3.0 this fails with a modify frozen object error.
Instead, what we can do is use Process.wait2 instead of Process.wait+$CHILD_STATUS.success? This way, we can stub the status object as well.
@agrare Please review.
The following is an example seed that failed for me: