From f4d0ea9ca3ef4badd38957f794d12474831cee44 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Mon, 14 Sep 2020 17:36:43 -0300 Subject: [PATCH] 16826: Moves configuration set-up to TestCase's setup() method. Having a failing assertion on the teardown() method before the config restoration code has the side effect of failing all the tests following the one that made an illegal config change. This updates fixes that. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- services/api/test/test_helper.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb index 12e642d0eb..5dc77cb98a 100644 --- a/services/api/test/test_helper.rb +++ b/services/api/test/test_helper.rb @@ -62,7 +62,7 @@ class ActiveSupport::TestCase include ArvadosTestSupport include CurrentApiClient - teardown do + setup do Thread.current[:api_client_ip_address] = nil Thread.current[:api_client_authorization] = nil Thread.current[:api_client_uuid] = nil @@ -72,6 +72,14 @@ class ActiveSupport::TestCase restore_configuration end + teardown do + # Confirm that any changed configuration doesn't include non-symbol keys + $arvados_config.keys.each do |conf_name| + conf = Rails.configuration.send(conf_name) + confirm_keys_as_symbols(conf, conf_name) if conf.respond_to?('keys') + end + end + def assert_equal(expect, *args) if expect.nil? assert_nil(*args) @@ -108,11 +116,6 @@ class ActiveSupport::TestCase end def restore_configuration - # Confirm that any changed configuration doesn't include non-symbol keys - $arvados_config.keys.each do |conf_name| - conf = Rails.configuration.send("#{conf_name}") - confirm_keys_as_symbols(conf, conf_name) if conf.respond_to?('keys') - end # Restore configuration settings changed during tests ConfigLoader.copy_into_config $arvados_config, Rails.configuration ConfigLoader.copy_into_config $remaining_config, Rails.configuration -- 2.30.2