14715: keepproxy.service checks for cluster config
[arvados.git] / services / api / test / integration / crunch_dispatch_test.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 require 'test_helper'
6 require 'helpers/git_test_helper'
7
8 class CrunchDispatchIntegrationTest < ActionDispatch::IntegrationTest
9   include GitTestHelper
10
11   fixtures :all
12
13   @@crunch_dispatch_pid = nil
14
15   def launch_crunch_dispatch
16     @@crunch_dispatch_pid = Process.fork {
17       ENV['PATH'] = ENV['HOME'] + '/arvados/services/crunch:' + ENV['PATH']
18       exec(ENV['HOME'] + '/arvados/services/api/script/crunch-dispatch.rb')
19     }
20   end
21
22   teardown do
23     if @@crunch_dispatch_pid
24       Process.kill "TERM", @@crunch_dispatch_pid
25       Process.wait
26       @@crunch_dispatch_pid = nil
27     end
28   end
29
30   test "job runs" do
31     post "/arvados/v1/jobs",
32       params: {
33         format: "json",
34         job: {
35           script: "log",
36           repository: "active/crunchdispatchtest",
37           script_version: "f35f99b7d32bac257f5989df02b9f12ee1a9b0d6",
38           script_parameters: {
39             input: 'fa7aeb5140e2848d39b416daeef4ffc5+45',
40             an_integer: '1'
41           }
42         }
43       },
44       headers: auth(:admin)
45     assert_response :success
46   end
47 end