File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 16
16
use Symfony \Bridge \PhpUnit \SetUpTearDownTrait ;
17
17
use UnexpectedValueException ;
18
18
use function current ;
19
+ use function sprintf ;
19
20
20
21
/**
21
22
* @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests
@@ -215,7 +216,20 @@ public function testGetMoreIteration()
215
216
216
217
// Send a {replSetStepDown: 5, force: true} command to the current primary and verify that the command succeeded
217
218
$ primary = $ this ->client ->getManager ()->selectServer (new ReadPreference (ReadPreference::RP_PRIMARY ));
218
- $ primary ->executeCommand ('admin ' , new Command (['replSetStepDown ' => 5 , 'force ' => true ]));
219
+
220
+ $ success = false ;
221
+ $ attempts = 0 ;
222
+ do {
223
+ try {
224
+ $ attempts ++;
225
+ $ primary ->executeCommand ('admin ' , new Command (['replSetStepDown ' => 5 , 'force ' => true ]));
226
+ $ success = true ;
227
+ } catch (DriverException $ e ) {
228
+ if ($ attempts == 10 ) {
229
+ $ this ->fail (sprintf ('Could not successfully execute replSetStepDown within %d attempts ' , $ attempts ));
230
+ }
231
+ }
232
+ } while (! $ success );
219
233
220
234
// Retrieve the next batch of results from the cursor obtained in the find operation, and verify that this operation succeeded.
221
235
$ events = [];
You can’t perform that action at this time.
0 commit comments