diff options
| author | James Tucker <jftucker@gmail.com> | 2023-04-14 17:01:29 -0700 |
|---|---|---|
| committer | James Tucker <jftucker@gmail.com> | 2023-04-19 19:00:34 -0700 |
| commit | cd35a79136b8d8d3f452e93a6e3eb1a77ac78a53 (patch) | |
| tree | c8429e483d421f2fa5a4ecef6c69320e7a09bc7d /syncs | |
| parent | f85dc6f97c3c8cd7ee975153052757d5037911c5 (diff) | |
| download | tailscale-cd35a79136b8d8d3f452e93a6e3eb1a77ac78a53.tar.xz tailscale-cd35a79136b8d8d3f452e93a6e3eb1a77ac78a53.zip | |
syncs: relax TestWatchMultipleValues timing on Windows
The test is re-enabled for Windows with a relaxed time assertion.
On Windows the runtime poller currently does not have sufficient
resolution to meet the normal requirements for this test.
See https://github.com/golang/go/issues/44343 for background.
Updates #7876
Signed-off-by: James Tucker <jftucker@gmail.com>
Diffstat (limited to 'syncs')
| -rw-r--r-- | syncs/watchdog_test.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/syncs/watchdog_test.go b/syncs/watchdog_test.go index 4a45a4faa..e85e6cd75 100644 --- a/syncs/watchdog_test.go +++ b/syncs/watchdog_test.go @@ -46,9 +46,6 @@ func TestWatchContended(t *testing.T) { } func TestWatchMultipleValues(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("TODO(#7876): test regressed on windows while CI was broken") - } mu := new(sync.Mutex) ctx, cancel := context.WithCancel(context.Background()) defer cancel() // not necessary, but keep vet happy @@ -68,7 +65,13 @@ func TestWatchMultipleValues(t *testing.T) { cancel() } } - if elapsed := time.Since(start); elapsed > 100*time.Millisecond { + // See https://github.com/golang/go/issues/44343 - on Windows the Go runtime timer resolution is currently too coarse. Allow longer in that case. + want := 100 * time.Millisecond + if runtime.GOOS == "windows" { + want = 500 * time.Millisecond + } + + if elapsed := time.Since(start); elapsed > want { t.Errorf("expected 1 event per millisecond, got only %v events in %v", n, elapsed) } } |
