Skip to content
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

GODRIVER-2483 Make RTT90 client integration test more reliable #1025

Merged
merged 1 commit into from Jul 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions mongo/integration/client_test.go
Expand Up @@ -673,7 +673,7 @@ func TestClient(t *testing.T) {
SetHeartbeatInterval(reducedHeartbeatInterval).
SetTimeout(0))

// Assert that RTT90s are eventually >300ms.
// Assert that RTT90s are eventually >275ms.
topo := getTopologyFromClient(mt.Client)
assert.Soon(mt, func(ctx context.Context) {
for {
Expand All @@ -686,12 +686,12 @@ func TestClient(t *testing.T) {

time.Sleep(100 * time.Millisecond)

// Wait for all of the server's RTT90s to be >300ms.
// Wait for all of the server's RTT90s to be >275ms.
done := true
for _, desc := range topo.Description().Servers {
server, err := topo.FindServer(desc)
assert.Nil(mt, err, "FindServer error: %v", err)
if server.RTT90() <= 300*time.Millisecond {
if server.RTT90() <= 275*time.Millisecond {
done = false
}
}
Expand All @@ -701,10 +701,10 @@ func TestClient(t *testing.T) {
}
}, 10*time.Second)

// Once we've waited for the RTT90 for the servers to be >300ms, run 10 Ping operations
// with a timeout of 300ms and expect that they return timeout errors.
// Once we've waited for the RTT90 for the servers to be >275ms, run 10 Ping operations
// with a timeout of 275ms and expect that they return timeout errors.
for i := 0; i < 10; i++ {
ctx, cancel = context.WithTimeout(context.Background(), 300*time.Millisecond)
ctx, cancel = context.WithTimeout(context.Background(), 275*time.Millisecond)
err := mt.Client.Ping(ctx, nil)
cancel()
assert.NotNil(mt, err, "expected Ping to return an error")
Expand Down