From 9bbe96c59ee98d3056a687aa54c76014b2aef1a2 Mon Sep 17 00:00:00 2001 From: Matt Dale <9760375+matthewdale@users.noreply.github.com> Date: Wed, 13 Jul 2022 20:52:38 -0700 Subject: [PATCH] GODRIVER-2464 Add delay in RTT monitor test so Windows can measure a non-zero latency. (#1022) --- x/mongo/driver/topology/rtt_monitor_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/mongo/driver/topology/rtt_monitor_test.go b/x/mongo/driver/topology/rtt_monitor_test.go index 2ae5a5c6df..73064771d6 100644 --- a/x/mongo/driver/topology/rtt_monitor_test.go +++ b/x/mongo/driver/topology/rtt_monitor_test.go @@ -275,6 +275,10 @@ func TestRTTMonitor(t *testing.T) { return } + // Delay for 10ms so that systems with limited timing granularity (e.g. some + // older versions of Windows) can measure a non-zero latency. + time.Sleep(10 * time.Millisecond) + if _, err := conn.Write(makeHelloReply()); err != nil { // The connection read/write loop is cancelled by closing the connection, // so may be an expected error here. Log the error to make debugging