class LongJobTestCase

Public Instance Methods

setup() click to toggle source
Calls superclass method TestCaseWithSplunkConnection#setup
# File test/test_jobs.rb, line 311
def setup
  super

  install_app_from_collection("sleep_command")
  @job = @service.jobs.create("search index=_internal | sleep 20")
  while !@job.is_ready?()
    sleep(0.1)
  end
end
teardown() click to toggle source
Calls superclass method TestCaseWithSplunkConnection#teardown
# File test/test_jobs.rb, line 321
def teardown
  if @job
    @job.cancel()
    assert_eventually_true(50) do
      !@service.jobs.has_key?(@job.sid)
    end
  end

  super
end
test_setttl() click to toggle source
# File test/test_jobs.rb, line 332
def test_setttl
  old_ttl = Integer(@job["ttl"])
  new_ttl = old_ttl + 1000

  @job.set_ttl(new_ttl)
  assert_eventually_true() do
    @job.refresh()
    ttl = Integer(@job["ttl"])
    ttl <= new_ttl && ttl > old_ttl
  end
end