Sha256: ffd5f7d5079ae781ad35741ca0701c4606019adbec8b1da50055aa5bd66bdda9
Contents?: true
Size: 1.45 KB
Versions: 8
Compression:
Stored size: 1.45 KB
Contents
require 'pione/test-helper' describe Pione::Agent::JobTerminator do before do @tuple_space = TestHelper::TupleSpace.create(self) end after do @tuple_space.terminate end it 'should fire the termination action with success status' do fired = false result = nil # create an agent job_terminator = Agent::JobTerminator.start(@tuple_space) do |status| fired = true result = status.success? end # write terminate command write(TupleSpace::CommandTuple.new(name: "terminate", args: [])) # wait termination job_terminator.wait_until_terminated # test fired.should.be.true result.should.be.true end it 'should fire the termination action with failure status' do fired = false result = nil # create an agent job_terminator = Agent::JobTerminator.start(@tuple_space) do |status| fired = true result = status.success? end # write terminate command write(TupleSpace::CommandTuple.new(name: "terminate", args: [System::Status.error(Exception.new)])) # wait termination job_terminator.wait_until_terminated # test fired.should.be.true result.should.be.false end it "should terminate" do # create an agent job_terminator = Agent::JobTerminator.start(@tuple_space) do |status| fired = true result = status.success? end # termination job_terminator.terminate job_terminator.should.terminated end end
Version data entries
8 entries across 8 versions & 1 rubygems