spec/support/cluster_tools.rb
def step_down
    admin_client.database.command(
      replSetStepDown: 4, secondaryCatchUpPeriodSecs: 2)
  rescue Mongo::Error::OperationFailure => e
    # While waiting for secondaries to catch up before stepping down, this node decided to step down for other reasons (189)
    if e.code == 189
      # success
    else
      raise
    end
  end
# Requests that the current primary in the RS steps down.
Requests that the current primary in the RS steps down.
Requests that the current primary in the RS steps down .
def step_down
    admin_client.database.command(
      replSetStepDown: 4, secondaryCatchUpPeriodSecs: 2)
  rescue Mongo::Error::OperationFailure => e
    if e.code == 189
    else
      raise
    end
  end
def step_down admin_client . database . command ( replSetStepDown : 4 , secondaryCatchUpPeriodSecs : 2 ) rescue Mongo :: Error :: OperationFailure => e if e . code == 189 else raise end end
Requests that the current primary in the RS steps down.
Requests that the current primary in the RS steps down .
# While waiting for secondaries to catch up before stepping down, this node decided to step down for other reasons (189) # success