mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
81dba3738e
Avoid contention from fetching status for all peers, and instead fetch status for a single peer. Updates tailscale/coral#72 Signed-off-by: James Tucker <james@tailscale.com>
41 lines
948 B
Go
41 lines
948 B
Go
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package wgengine
|
|
|
|
import (
|
|
"runtime"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestWatchdog(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
var maxWaitMultiple time.Duration = 1
|
|
if runtime.GOOS == "darwin" {
|
|
// Work around slow close syscalls on Big Sur with content filter Network Extensions installed.
|
|
// See https://github.com/tailscale/tailscale/issues/1598.
|
|
maxWaitMultiple = 15
|
|
}
|
|
|
|
t.Run("default watchdog does not fire", func(t *testing.T) {
|
|
t.Parallel()
|
|
e, err := NewFakeUserspaceEngine(t.Logf, 0)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
e = NewWatchdog(e)
|
|
e.(*watchdogEngine).maxWait = maxWaitMultiple * 150 * time.Millisecond
|
|
e.(*watchdogEngine).logf = t.Logf
|
|
e.(*watchdogEngine).fatalf = t.Fatalf
|
|
|
|
e.RequestStatus()
|
|
e.RequestStatus()
|
|
e.RequestStatus()
|
|
e.Close()
|
|
})
|
|
}
|