Skip to content

Commit

Permalink
Merge pull request #198 from Shopify/require-worker-id
Browse files Browse the repository at this point in the history
Exit early if worker or build id is missing
  • Loading branch information
casperisfine authored Mar 10, 2023
2 parents e97ffa1 + 4618058 commit f9f017e
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 f9f017e

Please sign in to comment.