[ARVADOS] updated: e34a96439f47fb34007587633f0210c93e116e76
git at public.curoverse.com
git at public.curoverse.com
Fri Oct 3 21:55:09 EDT 2014
Summary of changes:
.../functional/arvados/v1/jobs_controller_test.rb | 60 ++++++++++++++++++++++
services/api/test/test_helper.rb | 2 +-
2 files changed, 61 insertions(+), 1 deletion(-)
via e34a96439f47fb34007587633f0210c93e116e76 (commit)
from 8ba991c830983cd1c681f7d7c98907b8ada1e81c (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 e34a96439f47fb34007587633f0210c93e116e76
Author: radhika <radhika at curoverse.com>
Date: Fri Oct 3 21:51:39 2014 -0400
3882: added a few more tests for cancelled_at state. Most importantly, uncomment the assertion
to raise error when a functional test performs multiple actions in a single test (refs 3889#).
diff --git a/services/api/test/functional/arvados/v1/jobs_controller_test.rb b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
index 9beacfd..72a824e 100644
--- a/services/api/test/functional/arvados/v1/jobs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
@@ -141,6 +141,66 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
assert_equal job['state'], 'Cancelled', 'cancelled again job state not cancelled'
end
+ test "cancelled job stays cancelled when state set to Running" do
+ # We need to verify that "cancel" creates a trigger file, so first
+ # let's make sure there is no stale trigger file.
+ begin
+ File.unlink(Rails.configuration.crunch_refresh_trigger)
+ rescue Errno::ENOENT
+ end
+
+ authorize_with :active
+ put :update, {
+ id: jobs(:cancelled).uuid,
+ job: {
+ state: 'Running'
+ }
+ }
+ job = JSON.parse(@response.body)
+ assert_not_nil job['cancelled_at'], 'cancelled job did not stay cancelled when state set to running'
+ assert_equal job['state'], 'Cancelled', 'was able to change state to running for a cancelled job'
+ end
+
+ test "cancelled job stays cancelled when state set to Complete" do
+ # We need to verify that "cancel" creates a trigger file, so first
+ # let's make sure there is no stale trigger file.
+ begin
+ File.unlink(Rails.configuration.crunch_refresh_trigger)
+ rescue Errno::ENOENT
+ end
+
+ authorize_with :active
+ put :update, {
+ id: jobs(:cancelled).uuid,
+ job: {
+ state: 'Complete'
+ }
+ }
+ job = JSON.parse(@response.body)
+ assert_not_nil job['cancelled_at'], 'cancelled job did not stay cancelled when state set to complete'
+ assert_equal job['state'], 'Cancelled', 'was able to change state to complete for a cancelled job'
+ end
+
+ test "cancelled job stays cancelled when state set to Failed" do
+ # We need to verify that "cancel" creates a trigger file, so first
+ # let's make sure there is no stale trigger file.
+ begin
+ File.unlink(Rails.configuration.crunch_refresh_trigger)
+ rescue Errno::ENOENT
+ end
+
+ authorize_with :active
+ put :update, {
+ id: jobs(:cancelled).uuid,
+ job: {
+ state: 'Failed'
+ }
+ }
+ job = JSON.parse(@response.body)
+ assert_not_nil job['cancelled_at'], 'cancelled job did not stay cancelled when state set to failed'
+ assert_equal job['state'], 'Cancelled', 'was able to change state to failed for a cancelled job'
+ end
+
test "cancelled to any other state change results in error" do
# We need to verify that "cancel" creates a trigger file, so first
# let's make sure there is no stale trigger file.
diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb
index 3413f64..d59b449 100644
--- a/services/api/test/test_helper.rb
+++ b/services/api/test/test_helper.rb
@@ -88,7 +88,7 @@ class ActionController::TestCase
def check_counter action
@counter += 1
if @counter == 2
- # assert_equal 1, 2, "Multiple actions in functional test"
+ assert_equal 1, 2, "Multiple actions in functional test"
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list