@@ -66,11 +66,9 @@ func TestServerSelectionProse(t *testing.T) {
66
66
SetHosts (hosts [:2 ]).
67
67
SetPoolMonitor (tpm .PoolMonitor ))
68
68
69
- // Start 25 goroutines that each run 10 findOne operations. Run 25 goroutines instead of the
70
- // 10 that the prose test specifies to reduce intermittent test failures caused by the
71
- // random selections not being perfectly even over small numbers of operations.
69
+ // Start 10 goroutines that each run 10 findOne operations.
72
70
var wg sync.WaitGroup
73
- for i := 0 ; i < 25 ; i ++ {
71
+ for i := 0 ; i < 10 ; i ++ {
74
72
wg .Add (1 )
75
73
go func () {
76
74
defer wg .Done ()
@@ -115,21 +113,21 @@ func TestServerSelectionProse(t *testing.T) {
115
113
SetHosts (hosts [:2 ]).
116
114
SetPoolMonitor (tpm .PoolMonitor ))
117
115
118
- // Sleep for 100ms to allow all server state discovery to complete. We need both servers to
116
+ // Sleep for 500ms to allow all server state discovery to complete. We need both servers to
119
117
// be selectable when we start running the test or the distribution of selected servers will
120
118
// be skewed. Unfortunately there's not currently another signal we can block on.
121
- time .Sleep (100 * time .Millisecond )
119
+ time .Sleep (500 * time .Millisecond )
122
120
123
- // Start 25 goroutines that each run 10 findOne operations. Run 25 goroutines instead of the
124
- // 10 that the prose test specifies to reduce intermittent test failures caused by the
125
- // random selections not being perfectly even over small numbers of operations.
121
+ // Start 25 goroutines that each run 25 findOne operations. Run more goroutines and
122
+ // operations than the prose test specifies to reduce intermittent test failures caused by
123
+ // the random selections not being perfectly even over small numbers of operations.
126
124
var wg sync.WaitGroup
127
125
for i := 0 ; i < 25 ; i ++ {
128
126
wg .Add (1 )
129
127
go func () {
130
128
defer wg .Done ()
131
129
132
- for i := 0 ; i < 10 ; i ++ {
130
+ for i := 0 ; i < 25 ; i ++ {
133
131
res := mt .Coll .FindOne (context .Background (), bson.D {})
134
132
assert .NoError (mt , res .Err (), "FindOne() error" )
135
133
}
0 commit comments