-
Notifications
You must be signed in to change notification settings - Fork 244
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-943 Convert retryable writes command construction tests to unified format #1697
base: master
Are you sure you want to change the base?
DRIVERS-943 Convert retryable writes command construction tests to unified format #1697
Conversation
- `insertMany()` with `ordered=false` | ||
- `bulkWrite()` with `ordered=true` (no `UpdateMany` or `DeleteMany`) | ||
- `bulkWrite()` with `ordered=false` (no `UpdateMany` or `DeleteMany`) | ||
Command construction tests asserting on the absence or presence of the `txnNumber` field have been replaced by command |
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 feel this wording is a little confusing - originally it made me think we are no longer asserting on txnNumber
.
I think it'd be better to remove this section, and if we want to include this information somewhere, we can expand in the changelog instead. Something like the following:
Convert command construction tests to unified format. In the retryable writes unified tests, the unified spec runner now asserts on the absence or presence of the
txnNumber
field using 'Command Monitoring'.
What do you think?
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 specs README states:
Outdated tests must not be removed completely, but may be marked as such (e.g. by striking through or replacing the entire test with a note (e.g. Removed).
I think it's useful to maintain this section as a reference for drivers that have not yet removed these tests. WDYT about adding a strikethrough to the section title and rephrasing this as:
These prose tests have been removed in favor of unified format tests.
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.
Sure, we can also rephrase it to something like.
In the retryable writes unified tests, the unified spec runner now asserts on the absence or presence of the txnNumber field using 'Command Monitoring'.
This or the strikethrough works!
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.
LGTM with suggestions applied. Tests pass in C driver.
DRIVERS-943 includes:
also move the Split Batch Tests section to a numbered prose test.
Though I prefer leaving that change out of this PR (as is done now). I expect that can be done in a separate PR if that is still desired, and may not require a DRIVERS ticket.
@@ -493,3 +493,25 @@ tests: | |||
documents: | |||
- { _id: 1, x: 12 } | |||
- { _id: 2, x: 22 } | |||
- description: "collection bulkWrite with updateMany and deleteMany does not set txnNumber" |
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.
Suggest splitting to test updateMany
and deleteMany
in isolation:
- description: "collection bulkWrite with updateMany does not set txnNumber"
operations:
- object: *collection0
name: bulkWrite
arguments:
requests:
-
updateMany:
filter: {}
update: { $set: { x: 1 } }
expectEvents:
- client: client0
events:
- commandStartedEvent:
commandName: update
command:
txnNumber: { $$exists: false }
- description: "collection bulkWrite with deleteMany does not set txnNumber"
operations:
- object: *collection0
name: bulkWrite
arguments:
requests:
-
deleteMany:
filter: {}
expectEvents:
- client: client0
events:
- commandStartedEvent:
commandName: delete
command:
txnNumber: { $$exists: false }
Co-authored-by: Kevin Albertson <kevin.albertson@10gen.com>
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.
@aditi-khare-mongoDB do these tests pass in the Node driver?
- `insertMany()` with `ordered=false` | ||
- `bulkWrite()` with `ordered=true` (no `UpdateMany` or `DeleteMany`) | ||
- `bulkWrite()` with `ordered=false` (no `UpdateMany` or `DeleteMany`) | ||
Command construction tests asserting on the absence or presence of the `txnNumber` field have been replaced by command |
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 specs README states:
Outdated tests must not be removed completely, but may be marked as such (e.g. by striking through or replacing the entire test with a note (e.g. Removed).
I think it's useful to maintain this section as a reference for drivers that have not yet removed these tests. WDYT about adding a strikethrough to the section title and rephrasing this as:
These prose tests have been removed in favor of unified format tests.
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.
See comment! LGTM with changes
DRIVERS-943
This PR removes the retryable writes command construction tests that assert on the presence/absence of
txnNumber
and adds equivalent assertions to the unified tests. Most of the existing retryable writes unified tests don't currently use command monitoring, and I only added what was necessary to match the coverage of the removed construction tests. DRIVERS-2849 tracks adding more comprehensive command monitoring assertions to the retryable writes tests.Draft PR for Rust: mongodb/mongo-rust-driver#1234
The unacknowledged writes and collection bulk write tests are not run in the Rust driver, so another driver will need to verify that these tests work.
Please complete the following before merging:
clusters, and serverless).