Parent

LongJobTestCase

Public Instance Methods

setup() click to toggle source
# File test/test_jobs.rb, line 309
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
# File test/test_jobs.rb, line 319
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 330
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
test_touch() click to toggle source
# File test/test_jobs.rb, line 342
def test_touch
  i = 2
  while i < 20
    sleep(i)
    old_ttl = Integer(@job.refresh()["ttl"])
    @job.touch()
    new_ttl = Integer(@job.refresh()["ttl"])
    if new_ttl > old_ttl
      break
    else
      i += 1
    end
  end
  assert_true(new_ttl > old_ttl)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.