Skip to content

Commit

Permalink
Exit early if worker or build id is missing
Browse files Browse the repository at this point in the history
Avoid failing later down the stack with weird Redis errors.
  • Loading branch information
byroot committed Mar 10, 2023
1 parent e97ffa1 commit 4618058
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ruby/lib/minitest/queue/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ def run!
end

def retry_command
require_worker_id!
STDERR.puts "Warning: the retry subcommand is deprecated."
run_command # aliased for backward compatibility purpose
end

def run_command
require_worker_id!
if queue.retrying? || retry?
if queue.expired?
abort! "The test run is too old and can't be retried"
Expand Down Expand Up @@ -90,6 +92,7 @@ def run_command
end

def release_command
require_worker_id!
queue.release!
end

Expand Down Expand Up @@ -249,6 +252,11 @@ def report_grind_command
attr_reader :queue_config, :options, :command, :argv
attr_accessor :queue, :queue_url, :grind_list, :grind_count, :load_paths

def require_worker_id!
invalid_usage!("build-id couldn't be inferred from ENV and wasn't set via --build") unless queue_config.build_id
invalid_usage!("worker-id couldn't be inferred from ENV and wasn't set via --worker") unless queue_config.worker_id
end

def display_warnings(build)
build.pop_warnings.each do |type, attributes|
case type
Expand Down

0 comments on commit 4618058

Please sign in to comment.