tailscale/wgengine/magicsock/derp_test.go
James Tucker 6e334e64a1 net/netcheck,wgengine/magicsock: align DERP frame receive time heuristics
The netcheck package and the magicksock package coordinate via the
health package, but both sides have time based heuristics through
indirect dependencies. These were misaligned, so the implemented
heuristic aimed at reducing DERP moves while there is active traffic
were non-operational about 3/5ths of the time.

It is problematic to setup a good test for this integration presently,
so instead I added comment breadcrumbs along with the initial fix.

Updates #8603

Signed-off-by: James Tucker <james@tailscale.com>
2024-04-05 13:04:42 -07:00

17 lines
358 B
Go

// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package magicsock
import (
"testing"
"tailscale.com/net/netcheck"
)
func CheckDERPHeuristicTimes(t *testing.T) {
if netcheck.PreferredDERPFrameTime <= frameReceiveRecordRate {
t.Errorf("PreferredDERPFrameTime too low; should be at least frameReceiveRecordRate")
}
}