From f4023a3275158223f14075d67ddcb8733f0408ea Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Thu, 12 Nov 2026 15:26:54 +0000 Subject: [PATCH] test(logs): the no-gap test no longer depends on how fast its reader runs Signed-off-by: Ricardo Dias --- backend/internal/logsink/sink_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/internal/logsink/sink_test.go b/backend/internal/logsink/sink_test.go index 4b0fc36..9b87f43 100644 --- a/backend/internal/logsink/sink_test.go +++ b/backend/internal/logsink/sink_test.go @@ -150,7 +150,10 @@ func TestTailSpansBothFiles(t *testing.T) { func TestSubscribeHasNoGapOrDuplicate(t *testing.T) { s, _, _ := newOpened(t, 0) - const total = 2000 + // At most 200 lines are written after Subscribe, fewer than the 256 a + // subscriber's channel holds, so no line is dropped however slowly the + // reader below runs. + const total = 700 started := make(chan struct{}) done := make(chan struct{}) go func() { @@ -167,7 +170,7 @@ func TestSubscribeHasNoGapOrDuplicate(t *testing.T) { var got []string got = append(got, tail...) drained := make(chan struct{}) - go func() { // drain concurrently so the 256-line channel never fills + go func() { defer close(drained) for l := range ch { got = append(got, l)