Sha256: f12af4d66312ced8853db5f8d63f7986efe296457e37b9c643b521aa0d7ccc30

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

Stored size: 1.13 KB

Contents

RSpec.describe WorkerKiller::Killer::Passenger do
  let(:config) do
    WorkerKiller::Configuration.new.tap do |c|
      c.quit_attempts = 2
      c.term_attempts = 2
    end
  end

  let(:killer){ described_class.new() }

  describe '#kill' do
    before do
      allow(described_class).to receive(:check_passenger_config).and_return('custompath')
    end

    around do |example|
      prev = WorkerKiller.configuration
      WorkerKiller.configuration = config
      example.run
    ensure
      WorkerKiller.configuration = prev
    end

    it 'expect right signal order' do
      expect(Kernel).to receive(:system).with("custompath detach-process #{Process.pid}").and_return(true)
      expect(Process).to receive(:kill).with(:KILL, anything).exactly(5).times

      thread = killer.kill(Time.now)
      thread.join

      1.times { killer.kill(Time.now) } # 1 QUIT
      2.times { killer.kill(Time.now) } # 1 TERM
      5.times { killer.kill(Time.now) } # 5 KILL
    end
  end

  describe '#check_passenger_config!' do
    it do
      expect{ described_class.check_passenger_config!('nonenone') }.to raise_error(/Can't find passenger/)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
worker_killer-1.1.0.223443 spec/killer/passenger_spec.rb
worker_killer-1.1.0.214159 spec/killer/passenger_spec.rb
worker_killer-1.1.0.214146 spec/killer/passenger_spec.rb
worker_killer-1.0.5.213977 spec/killer/passenger_spec.rb
worker_killer-1.0.5.213889 spec/killer/passenger_spec.rb
worker_killer-1.0.4.189871 spec/killer/passenger_spec.rb
worker_killer-1.0.3.189564 spec/killer/passenger_spec.rb
worker_killer-1.0.3.189098 spec/killer/passenger_spec.rb
worker_killer-1.0.2.187852 spec/killer/passenger_spec.rb
worker_killer-1.0.2.187805 spec/killer/passenger_spec.rb
worker_killer-1.0.2.187732 spec/killer/passenger_spec.rb
worker_killer-1.0.1.83603 spec/killer/passenger_spec.rb
worker_killer-1.0.1.75538 spec/killer/passenger_spec.rb
worker_killer-1.0.1.39842 spec/killer/passenger_spec.rb
worker_killer-1.0.0.39841 spec/killer/passenger_spec.rb
worker_killer-1.0.0.39839 spec/killer/passenger_spec.rb
worker_killer-0.1.1.39838 spec/killer/passenger_spec.rb