[ARVADOS] updated: 8da182df7745caa74c1406af3c458d8cf5532c70
Git user
git at public.curoverse.com
Tue Aug 30 08:30:36 EDT 2016
Summary of changes:
apps/workbench/app/models/container_work_unit.rb | 6 +++++-
apps/workbench/test/unit/work_unit_test.rb | 11 ++++++-----
2 files changed, 11 insertions(+), 6 deletions(-)
via 8da182df7745caa74c1406af3c458d8cf5532c70 (commit)
from 24eee13008ef6bd36bf29ac9cecd045663ea1ba6 (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 8da182df7745caa74c1406af3c458d8cf5532c70
Author: Lucas Di Pentima <lucas at curoverse.com>
Date: Tue Aug 30 09:27:17 2016 -0300
9687: Added method to access container's exit_code. Updated test to explicitly test for exit_code in addition to state_label.
diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index 2102a12..248c763 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -76,10 +76,14 @@ class ContainerWorkUnit < ProxyWorkUnit
def state_label
exit_code = get_combined(:exit_code)
- "Failed" if (exit_code && exit_code != 0)
+ return "Failed" if (exit_code && exit_code != 0)
get_combined(:state)
end
+ def exit_code
+ get_combined(:exit_code)
+ end
+
def docker_image
get_combined(:container_image)
end
diff --git a/apps/workbench/test/unit/work_unit_test.rb b/apps/workbench/test/unit/work_unit_test.rb
index 5d4c77c..304dc8b 100644
--- a/apps/workbench/test/unit/work_unit_test.rb
+++ b/apps/workbench/test/unit/work_unit_test.rb
@@ -36,14 +36,15 @@ class WorkUnitTest < ActiveSupport::TestCase
end
[
- ['cr_for_failed', true],
- ['completed', false],
- ].each do |cr_fixture, should_be_Failed|
- test "state_label of ContainerRequest #{cr_fixture}" do
+ ['cr_for_failed', 'Failed', 33],
+ ['completed', 'Complete', 0],
+ ].each do |cr_fixture, state, exit_code|
+ test "Completed ContainerRequest state = #{state} with exit_code = #{exit_code}" do
use_token 'active'
obj = find_fixture(ContainerRequest, cr_fixture)
wu = obj.work_unit
- assert_equal should_be_Failed, ("Failed" == wu.state_label)
+ assert_equal state, wu.state_label
+ assert_equal exit_code, wu.exit_code
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list