From 32ea7036d2cb438f5c313cff73cfe17610a3b8b9 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Wed, 5 Dec 2018 14:18:54 -0500 Subject: [PATCH] 14584: Remove runtime_user_uuid and runtime_auth_scopes checks for reuse. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- services/api/app/models/container.rb | 8 -------- services/api/test/unit/container_test.rb | 9 ++++++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb index ac67040edf..bd586907ee 100644 --- a/services/api/app/models/container.rb +++ b/services/api/app/models/container.rb @@ -279,14 +279,6 @@ class Container < ArvadosModel candidates = candidates.where_serialized(:runtime_constraints, resolve_runtime_constraints(attrs[:runtime_constraints]), md5: true) log_reuse_info(candidates) { "after filtering on runtime_constraints #{attrs[:runtime_constraints].inspect}" } - candidates = candidates.where('runtime_user_uuid = ? or (runtime_user_uuid is NULL and runtime_auth_scopes is NULL)', - attrs[:runtime_user_uuid]) - log_reuse_info(candidates) { "after filtering on runtime_user_uuid #{attrs[:runtime_user_uuid].inspect}" } - - candidates = candidates.where('runtime_auth_scopes = ? or (runtime_user_uuid is NULL and runtime_auth_scopes is NULL)', - SafeJSON.dump(attrs[:runtime_auth_scopes].sort)) - log_reuse_info(candidates) { "after filtering on runtime_auth_scopes #{attrs[:runtime_auth_scopes].inspect}" } - log_reuse_info { "checking for state=Complete with readable output and log..." } select_readable_pdh = Collection. diff --git a/services/api/test/unit/container_test.rb b/services/api/test/unit/container_test.rb index 90b4f13bf5..2a9ff5bf4c 100644 --- a/services/api/test/unit/container_test.rb +++ b/services/api/test/unit/container_test.rb @@ -558,7 +558,8 @@ class ContainerTest < ActiveSupport::TestCase c1, _ = minimal_new(common_attrs.merge({runtime_token: api_client_authorizations(:active).token})) assert_equal Container::Queued, c1.state reused = Container.find_reusable(common_attrs.merge(runtime_token_attr(:container_runtime_token))) - assert_nil reused + # See #14584 + assert_equal c1.uuid, reused.uuid end test "find_reusable method with nil runtime_token, then runtime_token with different user" do @@ -567,7 +568,8 @@ class ContainerTest < ActiveSupport::TestCase c1, _ = minimal_new(common_attrs.merge({runtime_token: nil})) assert_equal Container::Queued, c1.state reused = Container.find_reusable(common_attrs.merge(runtime_token_attr(:container_runtime_token))) - assert_nil reused + # See #14584 + assert_equal c1.uuid, reused.uuid end test "find_reusable method with different runtime_token, different scope, same user" do @@ -576,7 +578,8 @@ class ContainerTest < ActiveSupport::TestCase c1, _ = minimal_new(common_attrs.merge({runtime_token: api_client_authorizations(:runtime_token_limited_scope).token})) assert_equal Container::Queued, c1.state reused = Container.find_reusable(common_attrs.merge(runtime_token_attr(:container_runtime_token))) - assert_nil reused + # See #14584 + assert_equal c1.uuid, reused.uuid end test "Container running" do -- 2.30.2