servertest: use memnet networking and add WithNodeExpiry option

Replace httptest (real TCP sockets) with tailscale.com/net/memnet
so all connections stay in-process. Wire the client's tsdial.Dialer
to the server's memnet.Network via SetSystemDialerForTest,
preserving the full Noise protocol path.

Also update servertest to use the new Node.Ephemeral.InactivityTimeout
config path introduced in the types refactor, and add WithNodeExpiry
server option for testing default node key expiry behaviour.

Updates #1711
This commit is contained in:
Kristoffer Dalby 2026-04-02 09:19:05 +00:00
parent 7e8930c507
commit ff29af63f6
3 changed files with 96 additions and 21 deletions

View file

@ -121,6 +121,10 @@ func NewClient(tb testing.TB, server *TestServer, name string, opts ...ClientOpt
dialer := tsdial.NewDialer(netmon.NewStatic())
dialer.SetBus(bus)
// Route all connections through the server's in-memory network
// so that no real TCP sockets are used.
dialer.SetSystemDialerForTest(server.MemNet().Dial)
machineKey := key.NewMachine()
direct, err := controlclient.NewDirect(controlclient.Options{