Skip to content

Commit

Permalink
sort set policy values before validation
Browse files Browse the repository at this point in the history
  • Loading branch information
QxBytes committed Jan 21, 2025
1 parent c670d53 commit 55c1158
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion npm/pkg/dataplane/ipsets/ipsetmanager_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package ipsets

import (
"fmt"
"sort"
"strings"
"testing"

"github.com/Azure/azure-container-networking/common"
Expand Down Expand Up @@ -379,7 +381,14 @@ func verifyHNSCache(t *testing.T, expected map[string]hcn.SetPolicySetting, hns
for setName, setObj := range expected {
cacheObj := hns.Cache.SetPolicy(setObj.Id)
require.NotNil(t, cacheObj)
require.Equal(t, setObj, *cacheObj, fmt.Sprintf("%s mismatch in cache", setName))

// make values always sorted for testing consistency
members := strings.Split(cacheObj.Values, ",")
sort.Strings(members)
copyOfCachedObj := *cacheObj
copyOfCachedObj.Values = strings.Join(members, ",")

require.Equal(t, setObj, copyOfCachedObj, fmt.Sprintf("%s mismatch in cache", setName))

Check failure on line 391 in npm/pkg/dataplane/ipsets/ipsetmanager_windows_test.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

fmt.Sprintf can be replaced with string concatenation (perfsprint)

Check failure on line 391 in npm/pkg/dataplane/ipsets/ipsetmanager_windows_test.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

fmt.Sprintf can be replaced with string concatenation (perfsprint)
}
}

Expand Down

0 comments on commit 55c1158

Please sign in to comment.