spec/support/cluster_tools.rb
def step_up(address)
    client = direct_client(address)
    start = Time.now
    loop do
      begin
        client.database.command(replSetStepUp: 1)
        break
      rescue Mongo::Error::OperationFailure => e
        # Election failed. (125)
        if e.code == 125
          # Possible reason is the node we are trying to elect has deny-listed
          # itself. This is where {replSetFreeze: 0} should make it eligible
          # for election again but this seems to not always work.
        else
          raise
        end

        if Time.now > start + 10
          raise e
        end
      end
    end
    reset_server_states
  end
# Attempts to elect the server at the specified address as the new primary
# by asking it to step up.
#
# @param [ Mongo::Address ] address
Attempts to elect the server at the specified address as the new primary
by asking it to step up.
Attempts to elect the server at the specified address as the new primary by asking it to step up .
def step_up(address)
    client = direct_client(address)
    start = Time.now
    loop do
      begin
        client.database.command(replSetStepUp: 1)
        break
      rescue Mongo::Error::OperationFailure => e
        if e.code == 125
        else
          raise
        end
        if Time.now > start + 10
          raise e
        end
      end
    end
    reset_server_states
  end
def step_up ( address ) client = direct_client ( address ) start = Time . now loop do begin client . database . command ( replSetStepUp : 1 ) break rescue Mongo :: Error :: OperationFailure => e if e . code == 125 else raise end if Time . now > start + 10 raise e end end end reset_server_states end
Attempts to elect the server at the specified address as the new primary
by asking it to step up.
Attempts to elect the server at the specified address as the new primary by asking it to step up .
# Election failed. (125) # Possible reason is the node we are trying to elect has deny-listed # itself. This is where {replSetFreeze: 0} should make it eligible # for election again but this seems to not always work.
address
None