3889: split the test "cancel a running job" into two tests: one that cancels a runnin...
authorradhika <radhika@curoverse.com>
Thu, 25 Sep 2014 16:32:55 +0000 (12:32 -0400)
committerradhika <radhika@curoverse.com>
Thu, 25 Sep 2014 16:32:55 +0000 (12:32 -0400)
services/api/test/functional/arvados/v1/jobs_controller_test.rb

index a9a49a0d5fa700a7ec7d2eeaf589391c1f9fec80..03ee3df2e263b36895b28a48cc90787bac36ba39 100644 (file)
@@ -81,9 +81,19 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     assert_equal(true,
                  File.exists?(Rails.configuration.crunch_refresh_trigger),
                  'trigger file should be created when job is cancelled')
+  end
+
+  test "cancelling a cancelled jobs stays cancelled" 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(:running).uuid,
+      id: jobs(:running_cancelled).uuid,
       job: {
         cancelled_at: nil
       }