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",
15 system_auth_uuid = json_response['uuid']
16 post("/arvados/v1/containers/#{containers(:queued).uuid}/lock",
19 assert_equal system_auth_uuid, Container.find_by_uuid(containers(:queued).uuid).locked_by_uuid
21 get("/arvados/v1/containers",
22 params: {filters: SafeJSON.dump([['locked_by_uuid', '=', system_auth_uuid]])},
25 assert_equal containers(:queued).uuid, json_response['items'][0]['uuid']
26 assert_equal system_auth_uuid, json_response['items'][0]['locked_by_uuid']
28 post("/arvados/v1/containers/#{containers(:queued).uuid}/unlock",