class TestRestarts

Public Instance Methods

test_restart_with_long_timeout() click to toggle source
# File test/test_restarts.rb, line 7
def test_restart_with_long_timeout
  service = Context.new(@splunkrc).login()
  begin
    service.restart(2000)
  rescue TimeoutError
    while !service.server_accepting_connections? ||
        service.server_requires_restart?
      sleep(0.3)
    end
    if !service.server_accepting_connections?
      fail("Did not restart within timeout.")
    end
  end

  assert_logged_in(service)
end
test_restart_with_no_timeout() click to toggle source
# File test/test_restarts.rb, line 46
def test_restart_with_no_timeout
  service = Context.new(@splunkrc).login()
  service.restart()

  assert_not_logged_in(service)

  # Wait for it to come back up
  while !service.server_accepting_connections? ||
      service.server_requires_restart?
    sleep(0.3)
  end
  assert_logged_in(service)
end
test_restart_with_short_timeout() click to toggle source
# File test/test_restarts.rb, line 24
def test_restart_with_short_timeout
  service = Context.new(@splunkrc).login()
  begin
    service.restart(0.1)
  rescue TimeoutError
    # Wait for it to go down
    while service.server_accepting_connections? &&
        service.server_requires_restart?
      sleep(0.1)
    end

    # Wait for it to come back up
    while !service.server_accepting_connections? ||
        service.server_requires_restart?
      sleep(0.3)
    end
    assert_logged_in(service)
  else
    fail("Somehow Splunk managed to restart in 100ms...")
  end
end