mirror of
https://github.com/tailscale/tailscale.git
synced 2025-11-14 17:43:01 +00:00
Fix test for local. Notice the default value for creating a new appconnector now has a routeInfo = nil, for us to quickly know if the value needs to be loaded from store.
This commit is contained in:
@@ -87,7 +87,7 @@ func NewAppConnector(logf logger.Logf, routeAdvertiser RouteAdvertiser, shouldSt
|
||||
logf: logger.WithPrefix(logf, "appc: "),
|
||||
routeAdvertiser: routeAdvertiser,
|
||||
ShouldStoreRoutes: shouldStoreRoutes,
|
||||
routeInfo: routeinfo.NewRouteInfo(),
|
||||
routeInfo: nil,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,12 +69,15 @@ func TestUpdateRoutes(t *testing.T) {
|
||||
routes := []netip.Prefix{netip.MustParsePrefix("192.0.2.0/24"), netip.MustParsePrefix("192.0.0.1/32")}
|
||||
a.updateRoutes(routes)
|
||||
|
||||
wantRouteInfoControlRoutes := []netip.Prefix{}
|
||||
if shouldStore {
|
||||
wantRouteInfoControlRoutes = routes
|
||||
}
|
||||
if !slices.Equal(a.routeInfo.Control, wantRouteInfoControlRoutes) {
|
||||
t.Fatalf("got %v, want %v (shouldStore=%t)", a.routeInfo.Control, wantRouteInfoControlRoutes, shouldStore)
|
||||
wantRouteInfoControlRoutes := routes
|
||||
if !slices.Equal(a.routeInfo.Control, wantRouteInfoControlRoutes) {
|
||||
t.Fatalf("got %v, want %v (shouldStore=%t)", a.routeInfo.Control, wantRouteInfoControlRoutes, shouldStore)
|
||||
}
|
||||
} else {
|
||||
if a.routeInfo != nil {
|
||||
t.Fatalf("got %v, want %v (shouldStore=%t)", a.routeInfo.Control, nil, shouldStore)
|
||||
}
|
||||
}
|
||||
|
||||
slices.SortFunc(rc.Routes(), prefixCompare)
|
||||
|
||||
Reference in New Issue
Block a user