1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 class ContainerDispatchTest < ActionDispatch::IntegrationTest
8 test "lock container with SystemRootToken" do
9 Rails.configuration.SystemRootToken = "xyzzy-SystemRootToken"
10 authheaders = {'HTTP_AUTHORIZATION' => "Bearer "+Rails.configuration.SystemRootToken}
11 get("/arvados/v1/api_client_authorizations/current",
14 #assert_not_empty json_response['uuid']
16 system_auth_uuid = json_response['uuid']
17 post("/arvados/v1/containers/#{containers(:queued).uuid}/lock",
20 assert_equal system_auth_uuid, Container.find_by_uuid(containers(:queued).uuid).locked_by_uuid
22 get("/arvados/v1/containers",
23 params: {filters: SafeJSON.dump([['locked_by_uuid', '=', system_auth_uuid]])},
26 assert_equal containers(:queued).uuid, json_response['items'][0]['uuid']
27 assert_equal system_auth_uuid, json_response['items'][0]['locked_by_uuid']
29 post("/arvados/v1/containers/#{containers(:queued).uuid}/unlock",