From 60c94ad0edbdae1832750558cbcfc7833dce5e11 Mon Sep 17 00:00:00 2001 From: Daijiro Fukuda Date: Thu, 16 Feb 2023 18:00:48 +0900 Subject: [PATCH] Test: Refactor logic of recovering global logger Signed-off-by: Daijiro Fukuda --- test/test_logger_initializer.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_logger_initializer.rb b/test/test_logger_initializer.rb index 149b397ce4..a476841010 100644 --- a/test/test_logger_initializer.rb +++ b/test/test_logger_initializer.rb @@ -7,15 +7,15 @@ class LoggerInitializerTest < ::Test::Unit::TestCase def setup @stored_global_logger = $log Dir.mktmpdir do |tmp_dir| - begin - @tmp_dir = Pathname(tmp_dir) - yield - ensure - $log = @stored_global_logger - end + @tmp_dir = Pathname(tmp_dir) + yield end end + def teardown + $log = @stored_global_logger + end + test 'when path is given' do path = @tmp_dir + 'log' + 'fluent_with_path.log' logger = Fluent::Supervisor::LoggerInitializer.new(path.to_s, Fluent::Log::LEVEL_DEBUG, nil, nil, {})