Skip to content
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-2871 CSOT tests: Expect withTransaction to propagate errors #1553

Merged
merged 1 commit into from
May 2, 2024

Conversation

rozza
Copy link
Member

@rozza rozza commented Mar 21, 2024

DRIVERS-2871

Please complete the following before merging:

  • Update changelog.
  • Make sure there are generated JSON files from the YAML test files.
  • Test changes in at least one language driver.
  • Test these changes against all server versions and topologies (including standalone, replica set, sharded
    clusters, and serverless).

@rozza rozza requested a review from a team as a code owner March 21, 2024 17:26
@@ -103,3 +100,11 @@ tests:
command:
insert: *collectionName
maxTimeMS: { $$type: ["int", "long"] }
- commandStartedEvent:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As withTransaction expects an error, then an abortTransaction event will be issued.

@ShaneHarvey ShaneHarvey changed the title CSOT tests: Expect withTransaction to propagate errors DRIVERS-2876 CSOT tests: Expect withTransaction to propagate errors Mar 26, 2024
@ShaneHarvey ShaneHarvey changed the title DRIVERS-2876 CSOT tests: Expect withTransaction to propagate errors DRIVERS-2871 CSOT tests: Expect withTransaction to propagate errors Mar 26, 2024
@@ -49,6 +49,8 @@ tests:
timeoutMS: 100
expectError:
isClientError: true
expectError:
isClientError: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PyMongo (and Go) the "expectError" on the insertOne above causes the test runner to catch, validate, and the ignore the exception so it never reaches the withTransaction block. So this new test would fail. Is it a bug that Java propagates the exception?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. This was recently changed in https://jira.mongodb.org/browse/DRIVERS-1709 but wasn't documented in the UTR spec itself. The only reference is in the jira ticket:

Ensure that neither ignoreResultAndError nor expectError interfere with propagating exceptions from a callback operation to withTransaction. This came up with the Java driver's POC.

Copy link
Member

@ShaneHarvey ShaneHarvey Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I was looking at the old RST version. It is documented in the markdown version: https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.md#withtransaction

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify was this change correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this change is correct given the new rules for handling errors in the UTR.

@rozza rozza merged commit ebac90d into mongodb:master May 2, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants