integration: add cap/relay grant peer relay lifecycle test

Add ConnectToNetwork to the TailscaleClient interface for multi-network test scenarios and implement peer relay ping support. Use these to test that cap/relay grants correctly enable peer-to-peer relay connections between tagged nodes.

Updates #2180
This commit is contained in:
Kristoffer Dalby
2026-03-23 08:22:41 +00:00
parent 8573ff9158
commit 9b1a6b6c05
3 changed files with 521 additions and 1 deletions

View File

@@ -1403,7 +1403,7 @@ func (t *TailscaleInContainer) Ping(hostnameOrIP string, opts ...PingOption) err
}
if !args.direct {
if strings.Contains(result, "via DERP") {
if strings.Contains(result, "via DERP") || strings.Contains(result, "via relay") {
return nil
} else {
return errTailscalePingNotDERP
@@ -1625,6 +1625,11 @@ func (t *TailscaleInContainer) GetNodePrivateKey() (*key.NodePrivate, error) {
return &p.Persist.PrivateNodeKey, nil
}
// ConnectToNetwork connects the Tailscale container to an additional Docker network.
func (t *TailscaleInContainer) ConnectToNetwork(network *dockertest.Network) error {
return t.container.ConnectToNetwork(network)
}
// PacketFilter returns the current packet filter rules from the client's network map.
// This is useful for verifying that policy changes have propagated to the client.
func (t *TailscaleInContainer) PacketFilter() ([]filter.Match, error) {