X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0dffc025de9ebc7a54596e1018a589a6f5b8a03e..5b863886118890cc81b728a3a606ea823c836f2b:/services/api/test/integration/crunch_dispatch_test.rb diff --git a/services/api/test/integration/crunch_dispatch_test.rb b/services/api/test/integration/crunch_dispatch_test.rb index e968cf1402..dc215f2a3c 100644 --- a/services/api/test/integration/crunch_dispatch_test.rb +++ b/services/api/test/integration/crunch_dispatch_test.rb @@ -1,27 +1,42 @@ -require 'pp' +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' -load 'test/functional/arvados/v1/git_setup.rb' +require 'helpers/git_test_helper' -class CrunchDispatchTest < ActionDispatch::IntegrationTest - include CurrentApiClient - include GitSetup +class CrunchDispatchIntegrationTest < ActionDispatch::IntegrationTest + include GitTestHelper fixtures :all + @@crunch_dispatch_pid = nil + + def launch_crunch_dispatch + @@crunch_dispatch_pid = Process.fork { + ENV['PATH'] = ENV['HOME'] + '/arvados/services/crunch:' + ENV['PATH'] + exec(ENV['HOME'] + '/arvados/services/api/script/crunch-dispatch.rb') + } + end + + teardown do + if @@crunch_dispatch_pid + Process.kill "TERM", @@crunch_dispatch_pid + Process.wait + @@crunch_dispatch_pid = nil + end + end + test "job runs" do - authorize_with :admin - set_user_from_auth :admin post "/arvados/v1/jobs", { format: "json", job: { script: "log", - repository: "bar", - script_version: "143fec09e988160673c63457fa12a0f70b5b8a26", - script_parameters: {} + repository: "active/crunchdispatchtest", + script_version: "f35f99b7d32bac257f5989df02b9f12ee1a9b0d6", + script_parameters: "{}" } - }, {HTTP_AUTHORIZATION: "OAuth2 #{current_api_client_authorization}"} - p "response: #{@response.body}" + }, auth(:admin) assert_response :success - resp = JSON.parse(@response.body) end end