From 55c11587ad4dabdd6c7db728d72976df81c2aa7f Mon Sep 17 00:00:00 2001 From: QxBytes Date: Tue, 21 Jan 2025 11:06:46 -0800 Subject: [PATCH] sort set policy values before validation --- npm/pkg/dataplane/ipsets/ipsetmanager_windows_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/npm/pkg/dataplane/ipsets/ipsetmanager_windows_test.go b/npm/pkg/dataplane/ipsets/ipsetmanager_windows_test.go index 252304cc8d..4f5bb41c2f 100644 --- a/npm/pkg/dataplane/ipsets/ipsetmanager_windows_test.go +++ b/npm/pkg/dataplane/ipsets/ipsetmanager_windows_test.go @@ -2,6 +2,8 @@ package ipsets import ( "fmt" + "sort" + "strings" "testing" "github.com/Azure/azure-container-networking/common" @@ -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)) } }