mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
fix: fix MeasureLatencyRecvTimeout to accept send=0 (#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`.
This commit is contained in:
@ -351,7 +351,7 @@ func TestMeasureLatency(t *testing.T) {
|
||||
|
||||
send, recv, err := pubsub.NewLatencyMeasurer(logger).Measure(ctx, ps)
|
||||
require.ErrorContains(t, err, context.Canceled.Error())
|
||||
require.Greater(t, send.Nanoseconds(), int64(0))
|
||||
require.GreaterOrEqual(t, send.Nanoseconds(), int64(0))
|
||||
require.EqualValues(t, recv, time.Duration(-1))
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user