Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions npm/pkg/dataplane/ipsets/ipsetmanager_windows_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package ipsets

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

"github.com/Azure/azure-container-networking/common"
Expand Down Expand Up @@ -379,7 +380,19 @@ 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, ",")

expectedMembers := strings.Split(setObj.Values, ",")
sort.Strings(expectedMembers)
copyOfExpectedObj := setObj
copyOfExpectedObj.Values = strings.Join(expectedMembers, ",")

require.Equal(t, copyOfExpectedObj, copyOfCachedObj, setName+" mismatch in cache")
}
}

Expand Down
Loading