runtime_status: {'warning' => 'This is not an error'},
progress: 0.15})
c_faster_started_second.update_attributes!({state: Container::Locked})
+ assert_equal 0, Container.where("runtime_status->'error' is not null").count
c_faster_started_second.update_attributes!({state: Container::Running,
runtime_status: {'error' => 'Something bad happened'},
progress: 0.2})
+ assert_equal 1, Container.where("runtime_status->'error' is not null").count
reused = Container.find_reusable(common_attrs)
assert_not_nil reused
# Selected the non-failing container even if it's the one with less progress done
assert_no_secrets_logged
end
end
-
- # NOTE: Migration 20190322174136_add_file_info_to_collection.rb
- # relies on this test. Change with caution!
- test "pdh_grouping_by_manifest_size" do
- batch_size_max = 200
- pdhs_in = ['x1+30', 'x2+30', 'x3+201', 'x4+100', 'x5+100']
- pdh_lambda = lambda { |last_pdh, &block|
- pdhs = pdhs_in.select{|pdh| pdh > last_pdh}
- pdhs.each do |p|
- block.call(p)
- end
- }
- batched_pdhs = []
- Container.group_pdhs_for_multiple_transactions(pdh_lambda, pdhs_in.size, batch_size_max, "") do |pdhs|
- batched_pdhs << pdhs
- end
- expected = [['x1+30', 'x2+30'], ['x3+201'], ['x4+100', 'x5+100']]
- assert_equal(batched_pdhs, expected)
- end
end