@@ -24,6 +24,7 @@ package storage
24
24
25
25
import (
26
26
"context"
27
+ "encoding/json"
27
28
"testing"
28
29
29
30
"github.com/stretchr/testify/assert"
@@ -83,16 +84,17 @@ func TestCreateValidEndpointList(t *testing.T) {
83
84
}
84
85
}
85
86
86
- // TestCreateNodeAffinity tests createNodeAffinity .
87
- func TestCreateNodeAffinity (t * testing.T ) {
87
+ // TestCreateNodeSelector tests createNodeSelector .
88
+ func TestCreateNodeSelector (t * testing.T ) {
88
89
tests := map [string ]string {
89
- "foo" : "{\" requiredDuringSchedulingIgnoredDuringExecution \" :{ \" nodeSelectorTerms\" :[{\" matchExpressions\" :[{\" key\" :\" kubernetes.io/hostname\" ,\" operator\" :\" In\" ,\" values\" :[\" foo\" ]}]}]} }" ,
90
- "bar" : "{\" requiredDuringSchedulingIgnoredDuringExecution \" :{ \" nodeSelectorTerms\" :[{\" matchExpressions\" :[{\" key\" :\" kubernetes.io/hostname\" ,\" operator\" :\" In\" ,\" values\" :[\" bar\" ]}]}]} }" ,
90
+ "foo" : "{\" nodeSelectorTerms\" :[{\" matchExpressions\" :[{\" key\" :\" kubernetes.io/hostname\" ,\" operator\" :\" In\" ,\" values\" :[\" foo\" ]}]}]}" ,
91
+ "bar" : "{\" nodeSelectorTerms\" :[{\" matchExpressions\" :[{\" key\" :\" kubernetes.io/hostname\" ,\" operator\" :\" In\" ,\" values\" :[\" bar\" ]}]}]}" ,
91
92
}
92
93
for input , expected := range tests {
93
- output , err := createNodeAffinity (input )
94
+ sel := createNodeSelector (input )
95
+ output , err := json .Marshal (sel )
94
96
assert .NoError (t , err )
95
- assert .Equal (t , expected , output , "Input: '%s'" , input )
97
+ assert .Equal (t , expected , string ( output ) , "Input: '%s'" , input )
96
98
}
97
99
}
98
100
0 commit comments