end
def state_label
- get_combined(:state)
+ if @proxied.is_a? ContainerRequest and
+ get(:state) == "Committed" and
+ get(:state, @container) == "Complete" and
+ get(:exit_code, @container) != 0
+ "Failed"
+ else
+ get_combined(:state)
+ end
end
def docker_image
end
end
+ test "state_label should be Failed if container exit_code not 0" do
+ use_token 'active'
+ obj = find_fixture(ContainerRequest, 'cr_for_failed')
+ wu = obj.work_unit
+ assert_equal "Failed", wu.state_label
+ end
+
[
[Job, 'running_job_with_components', 1, 1, nil],
[Job, 'queued', nil, nil, 1],
vcpus: 1
ram: 123
+cr_for_failed:
+ uuid: zzzzz-xvhdp-cr4failedcontnr
+ owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ name: cr for container exit code not 0
+ state: Committed
+ priority: 1
+ created_at: 2016-01-11 11:11:11.111111111 Z
+ updated_at: 2016-01-11 11:11:11.111111111 Z
+ modified_at: 2016-01-11 11:11:11.111111111 Z
+ modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ container_image: test
+ cwd: test
+ output_path: test
+ command: ["echo", "hello"]
+ container_uuid: zzzzz-dz642-failedcntnr
+ runtime_constraints:
+ vcpus: 1
+ ram: 123
+
# Test Helper trims the rest of the file
# Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper
ram: 12000000000
vcpus: 4
auth_uuid: zzzzz-gj3su-077z32aux8dg2s1
+
+failed_container:
+ uuid: zzzzz-dz642-failedcntnr
+ owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+ state: Complete
+ exit_code: 33
+ priority: 1
+ created_at: 2016-01-11 11:11:11.111111111 Z
+ updated_at: 2016-01-11 11:11:11.111111111 Z
+ container_image: test
+ cwd: test
+ output: test
+ output_path: test
+ command: ["echo", "hello"]
+ runtime_constraints:
+ ram: 12000000000
+ vcpus: 4