Skip to content

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

Merged
merged 3 commits into from
Dec 8, 2020

Conversation

ShaneHarvey
Copy link
Member

@ShaneHarvey ShaneHarvey commented Nov 24, 2020

@ShaneHarvey
Copy link
Member Author

@ShaneHarvey
Copy link
Member Author

This is ready for review although I still need to create a PYTHON ticket to track the work.

@ShaneHarvey ShaneHarvey changed the title SPEC-1764 Implement Monitors sleep at least minHeartbeatFreqencyMS between checks PYTHON-2457 Test that clients wait 500ms between failed heartbeat checks Dec 4, 2020
# Force a connection.
client.admin.command('ping')
duration = time.time() - start
self.assertGreaterEqual(duration, 2)
Copy link
Contributor

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)

Copy link
Member Author

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)
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

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).

@ShaneHarvey ShaneHarvey merged commit 61232b7 into mongodb:master Dec 8, 2020
ShaneHarvey added a commit to ShaneHarvey/mongo-python-driver that referenced this pull request Dec 8, 2020
@ShaneHarvey ShaneHarvey deleted the SPEC-1764-poc branch December 8, 2020 20:37
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.

3 participants