[ARVADOS] updated: 24eee13008ef6bd36bf29ac9cecd045663ea1ba6
Git user
git at public.curoverse.com
Mon Aug 29 16:54:02 EDT 2016
Summary of changes:
apps/workbench/app/models/container_work_unit.rb | 11 +++--------
apps/workbench/test/unit/work_unit_test.rb | 15 ++++++++++-----
services/api/test/fixtures/containers.yml | 4 ++++
3 files changed, 17 insertions(+), 13 deletions(-)
via 24eee13008ef6bd36bf29ac9cecd045663ea1ba6 (commit)
from 74b5dd2b6f4a33b06b136fd587408ec3d4e42ec0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 24eee13008ef6bd36bf29ac9cecd045663ea1ba6
Author: Lucas Di Pentima <lucas at curoverse.com>
Date: Mon Aug 29 17:50:58 2016 -0300
9687: Updated state_label method changes to something more simple and compact. Added exit_code:0 to complete container fixtures. Added explicit test case to check for a not Failed container.
diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index 43871c5..2102a12 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -75,14 +75,9 @@ class ContainerWorkUnit < ProxyWorkUnit
end
def state_label
- 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
+ exit_code = get_combined(:exit_code)
+ "Failed" if (exit_code && exit_code != 0)
+ get_combined(:state)
end
def docker_image
diff --git a/apps/workbench/test/unit/work_unit_test.rb b/apps/workbench/test/unit/work_unit_test.rb
index 236e7a2..5d4c77c 100644
--- a/apps/workbench/test/unit/work_unit_test.rb
+++ b/apps/workbench/test/unit/work_unit_test.rb
@@ -35,11 +35,16 @@ class WorkUnitTest < ActiveSupport::TestCase
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
+ [
+ ['cr_for_failed', true],
+ ['completed', false],
+ ].each do |cr_fixture, should_be_Failed|
+ test "state_label of ContainerRequest #{cr_fixture}" do
+ use_token 'active'
+ obj = find_fixture(ContainerRequest, cr_fixture)
+ wu = obj.work_unit
+ assert_equal should_be_Failed, ("Failed" == wu.state_label)
+ end
end
[
diff --git a/services/api/test/fixtures/containers.yml b/services/api/test/fixtures/containers.yml
index f9d18be..049cd3c 100644
--- a/services/api/test/fixtures/containers.yml
+++ b/services/api/test/fixtures/containers.yml
@@ -69,6 +69,7 @@ completed:
uuid: zzzzz-dz642-compltcontainer
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
state: Complete
+ exit_code: 0
priority: 1
created_at: 2016-01-11 11:11:11.111111111 Z
updated_at: 2016-01-11 11:11:11.111111111 Z
@@ -88,6 +89,7 @@ completed_older:
uuid: zzzzz-dz642-compltcontainr2
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
state: Complete
+ exit_code: 0
priority: 1
created_at: 2016-01-11 11:11:11.111111111 Z
updated_at: 2016-01-11 11:11:11.111111111 Z
@@ -106,6 +108,7 @@ requester:
uuid: zzzzz-dz642-requestingcntnr
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
state: Complete
+ exit_code: 0
priority: 1
created_at: 2016-01-11 11:11:11.111111111 Z
updated_at: 2016-01-11 11:11:11.111111111 Z
@@ -122,6 +125,7 @@ requester_container:
uuid: zzzzz-dz642-requestercntnr1
owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
state: Complete
+ exit_code: 0
priority: 1
created_at: 2016-01-11 11:11:11.111111111 Z
updated_at: 2016-01-11 11:11:11.111111111 Z
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list