X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/611f3d6956c547f16a87b5c728b64091ec32ebb6..f72506f1056aa4e867c6a0ff68a815bd55244536:/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 8080790526..b7f0a96376 100644 --- a/services/api/test/unit/crunch_dispatch_test.rb +++ b/services/api/test/unit/crunch_dispatch_test.rb @@ -1,7 +1,10 @@ require 'test_helper' require 'crunch_dispatch' +require 'helpers/git_test_helper' class CrunchDispatchTest < ActiveSupport::TestCase + include GitTestHelper + test 'choose cheaper nodes first' do act_as_system_user do # Replace test fixtures with a set suitable for testing dispatch @@ -100,6 +103,30 @@ class CrunchDispatchTest < ActiveSupport::TestCase end end + test 'override --cgroup-root with CRUNCH_CGROUP_ROOT' do + ENV['CRUNCH_CGROUP_ROOT'] = '/path/to/cgroup' + Rails.configuration.crunch_job_wrapper = :none + act_as_system_user do + j = Job.create(repository: 'active/foo', + script: 'hash', + script_version: '4fe459abe02d9b365932b8f5dc419439ab4e2577', + script_parameters: {}) + ok = false + Open3.expects(:popen3).at_least_once.with do |*args| + if args.index(j.uuid) + ok = ((i = args.index '--cgroup-root') and + (args[i+1] == '/path/to/cgroup')) + end + true + end.raises(StandardError.new('all is well')) + dispatch = CrunchDispatch.new + dispatch.parse_argv ['--jobs'] + dispatch.refresh_todo + dispatch.start_jobs + assert ok + end + end + def assert_with_timeout timeout, message t = 0 while (t += 0.1) < timeout