From b344bb4f65c6d5bae3406b6d64be8ae0f9dea9dd Mon Sep 17 00:00:00 2001 From: hramadan Date: Thu, 10 Aug 2023 17:11:08 -0700 Subject: [PATCH 1/2] Ruby 3.1.4 test fix --- test/multiverse/suites/roda/roda_instrumentation_test.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/multiverse/suites/roda/roda_instrumentation_test.rb b/test/multiverse/suites/roda/roda_instrumentation_test.rb index 8bc078d467..10d42d4402 100644 --- a/test/multiverse/suites/roda/roda_instrumentation_test.rb +++ b/test/multiverse/suites/roda/roda_instrumentation_test.rb @@ -111,9 +111,9 @@ def test_transaction_name_error # pass in {} to produce an error, because {} doesn't support #path and # confirm that the desired error handling took place result = NewRelic::Agent::Instrumentation::Roda::TransactionNamer.transaction_name({}) - + # binding.irb assert_equal NewRelic::Agent::UNKNOWN_METRIC, result - assert_logged(/NoMethodError.*Error encountered trying to identify Roda transaction name/) + assert_logged(/NoMethodError.*Error encountered trying to identify Roda transaction name/m) end end @@ -128,7 +128,10 @@ def test_rack_request_params_error end def assert_logged(expected) - found = NewRelic::Agent.logger.messages.flatten.any? { |m| m.match?(expected) } + # Example logger array: + # [[:debug, ["NoMethodError : undefined method `path' for \ + # {}:Hash - Error encountered trying to identify Roda transaction name"], nil]] + found = NewRelic::Agent.logger.messages.any? { |m| m[1][0].match?(expected) } assert(found, "Didn't see log message: '#{expected}'") end From 1bfaa37d85ab1a3ce2e54d1d658d2f973c5b973b Mon Sep 17 00:00:00 2001 From: hramadan Date: Thu, 10 Aug 2023 17:11:56 -0700 Subject: [PATCH 2/2] Remove binding.irb --- test/multiverse/suites/roda/roda_instrumentation_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/multiverse/suites/roda/roda_instrumentation_test.rb b/test/multiverse/suites/roda/roda_instrumentation_test.rb index 10d42d4402..16b88a603d 100644 --- a/test/multiverse/suites/roda/roda_instrumentation_test.rb +++ b/test/multiverse/suites/roda/roda_instrumentation_test.rb @@ -111,7 +111,7 @@ def test_transaction_name_error # pass in {} to produce an error, because {} doesn't support #path and # confirm that the desired error handling took place result = NewRelic::Agent::Instrumentation::Roda::TransactionNamer.transaction_name({}) - # binding.irb + assert_equal NewRelic::Agent::UNKNOWN_METRIC, result assert_logged(/NoMethodError.*Error encountered trying to identify Roda transaction name/m) end