wgengine/magicsock: disable portmapper in tunchan-faked tests
Most of the magicsock tests fake the network, simulating packets going out and coming in. There's no reason to actually hit your router to do UPnP/NAT-PMP/PCP during in tests. But while debugging thousands of iterations of tests to deflake some things, I saw it slamming my router. This stops that. Updates #11762 Change-Id: I59b9f48f8f5aff1fa16b4935753d786342e87744 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
22bd506129
commit
03d5d1f0f9
@@ -171,6 +171,7 @@ func newMagicStackWithKey(t testing.TB, logf logger.Logf, l nettype.PacketListen
|
||||
epCh := make(chan []tailcfg.Endpoint, 100) // arbitrary
|
||||
conn, err := NewConn(Options{
|
||||
Logf: logf,
|
||||
DisablePortMapper: true,
|
||||
TestOnlyPacketListener: l,
|
||||
EndpointsFunc: func(eps []tailcfg.Endpoint) {
|
||||
epCh <- eps
|
||||
@@ -376,9 +377,10 @@ func TestNewConn(t *testing.T) {
|
||||
|
||||
port := pickPort(t)
|
||||
conn, err := NewConn(Options{
|
||||
Port: port,
|
||||
EndpointsFunc: epFunc,
|
||||
Logf: t.Logf,
|
||||
Port: port,
|
||||
DisablePortMapper: true,
|
||||
EndpointsFunc: epFunc,
|
||||
Logf: t.Logf,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -1242,6 +1244,7 @@ func newTestConn(t testing.TB) *Conn {
|
||||
t.Helper()
|
||||
port := pickPort(t)
|
||||
conn, err := NewConn(Options{
|
||||
DisablePortMapper: true,
|
||||
Logf: t.Logf,
|
||||
Port: port,
|
||||
TestOnlyPacketListener: localhostListener{},
|
||||
|
||||
Reference in New Issue
Block a user