all: use tstest.Replace more

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2023-03-04 12:04:55 -08:00
committed by Maisem Ali
parent 57a44846ae
commit 1a30b2d73f
12 changed files with 35 additions and 58 deletions

View File

@ -997,11 +997,8 @@ func TestMarshalResponseFormatError(t *testing.T) {
}
func TestForwardLinkSelection(t *testing.T) {
old := initListenConfig
defer func() { initListenConfig = old }()
configCall := make(chan string, 1)
initListenConfig = func(nc *net.ListenConfig, mon *monitor.Mon, tunName string) error {
tstest.Replace(t, &initListenConfig, func(nc *net.ListenConfig, mon *monitor.Mon, tunName string) error {
select {
case configCall <- tunName:
return nil
@ -1009,7 +1006,7 @@ func TestForwardLinkSelection(t *testing.T) {
t.Error("buffer full")
return errors.New("buffer full")
}
}
})
// specialIP is some IP we pretend that our link selector
// routes differently.