diff --git a/test/helpers/ghostferry_helper.rb b/test/helpers/ghostferry_helper.rb index b099888b..af70b074 100644 --- a/test/helpers/ghostferry_helper.rb +++ b/test/helpers/ghostferry_helper.rb @@ -49,12 +49,9 @@ module Status attr_reader :stdout, :stderr, :logrus_lines, :exit_status, :pid, :error, :error_lines - def initialize(main_path, config: {}, logger: nil, message_timeout: 30, port: 39393) - @logger = logger - if @logger.nil? - @logger = Logger.new(STDOUT) - @logger.level = Logger::DEBUG - end + def initialize(main_path, config: {}, log_capturer:, message_timeout: 30, port: 39393) + @log_capturer = log_capturer + @logger = log_capturer.logger @main_path = main_path @config = config @@ -337,7 +334,7 @@ def start_server_watchdog while @subprocess_thread.alive? do if (now - @last_message_time) > @message_timeout @server.shutdown - @logger&.print_output + @log_capturer.print_output raise "ghostferry did not report to the integration test server for the last #{@message_timeout}s" end diff --git a/test/test_helper.rb b/test/test_helper.rb index 626bbcad..d66c4194 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -49,7 +49,7 @@ class GhostferryTestCase < Minitest::Test def new_ghostferry(filepath, config: {}) # Transform path to something ruby understands path = File.join(GO_CODE_PATH, filepath, "main.go") - g = Ghostferry.new(path, config: config, logger: @log_capturer.logger) + g = Ghostferry.new(path, config: config, log_capturer: @log_capturer) @ghostferry_instances << g g end