Skip to content

Commit

Permalink
Remove --worker and --build as mandatory arguments
Browse files Browse the repository at this point in the history
Considering that we, now, can re-run the same builds using `--reproduce`
it makes sense to simplify the re-run command we report in sentry.
  • Loading branch information
Stefanos Boglou committed Oct 26, 2022
1 parent c953851 commit c758f7c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions bin/rspecq
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
require "optparse"
require "rspecq"

DEFAULT_WORKER = "foo".freeze
DEFAULT_BUILD = "bar".freeze
DEFAULT_REDIS_HOST = "127.0.0.1".freeze
DEFAULT_REPORT_TIMEOUT = 3600 # 1 hour
DEFAULT_MAX_REQUEUES = 3
Expand Down Expand Up @@ -127,8 +129,8 @@ OptionParser.new do |o|
end
end.parse!

opts[:build] ||= ENV["RSPECQ_BUILD"]
opts[:worker] ||= ENV["RSPECQ_WORKER"]
opts[:build] ||= ENV["RSPECQ_BUILD"] || DEFAULT_BUILD
opts[:worker] ||= ENV["RSPECQ_WORKER"] || DEFAULT_WORKER
opts[:seed] ||= ENV["RSPECQ_SEED"]
opts[:redis_host] ||= ENV["RSPECQ_REDIS"] || DEFAULT_REDIS_HOST
opts[:timings] ||= env_set?("RSPECQ_UPDATE_TIMINGS")
Expand Down
4 changes: 2 additions & 2 deletions lib/rspecq/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def job_rerun_command(job)
jobs = redis.lrange(key("queue", "jobs_per_worker", worker), 0, -1)
seed = redis.hget(key("worker_seed"), worker)

"DISABLE_SPRING=1 DISABLE_BOOTSNAP=1 bin/rspecq --build 1 " \
"--worker foo --seed #{seed} --max-requeues 0 --fail-fast 1 " \
"DISABLE_SPRING=1 DISABLE_BOOTSNAP=1 bin/rspecq " \
"--seed #{seed} --max-requeues 0 --fail-fast 1 " \
"--reproduction #{jobs.join(' ')}"
end

Expand Down
4 changes: 2 additions & 2 deletions test/test_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def test_flakey_suite

assert_match "Flaky jobs detected", output
assert_match "./spec/foo_spec.rb:2 @ #{worker_id}", output
assert_match "DISABLE_SPRING=1 DISABLE_BOOTSNAP=1 bin/rspecq --build 1 " \
"--worker foo --seed 1234 --max-requeues 0 --fail-fast 1 --reproduction " \
assert_match "DISABLE_SPRING=1 DISABLE_BOOTSNAP=1 bin/rspecq " \
"--seed 1234 --max-requeues 0 --fail-fast 1 --reproduction " \
"./spec/foo_spec.rb ./spec/foo_spec.rb[1:1] ./spec/foo_spec.rb[1:1]", output
refute_match "Failed examples", output
end
Expand Down

0 comments on commit c758f7c

Please sign in to comment.