-
Notifications
You must be signed in to change notification settings - Fork 244
DRIVERS-1713 Convert change stream tests to unified format #1156
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
DRIVERS-1713 Convert change stream tests to unified format #1156
Conversation
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.
Thanks for taking on this conversion! 🧑🔧 Haven't looked at all the converted tests yet; just a few initial comments.
source/change-streams/tests/unified/change-streams-resume-allowlist.yml
Outdated
Show resolved
Hide resolved
source/change-streams/tests/unified/change-streams-resume-errorLabels.yml
Show resolved
Hide resolved
source/change-streams/tests/unified/change-streams-resume-errorLabels.yml
Outdated
Show resolved
Hide resolved
source/change-streams/tests/unified/change-streams-resume-allowlist.yml
Outdated
Show resolved
Hide resolved
source/change-streams/tests/unified/change-streams-resume-errorLabels.yml
Outdated
Show resolved
Hide resolved
aggregate: *collection0 | ||
cursor: {} | ||
pipeline: | ||
- $changeStream: {} |
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.
Note: drivers that have yet to implement DRIVERS-2231 will fail this assertion. I don't think we need to fix that here, but we should note that here, but it would be good to bring it up in the downstream changes for this issue. I'll also add a "has to be done after" relationship between the issues.
Previously, the POC change stream tests used $$unsetOrMatches
for fullDocument
here. I opened DRIVERS-2261 to clean that up.
Just POC-ed these tests in PHPLIB, and apart from the Will wait on suggested fixes above to be merged and this PR rebased, and then take a final review pass. |
4c9112c
to
82a6db2
Compare
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.
I just noticed this PR introduces global entities, which I think may be redundant. Please check that out and report back.
Also left various formatting suggestions that might make the test files more readable/maintainable (disregard as you wish, since those aren't functional changes). I did point out one place where you used a literal string instead of a YAML reference, so that might be worth looking into even if the style suggestions are ignored.
source/change-streams/tests/unified/change-streams-resume-allowlist.yml
Outdated
Show resolved
Hide resolved
source/change-streams/tests/unified/change-streams-resume-allowlist.yml
Outdated
Show resolved
Hide resolved
source/change-streams/tests/unified/change-streams-resume-allowlist.yml
Outdated
Show resolved
Hide resolved
pipeline: [] | ||
saveResultAsEntity: &changeStream0 changeStream0 | ||
- name: insertOne | ||
object: *globalCollection0 |
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.
I realize the tests in poc-change-streams.yml did use separate collections for running insertOne
, but I don't recall why that was done. Interestingly, the current unified tests in change-streams.yml don't do this and share the same collection object used to create the change stream.
I'd see if you can make do without this and, if so, remove all of the global entities added in this PR. I wouldn't object to stripping them from the POC file as well, but we can always punt on that.
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.
The globalClient
and associated data entities aren't strictly necessary AFAICT; the tests can be edited to only use client0
and add the insert
to the expected command events. I'm not sure that's an improvement on the current setup, though, since it's adding noise to the expected output (these are testing change streams, not insert).
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.
Ah, I re-read the POC spec tests again and it looks like those separate collections did have their own client. That was likely done for ignoring insert
in the APM events, as you pointed out.
The tests in change-streams.yml
vary. Some don't expect events at all, and others include the insert
command.
I suppose a third option is just to add insert
to ignoreCommandMonitoringEvents
if you'd like to avoid the extra entities, but I won't push for that. Totally up to you and I'm OK with leaving this as-is (thanks for indulging my questions).
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.
Whoops, forgot to actually reply here :) I'd prefer to leave it as-is - none of the other options seem worth the churn.
source/change-streams/tests/unified/change-streams-resume-allowlist.yml
Outdated
Show resolved
Hide resolved
- killCursors | ||
useMultipleMongoses: false | ||
- client: | ||
id: &globalClient globalClient |
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.
Per my comments above, I'll note that none of the existing tests in this file required global clients, databases, or collections.
That said, if these tests will operate on multiple collections you may want to explicitly initialize those in initialData
(as I did in poc-change-streams.yml
).
Still working on the style updates but wanted to continue the discussion of client entities while I do that :) |
- replicaset | ||
- sharded | ||
- load-balanced | ||
topologies: [ replicaset, sharded, load-balanced ] |
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.
Is there a particular reason that load-balanced
is included here but omitted in most later test requirements?
Separate question: if the main difference in test requirements is server versions, perhaps we can add a top-level runOnRequirements
block with `minServerVersion: "3.6.0" and relevant topologies and reduce duplication in this file? Then, test-level requirements can just specify version requirements as needed.
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.
All of the constraints here were just ported straight from the legacy tests; I don't know why they were that way. I consolidated everything to use a top-level list that includes load-balanced
(and validated that they pass on the rust driver in that configuration).
source/change-streams/tests/unified/change-streams-resume-errorLabels.yml
Outdated
Show resolved
Hide resolved
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.
Tested in PHPLIB. Various tests were skipped due to my local server version and there were a few failures due to us not having implemented comment
, but everything looks OK otherwise.
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.
These look great! They seem to work in the Go driver with additional logic for rename
and ignoreExtraEvents
. Thanks for the careful review responses. There are some merge conflicts that I think you'll have to handle, though.
16c0cb8
to
e9017ce
Compare
DRIVERS-1713
This PR pulls in the test conversion that was done earlier in mongodb/mongo-rust-driver#570. There was a little bit of merging needed in
change-streams.yml
because some new tests had been added since the conversion, but otherwise it's all a direct copy.