1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-08-01 13:46:49 +02:00

fix exit node test

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2025-03-19 10:07:34 +01:00
parent c047278109
commit 81b7b39d79
No known key found for this signature in database
2 changed files with 5 additions and 7 deletions

View File

@ -7,6 +7,8 @@ import (
"testing" "testing"
"time" "time"
"slices"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts" "github.com/google/go-cmp/cmp/cmpopts"
v1 "github.com/juanfont/headscale/gen/go/headscale/v1" v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
@ -1533,6 +1535,7 @@ func TestSubnetRouterMultiNetworkExitNode(t *testing.T) {
err = user2c.Ping(webip.String(), err = user2c.Ping(webip.String(),
tsic.WithPingUntilDirect(false), tsic.WithPingUntilDirect(false),
tsic.WithPingCount(1), tsic.WithPingCount(1),
tsic.WithPingTimeout(7*time.Second),
) )
require.NoError(t, err) require.NoError(t, err)
} }
@ -1563,13 +1566,7 @@ func requirePeerSubnetRoutes(t *testing.T, status *ipnstate.PeerStatus, expected
if tsaddr.IsExitRoute(p) { if tsaddr.IsExitRoute(p) {
return true return true
} }
for _, ip := range status.TailscaleIPs { return !slices.ContainsFunc(status.TailscaleIPs, p.Contains)
if p.Contains(ip) {
return false
}
}
return true
}) })
if diff := cmp.Diff(expected, got, util.PrefixComparer, cmpopts.EquateEmpty()); diff != "" { if diff := cmp.Diff(expected, got, util.PrefixComparer, cmpopts.EquateEmpty()); diff != "" {

View File

@ -1014,6 +1014,7 @@ func (t *TailscaleInContainer) Ping(hostnameOrIP string, opts ...PingOption) err
), ),
) )
if err != nil { if err != nil {
log.Printf("command: %v", command)
log.Printf( log.Printf(
"failed to run ping command from %s to %s, err: %s", "failed to run ping command from %s to %s, err: %s",
t.Hostname(), t.Hostname(),