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 1616use Symfony \Bridge \PhpUnit \SetUpTearDownTrait ;
1717use UnexpectedValueException ;
1818use function current ;
19+ use function sprintf ;
1920
2021/**
2122 * @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests
@@ -215,7 +216,20 @@ public function testGetMoreIteration()
215216
216217 // Send a {replSetStepDown: 5, force: true} command to the current primary and verify that the command succeeded
217218 $ 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 );
219233
220234 // Retrieve the next batch of results from the cursor obtained in the find operation, and verify that this operation succeeded.
221235 $ events = [];
You can’t perform that action at this time.
0 commit comments