-
Notifications
You must be signed in to change notification settings - Fork 246
SPEC-1221 Reinstate DuplicateKey code assertions in error labels tests #586
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
Conversation
|
Is there an issue number for this PR? |
|
@jmikola This goes with the discussion we were having in https://jira.mongodb.org/browse/SERVER-39706 with James. |
|
#482 was the previous change that removed the DuplicateKey code name assertions. If we're going to add them back in the "E11000" form can you add them to all the other tests too? |
|
I can do that if there is consensus that the change in this PR is wanted. |
|
I don't have objections if I appreciate the desire to be strict here. Although the operations make it clear that we're causing a duplicate key exception, we can't really be sure without inspecting the error. |
1814b2e to
344fe91
Compare
344fe91 to
fa943da
Compare
fa943da to
5262ba1
Compare
|
Updated all test files as requested by @ShaneHarvey . |
jmikola
left a comment
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. Over to @ShaneHarvey.
ShaneHarvey
left a comment
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, tested in python: https://evergreen.mongodb.com/version/5d7fc2710305b931eb9a230c
Note that I had to make a small test code change to the "assertErrorContains" logic to look inside our BulkWriteException class otherwise the test would fail with AssertionError: 'e11000' not found in 'batch op errors occurred'.
|
That is expected since the error was moved from top level to the bulk write errors. |
|
https://github.com/mongodb/specifications/tree/master/source/crud/tests mentions BulkWriteException but not errorContains, should I add a description for errorContains there as part of this PR? |
|
I don't think we need to add errorContains to the crud spec. It's described in https://github.com/mongodb/specifications/blob/master/source/transactions/tests/README.rst |
I think we should err on the side of having each spec document the test fields it actually uses, until we actually have a unified format in place. That said, this PR didn't actually modify any CRUD test files so I'm a bit confused by @p-mongo's question of adding a note in this comment. @ShaneHarvey, was this comment referring to you needing to add the BulkWriteException inspection to your transactions spec test runner? If so, perhaps we should add a note about that to the transactions spec test README. |
Yes it was. I just remembered that BulkWriteException is part of the crud spec. Maybe we can add somethign like this to the errorContains doc:
|
|
The transaction test format docs already say that "errorContains" is " A substring of the expected error message.", so I think we could get by with amending the docs for the That said, I believe some drivers create the BulkWriteException by concatenating the errors within it, in which case some drivers may not even care about this. It's still worth noting in the README, though.
I'd propose the following note section after the test format syntax: I didn't mention anything about error labels, but I don't think those would apply to |
|
Added the suggested note. |
ShaneHarvey
left a comment
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.
Still LGTM.
No description provided.