-
Notifications
You must be signed in to change notification settings - Fork 228
/
testutils.go
34 lines (30 loc) · 1.15 KB
/
testutils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package ipsets
import "github.com/Azure/azure-container-networking/npm/util"
// TODO deprecate the TestSet type and replace TestNSSet etc. with just their metadata
// since you can get prefix name and hashed name with metadata methods
type TestSet struct {
Metadata *IPSetMetadata
PrefixName string
HashedName string
}
func CreateTestSet(name string, setType SetType) *TestSet {
set := &TestSet{
Metadata: &IPSetMetadata{
Name: name,
Type: setType,
},
}
set.PrefixName = set.Metadata.GetPrefixName()
set.HashedName = util.GetHashedName(set.PrefixName)
return set
}
var (
TestNSSet = CreateTestSet("test-ns-set", Namespace)
TestKeyPodSet = CreateTestSet("test-keyPod-set", KeyLabelOfPod)
TestKVPodSet = CreateTestSet("test-kvPod-set", KeyValueLabelOfPod)
TestNamedportSet = CreateTestSet("test-namedport-set", NamedPorts)
TestCIDRSet = CreateTestSet("test-cidr-set", CIDRBlocks)
TestKeyNSList = CreateTestSet("test-keyNS-list", KeyLabelOfNamespace)
TestKVNSList = CreateTestSet("test-kvNS-list", KeyValueLabelOfNamespace)
TestNestedLabelList = CreateTestSet("test-nestedlabel-list", NestedLabelOfPod)
)