@@ -241,6 +241,23 @@ def test_worker_history_retry_fails_without_worker_reservations
241241 assert_includes out , 'Reservation history is missing for worker 2'
242242 end
243243
244+ def test_worker_history_retry_fails_when_replay_stops_early
245+ run_worker_history_worker (
246+ retry_count : 0 ,
247+ build_id : 'incomplete-history' ,
248+ test_file : 'test/failing_test.rb'
249+ )
250+ out , err = run_worker_history_worker (
251+ retry_count : 1 ,
252+ build_id : 'incomplete-history' ,
253+ test_file : 'test/failing_test.rb' ,
254+ extra_args : [ '--max-consecutive-failures' , '1' ]
255+ )
256+
257+ refute_predicate $?, :success?
258+ assert_includes out + err , 'Worker history replay stopped before completion'
259+ end
260+
244261 def test_retry_fails_when_test_run_is_expired
245262 out , err = capture_subprocess_io do
246263 system (
@@ -809,19 +826,29 @@ def test_utf8_tests_and_marshal
809826
810827 private
811828
812- def run_worker_history_worker ( retry_count :, build_id : 'worker-history' , worker_id : '1' )
829+ def run_worker_history_worker (
830+ retry_count :,
831+ build_id : 'worker-history' ,
832+ worker_id : '1' ,
833+ test_file : 'test/passing_test.rb' ,
834+ extra_args : [ ]
835+ )
836+ args = [
837+ @exe , 'run' ,
838+ '--queue' , @redis_url ,
839+ '--seed' , 'foobar' ,
840+ '--build' , build_id ,
841+ '--worker' , worker_id ,
842+ '--timeout' , '1' ,
843+ '--retry-selection' , 'worker-history'
844+ ]
845+ args . concat ( extra_args )
846+ args . push ( '-Itest' , test_file )
847+
813848 capture_subprocess_io do
814849 system (
815850 { 'BUILDKITE_RETRY_COUNT' => retry_count . to_s } ,
816- @exe , 'run' ,
817- '--queue' , @redis_url ,
818- '--seed' , 'foobar' ,
819- '--build' , build_id ,
820- '--worker' , worker_id ,
821- '--timeout' , '1' ,
822- '--retry-selection' , 'worker-history' ,
823- '-Itest' ,
824- 'test/passing_test.rb' ,
851+ *args ,
825852 chdir : 'test/fixtures/'
826853 )
827854 end
0 commit comments