Sha256: 782c5af61b9b7003476f6caf219de60b6ddbb2d7f8ccce65f07981b717e74ae1

Contents?: true

Size: 942 Bytes

Versions: 17

Compression:

Stored size: 942 Bytes

Contents

RSpec.describe WorkerKiller::Killer::Signal 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
    context 'with use_quit TRUE' do
      around do |example|
        prev = WorkerKiller.configuration
        WorkerKiller.configuration = config
        example.run
      ensure
        WorkerKiller.configuration = prev
      end

      it 'expect right signal order' do
        expect(Process).to receive(:kill).with(:QUIT, anything).exactly(1).times
        expect(Process).to receive(:kill).with(:TERM, anything).exactly(1).times
        expect(Process).to receive(:kill).with(:KILL, anything).exactly(1).times

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

Version data entries

17 entries across 17 versions & 1 rubygems

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