X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/25af6c40181b95f13ec3e9e366c53cb50868d065..94f2b439783a8e63d6d7b9ba2760f54fc642a8fb:/services/api/test/unit/fail_jobs_test.rb diff --git a/services/api/test/unit/fail_jobs_test.rb b/services/api/test/unit/fail_jobs_test.rb index 8c6539e8dc..3c7f9a9096 100644 --- a/services/api/test/unit/fail_jobs_test.rb +++ b/services/api/test/unit/fail_jobs_test.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' require 'crunch_dispatch' @@ -38,12 +42,12 @@ class FailJobsTest < ActiveSupport::TestCase test 'cancel slurm jobs' do Rails.configuration.crunch_job_wrapper = :slurm_immediate Rails.configuration.crunch_job_user = 'foobar' - fake_squeue = File.popen("echo #{@job[:before_reboot].uuid}") - fake_scancel = File.popen("true") - File.expects(:popen). + fake_squeue = IO.popen("echo #{@job[:before_reboot].uuid}") + fake_scancel = IO.popen("true") + IO.expects(:popen). with(['squeue', '-a', '-h', '-o', '%j']). returns(fake_squeue) - File.expects(:popen). + IO.expects(:popen). with(includes('sudo', '-u', 'foobar', 'scancel', '-n', @job[:before_reboot].uuid)). returns(fake_scancel) @dispatch.fail_jobs(before: Time.at(BOOT_TIME).to_s)