Skip to content

Commit 43382f0

Browse files
authored
GODRIVER-2653 Improve reliability of the CSOT server selection prose tests by increasing timeouts. (#1128)
1 parent 4fe91b3 commit 43382f0

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

mongo/integration/csot_prose_test.go

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,52 +85,60 @@ func TestCSOTProse(t *testing.T) {
8585
"insert", "expected a second insert event, got %v", started[1].CommandName)
8686
})
8787
mt.Run("8. server selection", func(mt *mtest.T) {
88-
cliOpts := options.Client().ApplyURI("mongodb://invalid/?serverSelectionTimeoutMS=10")
88+
cliOpts := options.Client().ApplyURI("mongodb://invalid/?serverSelectionTimeoutMS=100")
8989
mtOpts := mtest.NewOptions().ClientOptions(cliOpts).CreateCollection(false)
9090
mt.RunOpts("serverSelectionTimeoutMS honored if timeoutMS is not set", mtOpts, func(mt *mtest.T) {
91+
mt.Parallel()
92+
9193
callback := func(ctx context.Context) {
9294
err := mt.Client.Ping(ctx, nil)
9395
assert.NotNil(mt, err, "expected Ping error, got nil")
9496
}
9597

96-
// Assert that Ping fails within 15ms due to server selection timeout.
97-
assert.Soon(mt, callback, 15*time.Millisecond)
98+
// Assert that Ping fails within 150ms due to server selection timeout.
99+
assert.Soon(mt, callback, 150*time.Millisecond)
98100
})
99101

100-
cliOpts = options.Client().ApplyURI("mongodb://invalid/?timeoutMS=10&serverSelectionTimeoutMS=20")
102+
cliOpts = options.Client().ApplyURI("mongodb://invalid/?timeoutMS=100&serverSelectionTimeoutMS=200")
101103
mtOpts = mtest.NewOptions().ClientOptions(cliOpts).CreateCollection(false)
102104
mt.RunOpts("timeoutMS honored for server selection if it's lower than serverSelectionTimeoutMS", mtOpts, func(mt *mtest.T) {
105+
mt.Parallel()
106+
103107
callback := func(ctx context.Context) {
104108
err := mt.Client.Ping(ctx, nil)
105109
assert.NotNil(mt, err, "expected Ping error, got nil")
106110
}
107111

108-
// Assert that Ping fails within 15ms due to timeout.
109-
assert.Soon(mt, callback, 15*time.Millisecond)
112+
// Assert that Ping fails within 150ms due to timeout.
113+
assert.Soon(mt, callback, 150*time.Millisecond)
110114
})
111115

112-
cliOpts = options.Client().ApplyURI("mongodb://invalid/?timeoutMS=20&serverSelectionTimeoutMS=10")
116+
cliOpts = options.Client().ApplyURI("mongodb://invalid/?timeoutMS=200&serverSelectionTimeoutMS=100")
113117
mtOpts = mtest.NewOptions().ClientOptions(cliOpts).CreateCollection(false)
114118
mt.RunOpts("serverSelectionTimeoutMS honored for server selection if it's lower than timeoutMS", mtOpts, func(mt *mtest.T) {
119+
mt.Parallel()
120+
115121
callback := func(ctx context.Context) {
116122
err := mt.Client.Ping(ctx, nil)
117123
assert.NotNil(mt, err, "expected Ping error, got nil")
118124
}
119125

120-
// Assert that Ping fails within 15ms due to server selection timeout.
121-
assert.Soon(mt, callback, 15*time.Millisecond)
126+
// Assert that Ping fails within 150ms due to server selection timeout.
127+
assert.Soon(mt, callback, 150*time.Millisecond)
122128
})
123129

124-
cliOpts = options.Client().ApplyURI("mongodb://invalid/?timeoutMS=0&serverSelectionTimeoutMS=10")
130+
cliOpts = options.Client().ApplyURI("mongodb://invalid/?timeoutMS=0&serverSelectionTimeoutMS=100")
125131
mtOpts = mtest.NewOptions().ClientOptions(cliOpts).CreateCollection(false)
126132
mt.RunOpts("serverSelectionTimeoutMS honored for server selection if timeoutMS=0", mtOpts, func(mt *mtest.T) {
133+
mt.Parallel()
134+
127135
callback := func(ctx context.Context) {
128136
err := mt.Client.Ping(ctx, nil)
129137
assert.NotNil(mt, err, "expected Ping error, got nil")
130138
}
131139

132-
// Assert that Ping fails within 15ms due to server selection timeout.
133-
assert.Soon(mt, callback, 15*time.Millisecond)
140+
// Assert that Ping fails within 150ms due to server selection timeout.
141+
assert.Soon(mt, callback, 150*time.Millisecond)
134142
})
135143
})
136144
}

0 commit comments

Comments
 (0)