3 class Arvados::V1::JobsControllerTest < ActionController::TestCase
9 script_version: "master",
12 assert_response :success
13 assert_not_nil assigns(:object)
14 new_job = JSON.parse(@response.body)
15 assert_not_nil new_job['uuid']
18 test "cancel a running job" do
19 # We need to verify that "cancel" creates a trigger file, so first
20 # let's make sure there is no stale trigger file.
22 File.unlink(Rails.configuration.crunch_refresh_trigger)
26 authorize_with :active
28 id: jobs(:running).uuid,
30 cancelled_at: 4.day.ago
33 assert_response :success
34 assert_not_nil assigns(:object)
35 job = JSON.parse(@response.body)
36 assert_not_nil job['uuid']
37 assert_not_nil job['cancelled_at']
38 assert_not_nil job['cancelled_by_user_uuid']
39 assert_not_nil job['cancelled_by_client_uuid']
40 assert_equal(true, Time.parse(job['cancelled_at']) > 1.minute.ago,
41 'server should correct bogus cancelled_at ' +
44 File.exists?(Rails.configuration.crunch_refresh_trigger),
45 'trigger file should be created when job is cancelled')
48 id: jobs(:running).uuid,
53 job = JSON.parse(@response.body)
54 assert_not_nil job['cancelled_at'], 'un-cancelled job stays cancelled'