Skip to content

Commit 9d4e125

Browse files
committed
chore: fix TestMeasureLatency/MeasureLatencyRecvTimeout flake
1 parent a0fce36 commit 9d4e125

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

coderd/database/pubsub/pubsub_linux_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,13 @@ func TestMeasureLatency(t *testing.T) {
342342
ps, done := newPubsub()
343343
defer done()
344344

345-
ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(-time.Hour))
346-
defer cancel()
345+
ctx, cancel := context.WithCancel(context.Background())
346+
cancel()
347347

348+
<-ctx.Done()
348349
send, recv, err := pubsub.NewLatencyMeasurer(logger).Measure(ctx, ps)
349-
require.ErrorContains(t, err, context.DeadlineExceeded.Error())
350-
require.Greater(t, send.Seconds(), 0.0)
350+
require.ErrorContains(t, err, context.Canceled.Error())
351+
require.Greater(t, send.Nanoseconds(), 0)
351352
require.EqualValues(t, recv, time.Duration(-1))
352353
})
353354

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy