Fix RUBY-2287 Max staleness spec tests do not correctly assert all requirements - #1962
Merged
Conversation
egiurleo
reviewed
Jun 17, 2020
| expect do | ||
| server_selector.select_server(cluster) | ||
| end.to raise_exception(Mongo::Error::NoServerAvailable) | ||
| expect(spec.suitable_servers).to eq([]) |
Contributor
There was a problem hiding this comment.
spec is actually an object representing the yaml file that the test is based on, so I think you'll want to use this as the expected value in your tests.
Take a look at line 128 for an example of something similar -- in_latency_window is derived from spec.in_latency_window. We take the results of server selection and make sure that they match the value specified by the yml file.
Contributor
|
I ended up moving a lot of code around to make the tests test the driver instead of testing themselves. Behavior changes:
Test changes:
|
Contributor
p-mongo
approved these changes
Jun 24, 2020
egiurleo
approved these changes
Jun 25, 2020
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.
All I did was add a check that suitable servers was empty if available servers was empty. I checked that if there was an available Primary or Secondary server and the suitable servers was empty that it would fail.