Skip to content

Commit

Permalink
Use capturer
Browse files Browse the repository at this point in the history
  • Loading branch information
driv3r committed Oct 9, 2023
1 parent d575e5f commit 6d41d77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions test/helpers/ghostferry_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6d41d77

Please sign in to comment.