@@ -43,7 +43,7 @@ public function setUp(): void
43
43
}
44
44
45
45
/**
46
- * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#id10
46
+ * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#not-primary-keep-connection-pool
47
47
*/
48
48
public function testNotPrimaryKeepsConnectionPool (): void
49
49
{
@@ -79,7 +79,7 @@ public function testNotPrimaryKeepsConnectionPool(): void
79
79
}
80
80
81
81
/**
82
- * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#id11
82
+ * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#not-primary-reset-connection-pool
83
83
*/
84
84
public function testNotPrimaryResetConnectionPool (): void
85
85
{
@@ -106,16 +106,19 @@ public function testNotPrimaryResetConnectionPool(): void
106
106
$ this ->assertSame (self ::NOT_PRIMARY , $ e ->getCode ());
107
107
}
108
108
109
- // Verify that the connection pool has been cleared
110
- $ this ->assertSame ($ totalConnectionsCreated + 1 , $ this ->getTotalConnectionsCreated ());
109
+ /* Verify that the connection pool has been cleared and that a new
110
+ * connection has been created. Use ">=" to allow for the possibility
111
+ * that the server created additional connections unrelated to this
112
+ * test. */
113
+ $ this ->assertGreaterThanOrEqual ($ totalConnectionsCreated + 1 , $ this ->getTotalConnectionsCreated ());
111
114
112
115
// Execute an insert into the test collection of a {test: 1} document and verify that it succeeds.
113
116
$ result = $ this ->insertDocuments (1 );
114
117
$ this ->assertSame (1 , $ result ->getInsertedCount ());
115
118
}
116
119
117
120
/**
118
- * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#id12
121
+ * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#shutdown-in-progress-reset-connection-pool
119
122
*/
120
123
public function testShutdownResetConnectionPool (): void
121
124
{
@@ -142,16 +145,19 @@ public function testShutdownResetConnectionPool(): void
142
145
$ this ->assertSame (self ::SHUTDOWN_IN_PROGRESS , $ e ->getCode ());
143
146
}
144
147
145
- // Verify that the connection pool has been cleared
146
- $ this ->assertSame ($ totalConnectionsCreated + 1 , $ this ->getTotalConnectionsCreated ());
148
+ /* Verify that the connection pool has been cleared and that a new
149
+ * connection has been created. Use ">=" to allow for the possibility
150
+ * that the server created additional connections unrelated to this
151
+ * test. */
152
+ $ this ->assertGreaterThanOrEqual ($ totalConnectionsCreated + 1 , $ this ->getTotalConnectionsCreated ());
147
153
148
154
// Execute an insert into the test collection of a {test: 1} document and verify that it succeeds.
149
155
$ result = $ this ->insertDocuments (1 );
150
156
$ this ->assertSame (1 , $ result ->getInsertedCount ());
151
157
}
152
158
153
159
/**
154
- * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#id13
160
+ * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#interrupted-at-shutdown-reset-connection-pool
155
161
*/
156
162
public function testInterruptedAtShutdownResetConnectionPool (): void
157
163
{
@@ -178,16 +184,19 @@ public function testInterruptedAtShutdownResetConnectionPool(): void
178
184
$ this ->assertSame (self ::INTERRUPTED_AT_SHUTDOWN , $ e ->getCode ());
179
185
}
180
186
181
- // Verify that the connection pool has been cleared
182
- $ this ->assertSame ($ totalConnectionsCreated + 1 , $ this ->getTotalConnectionsCreated ());
187
+ /* Verify that the connection pool has been cleared and that a new
188
+ * connection has been created. Use ">=" to allow for the possibility
189
+ * that the server created additional connections unrelated to this
190
+ * test. */
191
+ $ this ->assertGreaterThanOrEqual ($ totalConnectionsCreated + 1 , $ this ->getTotalConnectionsCreated ());
183
192
184
193
// Execute an insert into the test collection of a {test: 1} document and verify that it succeeds.
185
194
$ result = $ this ->insertDocuments (1 );
186
195
$ this ->assertSame (1 , $ result ->getInsertedCount ());
187
196
}
188
197
189
198
/**
190
- * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#id9
199
+ * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#getmore-iteration
191
200
*/
192
201
public function testGetMoreIteration (): void
193
202
{
0 commit comments