-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-2457 Test that clients wait 500ms between failed heartbeat checks #524
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
This is ready for review although I still need to create a PYTHON ticket to track the work. |
4bc4b24
to
bf6356d
Compare
# Force a connection. | ||
client.admin.command('ping') | ||
duration = time.time() - start | ||
self.assertGreaterEqual(duration, 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.
Can you add comments here that explain the math? E.g.
# isMaster attempted 5 times with 500 ms between checks => duration > 4 * 500ms
self.assertGreaterEqual(duration, 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.
Added a link to the spec and an explanation like the previous version of the test.
client.admin.command('ping') | ||
duration = time.time() - start | ||
self.assertGreaterEqual(duration, 2) | ||
self.assertLessEqual(duration, 3.5) |
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.
How do you arrive at 3.5s?
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.
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 added it as a generous upper bound to account for any timing differences in the various test runner implementatinos. Drivers should really take between 2 and 2.5 seconds (depending on when the timer was started and how fast the monitors start up).
Implements: mongodb/specifications#879