Skip to content

Commit f9f017e

Browse files
authored
Merge pull request #198 from Shopify/require-worker-id
Exit early if worker or build id is missing
2 parents e97ffa1 + 4618058 commit f9f017e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ruby/lib/minitest/queue/runner.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ def run!
4242
end
4343

4444
def retry_command
45+
require_worker_id!
4546
STDERR.puts "Warning: the retry subcommand is deprecated."
4647
run_command # aliased for backward compatibility purpose
4748
end
4849

4950
def run_command
51+
require_worker_id!
5052
if queue.retrying? || retry?
5153
if queue.expired?
5254
abort! "The test run is too old and can't be retried"
@@ -90,6 +92,7 @@ def run_command
9092
end
9193

9294
def release_command
95+
require_worker_id!
9396
queue.release!
9497
end
9598

@@ -249,6 +252,11 @@ def report_grind_command
249252
attr_reader :queue_config, :options, :command, :argv
250253
attr_accessor :queue, :queue_url, :grind_list, :grind_count, :load_paths
251254

255+
def require_worker_id!
256+
invalid_usage!("build-id couldn't be inferred from ENV and wasn't set via --build") unless queue_config.build_id
257+
invalid_usage!("worker-id couldn't be inferred from ENV and wasn't set via --worker") unless queue_config.worker_id
258+
end
259+
252260
def display_warnings(build)
253261
build.pop_warnings.each do |type, attributes|
254262
case type

0 commit comments

Comments
 (0)