-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-2723 Convert transactions spec tests to unified test format #1543
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
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 tests are taking a long time because many are waiting 60 seconds for open transactions to time out. We need to add killAllSessions as described here: https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.md#terminating-open-transactions
Note we already do this in the legacy txn test runner here:
mongo-python-driver/test/utils_spec_runner.py
Lines 177 to 185 in 992d150
def kill_all_sessions(self): | |
clients = self.mongos_clients if self.mongos_clients else [self.client] | |
for client in clients: | |
try: | |
client.admin.command("killAllSessions", []) | |
except OperationFailure: | |
# "operation was interrupted" by killing the command's | |
# own session. | |
pass |
…th propagating exceptions from a callback operation to withTransaction
evergreen retry |
evergreen retry |
Evergreen is failing to create the patch build because the diff is too big, here is a manual patch: https://spruce.mongodb.com/version/66022b707612660007a780f0/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC |
I verified that the transaction tests are run on serverless. |
@@ -1229,6 +1235,16 @@ def _databaseOperation_createCommandCursor(self, target, **kwargs): | |||
|
|||
return cursor | |||
|
|||
def kill_all_sessions(self): | |||
if getattr(self, "client", None) is None: |
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.
Why would client be None here? Should we be using the client_context.client?
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.
It was None on two of the tests that were testing the spec runner itself without creating a client.
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.
Oh I see it's TestCreateEntities.
test/unified_format.py
Outdated
if getattr(self, "client", None) is None: | ||
return | ||
try: | ||
self.client.admin.command("killAllSessions", []) |
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.
In the legacy runner, we would run this on all mongoses. I think we should do that here too.
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 couldn't find the equivalent of mongos_clients
, it looks like all clients go through this line:
mongo-python-driver/test/unified_format.py
Line 501 in f757fe3
self[spec["id"]] = client |
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.
We'll need to create those clients like is done in the legacy txn tests:
cls.mongos_clients.append(single_client("{}:{}".format(*address))) |
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.
Done
else: | ||
result = self.run_entity_operation(op) | ||
if isinstance(result, Exception): | ||
raise result |
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.
Why re-raise this exception after ignoreResultAndError or expectError? Does the spec say to do that somewhere?
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.
Yes, "Ensure that neither ignoreResultAndError nor expectError interfere with propagating exceptions from a callback operation to withTransaction"
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.
Where is that written? That line doesn't appear in the spec repo.
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.
That is from the ticket description, there is more discussion on the original spec PR.
What's up with the "@evergreen-ci-prod evergreen — Evergreen error" in the check? |
Looks like the mongos_clients logic needs to be skipped on serverless+loadBalanced clusters. |
The diff is too big, they're working on a fix where it will at least submit the patch even if the diff part fails. |
Done |
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
No description provided.