Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ minitest-queue --queue redis://example.com \
run -Itest test/**/*_test.rb
```

Worker-history retries require the retry to retain its worker ID and queue build ID. Missing reservation history or suite chunk metadata fails the retry. The replay uses a local retry queue and does not rejoin the shared queue, so surviving workers must drain any remaining work. When centralized reporting is used, restarting every worker before the shared queue is exhausted fails the build rather than accepting an incomplete run.
Worker-history retries require the retry to retain its worker ID and queue build ID. A worker retried before reserving tests rejoins the shared queue, while missing suite chunk metadata fails the retry. Replaying existing history uses a local retry queue and does not rejoin the shared queue, so surviving workers must drain any remaining work. When centralized reporting is used, restarting every worker before the shared queue is exhausted fails the build rather than accepting an incomplete run.


If you'd like to centralize the error reporting you can do so with:
Expand Down
2 changes: 0 additions & 2 deletions ruby/lib/ci/queue/redis/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,6 @@ def failed_test_ids(reservations)
end

def worker_history_test_ids(reservations)
raise WorkerHistoryError, "Reservation history is missing for worker #{worker_id}" if reservations.empty?

reservations.reverse.flat_map { |id| expand_reservation(id) }.uniq
end

Expand Down
8 changes: 3 additions & 5 deletions ruby/test/ci/queue/redis_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ def test_retry_queue_with_worker_history
assert_equal original_order, poll(retry_queue)
end

def test_worker_history_retry_requires_reservations
error = assert_raises(CI::Queue::Redis::WorkerHistoryError) do
@queue.retry_queue(selection: :worker_history)
end
def test_worker_history_retry_without_reservations_is_empty
retry_queue = @queue.retry_queue(selection: :worker_history)

assert_equal 'Reservation history is missing for worker 1', error.message
assert_predicate retry_queue, :exhausted?
end

def test_worker_history_retry_requires_complete_replay
Expand Down
7 changes: 4 additions & 3 deletions ruby/test/integration/minitest_redis_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,14 @@ def test_worker_history_retry_replays_all_reserved_tests
assert_equal 'Ran 100 tests, 100 assertions, 0 failures, 0 errors, 0 skips, 0 requeues in X.XXs', output
end

def test_worker_history_retry_fails_without_worker_reservations
def test_worker_history_retry_rejoins_queue_without_worker_reservations
run_worker_history_worker(retry_count: 0, build_id: 'missing-history', worker_id: '1')

out, = run_worker_history_worker(retry_count: 1, build_id: 'missing-history', worker_id: '2')

refute_predicate $?, :success?
assert_includes out, 'Reservation history is missing for worker 2'
assert_predicate $?, :success?
assert_includes out, "The retry queue does not contain any failure, we'll process the main queue instead."
assert_includes out, 'All tests were ran already'
end

def test_worker_history_retry_fails_when_replay_stops_early
Expand Down
Loading