-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
PYTHON-4533 - Convert test/test_sessions.py to async #1733
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.
Overall, LGTM. Few comments.
Curious why test/test_sessions.py
is seen as a net-new file? Is there a location where it still needs to be deleted?
test/test_sessions.py
Outdated
self.assertIsNone(after_cluster_time) | ||
|
||
|
||
# class TestClusterTime(IntegrationTest): |
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.
Should this still be commented out?
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, good catch thanks.
test/asynchronous/test_sessions.py
Outdated
self.assertIsNone(after_cluster_time) | ||
|
||
|
||
# class TestClusterTime(AsyncIntegrationTest): |
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.
Same
test/asynchronous/test_sessions.py
Outdated
_IS_SYNC = False | ||
|
||
|
||
# Ignore auth commands like saslStart, so we can assert lsid is in all commands. |
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.
what's an lsid? is it just a session_id?
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.
lsid
is server-side session_id
.
test/asynchronous/test_sessions.py
Outdated
await client.aclose() | ||
self.assertEqual(len(client._topology._session_pool), 0) | ||
end_sessions = [e for e in listener.started_events if e.command_name == "endSessions"] | ||
self.assertEqual(len(end_sessions), 2) |
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.
Any idea why this is two?
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 create two sessions above, so we expect both to close here.
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 thought we created _MAX_END_SESSIONS
which evaluated to 10000
?
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.
Checked the sync changes! Main feedback is whether or not the to_list
is the correct operation for the cursor. I checked the docs, and I saw for the pymongo.cursor types there should still just be using list()
. Let me know if that's changed.
|
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
@@ -148,6 +148,7 @@ | |||
"test_collection.py", | |||
"test_database.py", | |||
"test_session.py", | |||
"test_transactions.py", |
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.
Mistaken addition or necessary to make synchro tests pass?
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.
Merge artifact, fixed.
test/test_session.py
Outdated
@@ -392,13 +404,30 @@ def test_cursor(self): | |||
coll = client.pymongo_test.collection | |||
coll.insert_many([{} for _ in range(1000)]) | |||
|
|||
def lambda_find(session): |
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.
This naming schema is a bit odd since none of these are "lambdas". How about we call them "find", "distinct", etc...?
test/test_session.py
Outdated
self._test_cursor_helper( | ||
lambda coll, session: coll.find(session=session), lambda cursor: cursor.close() | ||
) | ||
def alambda(coll, session): |
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.
Same comment about "lambda".
8cd8a75
to
a6845cb
Compare
No description provided.