Skip to content

Commit bf81967

Browse files
committed
Increase server selection prose test iteration to increase reliability.
1 parent e20a58c commit bf81967

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

mongo/integration/server_selection_prose_test.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@ func TestServerSelectionProse(t *testing.T) {
6666
SetHosts(hosts[:2]).
6767
SetPoolMonitor(tpm.PoolMonitor))
6868

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.
7270
var wg sync.WaitGroup
73-
for i := 0; i < 25; i++ {
71+
for i := 0; i < 10; i++ {
7472
wg.Add(1)
7573
go func() {
7674
defer wg.Done()
@@ -115,21 +113,21 @@ func TestServerSelectionProse(t *testing.T) {
115113
SetHosts(hosts[:2]).
116114
SetPoolMonitor(tpm.PoolMonitor))
117115

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
119117
// be selectable when we start running the test or the distribution of selected servers will
120118
// 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)
122120

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.
126124
var wg sync.WaitGroup
127125
for i := 0; i < 25; i++ {
128126
wg.Add(1)
129127
go func() {
130128
defer wg.Done()
131129

132-
for i := 0; i < 10; i++ {
130+
for i := 0; i < 25; i++ {
133131
res := mt.Coll.FindOne(context.Background(), bson.D{})
134132
assert.NoError(mt, res.Err(), "FindOne() error")
135133
}

0 commit comments

Comments
 (0)