[ARVADOS] created: 1.3.0-3127-gc8a640d52

Git user git at public.arvados.org
Fri Sep 11 22:01:21 UTC 2020


        at  c8a640d527db530875b52c9975a34709a2f32f7c (commit)


commit c8a640d527db530875b52c9975a34709a2f32f7c
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Fri Sep 11 18:59:54 2020 -0300

    16826: Fixes config setting on tests about config maps knobs.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/test/functional/arvados/v1/groups_controller_test.rb b/services/api/test/functional/arvados/v1/groups_controller_test.rb
index ff89cd212..f038b1e55 100644
--- a/services/api/test/functional/arvados/v1/groups_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/groups_controller_test.rb
@@ -430,7 +430,10 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
   end
 
   test 'get contents with jobs and pipeline instances disabled' do
-    Rails.configuration.API.DisabledAPIs = {'jobs.index'=>{}, 'pipeline_instances.index'=>{}}
+    conf = ActiveSupport::OrderedOptions.new
+    conf['jobs.index'] = {}
+    conf['pipeline_instances.index'] = {}
+    Rails.configuration.API.DisabledAPIs = conf
 
     authorize_with :active
     get :contents, params: {
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index b91910d2d..58216c2b6 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -576,7 +576,9 @@ class ContainerRequestTest < ActiveSupport::TestCase
   test "Container.resolve_container_image(pdh)" do
     set_user_from_auth :active
     [[:docker_image, 'v1'], [:docker_image_1_12, 'v2']].each do |coll, ver|
-      Rails.configuration.Containers.SupportedDockerImageFormats = {ver=>{}}
+      conf = ActiveSupport::OrderedOptions.new
+      conf[ver] = {}
+      Rails.configuration.Containers.SupportedDockerImageFormats = conf
       pdh = collections(coll).portable_data_hash
       resolved = Container.resolve_container_image(pdh)
       assert_equal resolved, pdh
@@ -602,7 +604,9 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "migrated docker image" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = {'v2'=>{}}
+    conf = ActiveSupport::OrderedOptions.new
+    conf['v2'] = {}
+    Rails.configuration.Containers.SupportedDockerImageFormats = conf
     add_docker19_migration_link
 
     # Test that it returns only v2 images even though request is for v1 image.
@@ -620,7 +624,9 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "use unmigrated docker image" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = {'v1'=>{}}
+    conf = ActiveSupport::OrderedOptions.new
+    conf['v1'] = {}
+    Rails.configuration.Containers.SupportedDockerImageFormats = conf
     add_docker19_migration_link
 
     # Test that it returns only supported v1 images even though there is a
@@ -639,7 +645,9 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "incompatible docker image v1" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = {'v1'=>{}}
+    conf = ActiveSupport::OrderedOptions.new
+    conf['v1'] = {}
+    Rails.configuration.Containers.SupportedDockerImageFormats = conf
     add_docker19_migration_link
 
     # Don't return unsupported v2 image even if we ask for it directly.
@@ -652,7 +660,9 @@ class ContainerRequestTest < ActiveSupport::TestCase
   end
 
   test "incompatible docker image v2" do
-    Rails.configuration.Containers.SupportedDockerImageFormats = {'v2'=>{}}
+    conf = ActiveSupport::OrderedOptions.new
+    conf['v2'] = {}
+    Rails.configuration.Containers.SupportedDockerImageFormats = conf
     # No migration link, don't return unsupported v1 image,
 
     set_user_from_auth :active
diff --git a/services/api/test/unit/user_test.rb b/services/api/test/unit/user_test.rb
index 7fcd36d70..9e4a99c59 100644
--- a/services/api/test/unit/user_test.rb
+++ b/services/api/test/unit/user_test.rb
@@ -110,7 +110,9 @@ class UserTest < ActiveSupport::TestCase
   end
 
   test "new username set avoiding blacklist" do
-    Rails.configuration.Users.AutoSetupUsernameBlacklist = {"root"=>{}}
+    conf = ActiveSupport::OrderedOptions.new
+    conf["root"] = {}
+    Rails.configuration.Users.AutoSetupUsernameBlacklist = conf
     check_new_username_setting("root", "root2")
   end
 

commit 72298b61214bb31f0522ff966acd4d42ec3d131e
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Fri Sep 11 18:44:20 2020 -0300

    16826: Fixes the bug.
    
    The issue is that the config loading code on Rails uses
    ActiveSupport::OrderedOptions on config hashes, and this class always
    returns keys as symbols. We were incorrectly testing the feature by
    assigning a normal Hash to the config.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 6fb8ff2b3..709b4b4d1 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -454,7 +454,7 @@ class ArvadosModel < ApplicationRecord
   end
 
   def logged_attributes
-    attributes.except(*Rails.configuration.AuditLogs.UnloggedAttributes.keys)
+    attributes.except(*Rails.configuration.AuditLogs.UnloggedAttributes.stringify_keys.keys)
   end
 
   def self.full_text_searchable_columns

commit 8a73021bbc704581db9a71d7d6a3332d89329bd5
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Fri Sep 11 18:42:04 2020 -0300

    16826: Adds test exposing the bug.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/test/unit/application_test.rb b/services/api/test/unit/application_test.rb
index 679dddf22..e1565ec62 100644
--- a/services/api/test/unit/application_test.rb
+++ b/services/api/test/unit/application_test.rb
@@ -7,7 +7,7 @@ require 'test_helper'
 class ApplicationTest < ActiveSupport::TestCase
   include CurrentApiClient
 
-  test "test act_as_system_user" do
+  test "act_as_system_user" do
     Thread.current[:user] = users(:active)
     assert_equal users(:active), Thread.current[:user]
     act_as_system_user do
@@ -17,7 +17,7 @@ class ApplicationTest < ActiveSupport::TestCase
     assert_equal users(:active), Thread.current[:user]
   end
 
-  test "test act_as_system_user is exception safe" do
+  test "act_as_system_user is exception safe" do
     Thread.current[:user] = users(:active)
     assert_equal users(:active), Thread.current[:user]
     caught = false
@@ -33,4 +33,12 @@ class ApplicationTest < ActiveSupport::TestCase
     assert caught
     assert_equal users(:active), Thread.current[:user]
   end
+
+  test "config maps' keys are returned as symbols" do
+    assert Rails.configuration.Users.AutoSetupUsernameBlacklist.is_a? ActiveSupport::OrderedOptions
+    assert Rails.configuration.Users.AutoSetupUsernameBlacklist.keys.size > 0
+    Rails.configuration.Users.AutoSetupUsernameBlacklist.keys.each do |k|
+      assert k.is_a? Symbol
+    end
+  end
 end
diff --git a/services/api/test/unit/log_test.rb b/services/api/test/unit/log_test.rb
index 016a0e4eb..59fe3624d 100644
--- a/services/api/test/unit/log_test.rb
+++ b/services/api/test/unit/log_test.rb
@@ -282,7 +282,9 @@ class LogTest < ActiveSupport::TestCase
   end
 
   test "non-empty configuration.unlogged_attributes" do
-    Rails.configuration.AuditLogs.UnloggedAttributes = {"manifest_text"=>{}}
+    conf = ActiveSupport::OrderedOptions.new
+    conf["manifest_text"] = {}
+    Rails.configuration.AuditLogs.UnloggedAttributes = conf
     txt = ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n"
 
     act_as_system_user do
@@ -297,7 +299,7 @@ class LogTest < ActiveSupport::TestCase
   end
 
   test "empty configuration.unlogged_attributes" do
-    Rails.configuration.AuditLogs.UnloggedAttributes = {}
+    Rails.configuration.AuditLogs.UnloggedAttributes = ActiveSupport::OrderedOptions.new
     txt = ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n"
 
     act_as_system_user do

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list