File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -400,12 +400,13 @@ def test_primary_stepdown(self):
400
400
sleep (1 )
401
401
rs_state = c ._MongoReplicaSetClient__rs_state
402
402
if rs_state .writer and rs_state .writer != primary :
403
- # New primary stepped up
404
- new_primary = _partition_node (ha_tools .get_primary ())
405
- self .assertEqual (new_primary , rs_state .writer )
406
- new_secondaries = partition_nodes (ha_tools .get_secondaries ())
407
- self .assertEqual (set (new_secondaries ), rs_state .secondaries )
408
- break
403
+ if ha_tools .get_primary ():
404
+ # New primary stepped up
405
+ new_primary = _partition_node (ha_tools .get_primary ())
406
+ self .assertEqual (new_primary , rs_state .writer )
407
+ new_secondaries = partition_nodes (ha_tools .get_secondaries ())
408
+ self .assertEqual (set (new_secondaries ), rs_state .secondaries )
409
+ break
409
410
else :
410
411
self .fail (
411
412
"No new primary after %s seconds. Old primary was %s, current"
You can’t perform that action at this time.
0 commit comments