From a226e28b482c8ca97ee03cd8823e32875b22cc5f Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Tue, 30 Apr 2024 11:05:25 +0900 Subject: [PATCH] Fix a failed test of ConsoleAdapter (#4477) Follow the change of the log format as of console v1.24. Signed-off-by: Takuro Ashie --- test/log/test_console_adapter.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/log/test_console_adapter.rb b/test/log/test_console_adapter.rb index 06d9d900ad..aa1f393f82 100644 --- a/test/log/test_console_adapter.rb +++ b/test/log/test_console_adapter.rb @@ -72,11 +72,18 @@ def test_args(level) fatal: :fatal) def test_options(level) @console_logger.send(level, "subject", kwarg1: "opt1", kwarg2: "opt2") + lines = @logdev.logs[0].split("\n") + args = JSON.load(lines[1..].collect { |str| str.sub(/\s+\|/, "") }.join("\n")); assert_equal([ - "#{@timestamp_str} [#{level}]: 0.0s: subject\n" + - " | {\"kwarg1\":\"opt1\",\"kwarg2\":\"opt2\"}\n" + 1, + "#{@timestamp_str} [#{level}]: 0.0s: subject", + { "kwarg1" => "opt1", "kwarg2" => "opt2" } ], - @logdev.logs) + [ + @logdev.logs.size, + lines[0], + args + ]) end data(debug: :debug,