-
Notifications
You must be signed in to change notification settings - Fork 913
GODRIVER-1824 Test that Client waits 500ms between failed Hellos #838
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,4 +108,34 @@ func TestSDAMProse(t *testing.T) { | |
assert.Soon(t, callback, defaultCallbackTimeout) | ||
}) | ||
}) | ||
|
||
mt.RunOpts("client waits between failed Hellos", mtest.NewOptions().MinServerVersion("4.9").Topologies(mtest.Single), func(mt *mtest.T) { | ||
// Force hello requests to fail 5 times. | ||
mt.SetFailPoint(mtest.FailPoint{ | ||
ConfigureFailPoint: "failCommand", | ||
Mode: mtest.FailPointMode{ | ||
Times: 5, | ||
}, | ||
Data: mtest.FailPointData{ | ||
FailCommands: []string{internal.LegacyHello, "hello"}, | ||
ErrorCode: 1234, | ||
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. Is this error code important, or can it be any value? 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. Could be any value I think. 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. Ah, I didn't realize that value came directly from the prose test. Should we consider adding links to the relevant prose test or the GODRIVER ticket to keep a record of what tests cover what prose tests? 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. The GODRIVER ticket already links to a DRIVERS ticket with the specified prose test. However, I do think our prose tests could be better labeled/numbered, so I filed GODRIVER-2274. Probably out of scope for this PR, though. |
||
AppName: "SDAMMinHeartbeatFrequencyTest", | ||
}, | ||
}) | ||
|
||
// Reset client options to use direct connection, app name, and 5s SS timeout. | ||
clientOpts := options.Client().SetDirect(true). | ||
SetAppName("SDAMMinHeartbeatFrequencyTest"). | ||
SetServerSelectionTimeout(5 * time.Second) | ||
mt.ResetClient(clientOpts) | ||
|
||
// Assert that Ping completes successfully within 2 to 3.5 seconds. | ||
start := time.Now() | ||
err := mt.Client.Ping(mtest.Background, nil) | ||
assert.Nil(mt, err, "Ping error: %v", err) | ||
pingTime := time.Since(start) | ||
assert.True(mt, pingTime > 2000*time.Millisecond && pingTime < 3500*time.Millisecond, | ||
"expected Ping to take between 2 and 3.5 seconds, took %v seconds", pingTime.Seconds()) | ||
benjirewis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
}) | ||
} |
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.
Only running this test against standalones since it's using
DirectConnection: true
which will error against replica sets and sharded clusters.