Skip to content

Commit fade8ba

Browse files
authored
fix: fix MeasureLatencyRecvTimeout to accept send=0 (coder#13477)
Fixes the flake seen here: https://github.com/coder/coder/runs/25832852690 Linux is not a real time operating system, and so there is no guarantee that subsequent `time.Now()` `time.Since()` calls will return a non-zero time. This assert is mainly there to ensure we don't return `-1`.
1 parent 775fc3f commit fade8ba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

coderd/database/pubsub/pubsub_linux_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ func TestMeasureLatency(t *testing.T) {
351351

352352
send, recv, err := pubsub.NewLatencyMeasurer(logger).Measure(ctx, ps)
353353
require.ErrorContains(t, err, context.Canceled.Error())
354-
require.Greater(t, send.Nanoseconds(), int64(0))
354+
require.GreaterOrEqual(t, send.Nanoseconds(), int64(0))
355355
require.EqualValues(t, recv, time.Duration(-1))
356356
})
357357

0 commit comments

Comments
 (0)