X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0066dc77abc461090fe98bcee7c6e324a5ca43a1..0e1f8c8b47ddecbb3b6db360c8fda2fa612590ee:/services/api/test/functional/arvados/v1/containers_controller_test.rb diff --git a/services/api/test/functional/arvados/v1/containers_controller_test.rb b/services/api/test/functional/arvados/v1/containers_controller_test.rb index 65a1a915da..5510e903a2 100644 --- a/services/api/test/functional/arvados/v1/containers_controller_test.rb +++ b/services/api/test/functional/arvados/v1/containers_controller_test.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'test_helper' class Arvados::V1::ContainersControllerTest < ActionController::TestCase @@ -55,6 +59,14 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase uuid = containers(:queued).uuid post :lock, {id: uuid} assert_response :success + assert_nil json_response['mounts'] + assert_nil json_response['command'] + assert_not_nil json_response['auth_uuid'] + assert_not_nil json_response['locked_by_uuid'] + assert_equal containers(:queued).uuid, json_response['uuid'] + assert_equal 'Locked', json_response['state'] + assert_equal containers(:queued).priority, json_response['priority'] + container = Container.where(uuid: uuid).first assert_equal 'Locked', container.state assert_not_nil container.locked_by_uuid @@ -66,12 +78,27 @@ class Arvados::V1::ContainersControllerTest < ActionController::TestCase uuid = containers(:locked).uuid post :unlock, {id: uuid} assert_response :success + assert_nil json_response['mounts'] + assert_nil json_response['command'] + assert_nil json_response['auth_uuid'] + assert_nil json_response['locked_by_uuid'] + assert_equal containers(:locked).uuid, json_response['uuid'] + assert_equal 'Queued', json_response['state'] + assert_equal containers(:locked).priority, json_response['priority'] + container = Container.where(uuid: uuid).first assert_equal 'Queued', container.state assert_nil container.locked_by_uuid assert_nil container.auth_uuid end + test "unlock container locked by different dispatcher" do + authorize_with :dispatch2 + uuid = containers(:locked).uuid + post :unlock, {id: uuid} + assert_response 422 + end + [ [:queued, :lock, :success, 'Locked'], [:queued, :unlock, 422, 'Queued'],