Sha256: 44d85a391d08996e4f8a95c53a7b18cbea6ce640c5c3ed981520f2138656065d

Contents?: true

Size: 744 Bytes

Versions: 10

Compression:

Stored size: 744 Bytes

Contents

require 'rails_helper'

module Kuroko2::Command
  describe Kill do

    describe '#execute' do
      subject { Kill.new(hostname, '1').execute }

      before do
        execution.pid = Process.spawn('sleep 10')
        Process.detach(execution.pid)
        worker.update!(execution_id: execution.id)
      end

      let!(:signal) { create(:process_signal, pid: execution.pid, hostname: 'test', execution_id: execution.id) }
      let(:execution) { create(:execution) }
      let(:hostname) { 'test' }
      let(:worker) { create(:worker, hostname: hostname) }

      it 'terminates spawned process' do
        is_expected.to eq signal
        expect { Process.kill(0, execution.pid) }.to raise_error(Errno::ESRCH)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
kuroko2-0.8.0 spec/command/kill_spec.rb
kuroko2-0.7.0 spec/command/kill_spec.rb
kuroko2-0.6.0 spec/command/kill_spec.rb
kuroko2-0.5.2 spec/command/kill_spec.rb
kuroko2-0.5.1 spec/command/kill_spec.rb
kuroko2-0.5.0 spec/command/kill_spec.rb
kuroko2-0.4.6 spec/command/kill_spec.rb
kuroko2-0.4.5 spec/command/kill_spec.rb
kuroko2-0.4.4 spec/command/kill_spec.rb
kuroko2-0.4.3 spec/command/kill_spec.rb