mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-18 14:49:57 +00:00
linter
This commit is contained in:
@@ -481,12 +481,12 @@ func TestCollectPolicyAffectedGroups_MultiplePolicies(t *testing.T) {
|
||||
{Sources: []string{"g1"}, Destinations: []string{"g2"}},
|
||||
},
|
||||
}
|
||||
new := &types.Policy{
|
||||
updated := &types.Policy{
|
||||
Rules: []*types.PolicyRule{
|
||||
{Sources: []string{"g3"}, Destinations: []string{"g4"}},
|
||||
},
|
||||
}
|
||||
groups, _ := collectPolicyAffectedGroupsAndPeers(context.Background(), new, old)
|
||||
groups, _ := collectPolicyAffectedGroupsAndPeers(context.Background(), updated, old)
|
||||
assert.ElementsMatch(t, []string{"g1", "g2", "g3", "g4"}, groups)
|
||||
}
|
||||
|
||||
@@ -548,11 +548,11 @@ func TestCollectRouteAffectedGroups_MultipleRoutes(t *testing.T) {
|
||||
Groups: []string{"g1"},
|
||||
Peer: "p1",
|
||||
}
|
||||
new := &route.Route{
|
||||
updated := &route.Route{
|
||||
Groups: []string{"g2"},
|
||||
PeerGroups: []string{"g3"},
|
||||
}
|
||||
groups, directPeers := collectRouteAffectedGroupsAndPeers(context.Background(), new, old)
|
||||
groups, directPeers := collectRouteAffectedGroupsAndPeers(context.Background(), updated, old)
|
||||
assert.ElementsMatch(t, []string{"g1", "g2", "g3"}, groups)
|
||||
assert.ElementsMatch(t, []string{"p1"}, directPeers)
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ type resourceAffectedPeersData struct {
|
||||
// loadResourceAffectedPeersData loads the data needed to determine affected peers within a transaction.
|
||||
func loadResourceAffectedPeersData(ctx context.Context, transaction store.Store, accountID, networkID string, resourceGroupIDs []string) (*resourceAffectedPeersData, error) {
|
||||
if len(resourceGroupIDs) == 0 {
|
||||
return nil, nil
|
||||
return &resourceAffectedPeersData{}, nil
|
||||
}
|
||||
|
||||
policies, err := transaction.GetAccountPolicies(ctx, store.LockingStrengthNone, accountID)
|
||||
|
||||
@@ -321,7 +321,7 @@ func loadRouterAffectedPeersData(ctx context.Context, transaction store.Store, a
|
||||
}
|
||||
|
||||
if len(routerPeerGroups) == 0 && len(directPeerIDs) == 0 {
|
||||
return nil, nil
|
||||
return &routerAffectedPeersData{}, nil
|
||||
}
|
||||
|
||||
resources, err := transaction.GetNetworkResourcesByNetID(ctx, store.LockingStrengthNone, accountID, networkID)
|
||||
|
||||
Reference in New Issue
Block a user