From d0128adf5bd00515673145873f32eea0960480e7 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 10 Oct 2026 12:33:43 +0200 Subject: [PATCH] Fail the contention test when the two writers never collided: it would prove nothing (the review of 2026-10-10) --- node-tools/internal/runtime/state_counter_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node-tools/internal/runtime/state_counter_test.go b/node-tools/internal/runtime/state_counter_test.go index cd18788..0a47db0 100644 --- a/node-tools/internal/runtime/state_counter_test.go +++ b/node-tools/internal/runtime/state_counter_test.go @@ -122,6 +122,9 @@ func TestTwoWritersIncrementingOneCounterOnTheBusLoseNoUpdate(t *testing.T) { if string(e.Value) != "2000" || len(seen) != 2*each { t.Fatalf("the counter ended at %s with %d numbers handed out, not 2000: an increment was lost", e.Value, len(seen)) } + if lost[0]+lost[1] == 0 { + t.Fatal("the two writers never collided: the test proved nothing about contention") + } t.Logf("2000 increments, %d writes lost to the other writer and tried again", lost[0]+lost[1]) }