Skip to content

Commit bd0c3d3

Browse files
committed
Count run when success replaces failure; update integration test expectations
- record_success: return true when we replaced a failure (error_reports_deleted_count > 0) so the replacing worker's delta is applied and aggregate counts every run. - Integration tests: expect aggregated assertions by test runs (11 for test_redis_reporter, 1 for test_lost_test_with_heartbeat_monitor) to match delta (1 per run).
1 parent 39dc732 commit bd0c3d3

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎ruby/lib/ci/queue/redis/build_record.rb‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def record_success(id, skip_flaky_record: false)
8686
redis.hdel(key('error-report-deltas'), id)
8787
end
8888
record_flaky(id) if !skip_flaky_record && (error_reports_deleted_count.to_i > 0 || requeued_count.to_i > 0)
89-
!!acknowledged
89+
# Count this run when we ack'd or when we replaced a failure (so stats delta is applied)
90+
acknowledged || error_reports_deleted_count.to_i > 0
9091
end
9192

9293
def record_requeue(id)

‎ruby/lib/minitest/queue/build_status_recorder.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def record(test)
5959
elsif test.skipped?
6060
self.skips += 1
6161
end
62-
# Apply delta to Redis only (HINCRBY); no full overwrite so correction sticks
62+
# Apply delta to Redis (record_success returns true when ack'd or when we replaced a failure)
6363
build.record_stats_delta(delta)
6464
end
6565
end

‎ruby/test/integration/minitest_redis_test.rb‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_lost_test_with_heartbeat_monitor
8888

8989
assert_empty err
9090
result = normalize(out.lines[1].strip)
91-
assert_equal "Ran 1 tests, 0 assertions, 0 failures, 0 errors, 0 skips, 0 requeues in X.XXs (aggregated)", result
91+
assert_equal "Ran 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips, 0 requeues in X.XXs (aggregated)", result
9292
warnings = warnings_file.read.lines.map { |line| JSON.parse(line) }
9393
assert_equal 1, warnings.size
9494
end
@@ -952,7 +952,7 @@ def test_redis_reporter
952952
REQUEUE
953953
BTest#test_bar (requeued 1 times)
954954
955-
Ran 7 tests, 8 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs (aggregated)
955+
Ran 7 tests, 11 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs (aggregated)
956956
957957
958958

0 commit comments

Comments
 (0)