Sha256: c44d3d31ce48608ef927393cb85e2a80fa5f29c6d06b4aba6ef2807a5482d02c
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require 'test_helper' # A Worker Daemon needs to be running to perform this integration test. class FailingWorkUnitsTest < Minitest::Test should "retry work units when they fail" do WorkUnit.stubs(:distribute_to_nodes).returns([]) Dispatcher.any_instance.stubs(:distribute_periodically) Dispatcher.any_instance.expects(:distribute!) browser = Rack::Test::Session.new(Rack::MockSession.new(CloudCrowd::Server)) browser.post '/jobs', :job => { 'action' => 'failure_testing', 'inputs' => ['one', 'two', 'three'], 'options' => {} }.to_json assert browser.last_response.ok? job = Job.last (CloudCrowd.config[:work_unit_retries] - 1).times do job.work_units.each {|unit| unit.fail('failed', 10) } end assert job.reload.percent_complete == 0 job.work_units.reload.each_with_index do |unit, i| assert unit.processing? assert unit.attempts == CloudCrowd.config[:work_unit_retries] - 1 unit.fail('{"output":"failed"}', 10) assert unit.job.any_work_units_failed? if i == 0 end assert job.reload.failed? assert job.work_units.count == 0 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cloud-crowd-0.7.6 | test/acceptance/test_failing_work_units.rb |
cloud-crowd-0.7.5 | test/acceptance/test_failing_work_units.rb |