Sha256: 6061cb6f1c8289522dea9b75d51429423c472abcd965c9bf54aba780dc4701c8

Contents?: true

Size: 943 Bytes

Versions: 11

Compression:

Stored size: 943 Bytes

Contents

require 'test_helper'
require 'chillout/creations_container'

class WorkerIntegrationTest < ChilloutTestCase

  def setup
    @_api_key = "xyz123"
    stub_request(:post, api_url('clients')).to_return(:body => "OK", :status => 200)
    stub_request(:post, api_url('metrics')).to_return(:body => "OK", :status => 200)
  end

  def test_worker_running_after_fork_on_first_use
    return if RUBY_PLATFORM == 'java'

    client = Chillout::Client.new(@_api_key, :logger => null_logger)
    worker_check = Proc.new do
      client.enqueue(Chillout::CreationsContainer.new)
      client.worker_running? ? Process.exit!(0) : Process.exit!(28)
    end

    assert_successful_exit Process.fork(&worker_check)
  end

  def test_worker_running_lazily
    client = Chillout::Client.new(@_api_key, :logger => null_logger)
    assert !client.worker_running?

    client.enqueue(Chillout::CreationsContainer.new)
    assert client.worker_running?
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
chillout-0.8.9 test/integration/worker_test.rb
chillout-0.8.5.1 test/integration/worker_test.rb
chillout-0.8.8 test/integration/worker_test.rb
chillout-0.8.7 test/integration/worker_test.rb
chillout-0.8.6 test/integration/worker_test.rb
chillout-0.8.5 test/integration/worker_test.rb
chillout-0.8.4 test/integration/worker_test.rb
chillout-0.8.3 test/integration/worker_test.rb
chillout-0.8.2 test/integration/worker_test.rb
chillout-0.8.1 test/integration/worker_test.rb
chillout-0.8.0 test/integration/worker_test.rb