Sha256: de6f28b805d18f9a54207876474e283f01bf8be3e3b266dbd9cf0f2570188470

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require_relative "test_helper"
require "splunk-sdk-ruby"

include Splunk

class TestRestarts < TestCaseWithSplunkConnection
  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
    end

    assert_logged_in(service)
  end

  def test_restart_with_short_timeout
    service = Context.new(@splunkrc).login()
    begin
      service.restart(0.1)
    rescue TimeoutError
      # 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

  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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
splunk-sdk-ruby-0.1.0 test/test_restarts.rb