X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3a31db02591a2f57d51b98ba9add7d835c5c6c26..df5f366f4bd87ee90cf39248542435b1b924b58a:/services/api/test/unit/crunch_dispatch_test.rb diff --git a/services/api/test/unit/crunch_dispatch_test.rb b/services/api/test/unit/crunch_dispatch_test.rb index 4646f7afd1..42ef0d160c 100644 --- a/services/api/test/unit/crunch_dispatch_test.rb +++ b/services/api/test/unit/crunch_dispatch_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' require 'helpers/git_test_helper' @@ -75,17 +79,6 @@ class CrunchDispatchTest < ActiveSupport::TestCase begin pid = Process.fork do begin - # Abandon database connections inherited from parent - # process. Credit to - # https://github.com/kstephens/rails_is_forked - ActiveRecord::Base.connection_handler.connection_pools.each_value do |pool| - pool.instance_eval do - @reserved_connections = {} - @connections = [] - end - end - ActiveRecord::Base.establish_connection - dispatch = CrunchDispatch.new dispatch.stubs(:did_recently).returns true dispatch.run [] @@ -208,14 +201,14 @@ class CrunchDispatchTest < ActiveSupport::TestCase act_as_system_user do dispatch = CrunchDispatch.new - squeue_resp = File.popen("echo zzzzz-8i9sb-pshmckwoma9plh7\necho thisisnotvalidjobuuid\necho zzzzz-8i9sb-4cf0abc123e809j\n") - scancel_resp = File.popen("true") + squeue_resp = IO.popen("echo zzzzz-8i9sb-pshmckwoma9plh7\necho thisisnotvalidjobuuid\necho zzzzz-8i9sb-4cf0abc123e809j\necho zzzzz-dz642-o04e3r651turtdr\n") + scancel_resp = IO.popen("true") - File.expects(:popen). + IO.expects(:popen). with(['squeue', '-a', '-h', '-o', '%j']). returns(squeue_resp) - File.expects(:popen). + IO.expects(:popen). with(dispatch.sudo_preface + ['scancel', '-n', 'zzzzz-8i9sb-4cf0abc123e809j']). returns(scancel_resp)