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-2806 Fix test_aggregate_raw_transaction #673
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1483,10 +1483,13 @@ def test_find_raw_transaction(self): | |
session=session).sort('_id')) | ||
cmd = listener.results['started'][0] | ||
self.assertEqual(cmd.command_name, 'find') | ||
self.assertEqual(cmd.command['$clusterTime'], | ||
decode_all(session.cluster_time.raw)[0]) | ||
self.assertIn('$clusterTime', cmd.command) | ||
self.assertEqual(cmd.command['startTransaction'], True) | ||
self.assertEqual(cmd.command['txnNumber'], 1) | ||
# Ensure we update $clusterTime from the command response. | ||
last_cmd = listener.results['succeeded'][-1] | ||
self.assertEqual(last_cmd.reply['$clusterTime']['clusterTime'], | ||
session.cluster_time['clusterTime']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we check that the most recent command response using the session is equal to the session's $clusterTime. I used |
||
|
||
self.assertEqual(1, len(batches)) | ||
self.assertEqual(docs, decode_all(batches[0])) | ||
|
@@ -1677,9 +1680,13 @@ def test_aggregate_raw_transaction(self): | |
[{'$sort': {'_id': 1}}], session=session)) | ||
cmd = listener.results['started'][0] | ||
self.assertEqual(cmd.command_name, 'aggregate') | ||
self.assertEqual(cmd.command['$clusterTime'], session.cluster_time) | ||
self.assertIn('$clusterTime', cmd.command) | ||
self.assertEqual(cmd.command['startTransaction'], True) | ||
self.assertEqual(cmd.command['txnNumber'], 1) | ||
# Ensure we update $clusterTime from the command response. | ||
last_cmd = listener.results['succeeded'][-1] | ||
self.assertEqual(last_cmd.reply['$clusterTime']['clusterTime'], | ||
session.cluster_time['clusterTime']) | ||
self.assertEqual(1, len(batches)) | ||
self.assertEqual(docs, decode_all(batches[0])) | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Here we only care that $clusterTime was added to the outgoing command.