-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
test(NODE-6492): add integration tests for transaction write concern behavior #4490
base: main
Are you sure you want to change the base?
Conversation
|
||
describe('Transactions Spec Prose', function () { | ||
let client: MongoClient; | ||
const started = []; |
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.
Do you think it is worth updating the spec with the additional requirements you found here? Looks like Python's implementation has found the same things (they're the only other driver that has implemented the test so far).
- requires transactions (4.0+, non-sharded. 4.2+, sharded)
- you must create the collection / ensure it exists beforehand
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.
|
||
const insertStarted = started.find(ev => ev.commandName === 'insert'); | ||
expect(insertStarted).to.not.have.nested.property('command.writeConcern'); | ||
|
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.
Are we missing the following check?
Ensure the document was inserted and no error was thrown from the transaction.
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.
No, its just by nature of the insert / commitTransaction not throwing. Checking the command started is sort of unreachable, if the WC is set the commitTxn throws, but its a reasonable double-check
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.
Python checks that the result of the insert is an inserted id. We could also query the collection after the transaction for our doc - either would satisfy the "confirm the document was inserted".
This is important because w: 0 doesn't throw but might 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.
Gotcha, will do
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.
added
Description
What is changing?
Add prose test - NODE-6492
Is there new documentation needed for these changes?
No
What is the motivation for this change?
Spec compliance
Double check the following
npm run check:lint
scripttype(NODE-xxxx)[!]: description
feat(NODE-1234)!: rewriting everything in coffeescript