Skip to content

Commit fed6822

Browse files
authored
Merge pull request #124 from Dyanngg/nit-fix-for-conformance
Fix some nits in conformance package
2 parents 03bb9b6 + 9ad14c2 commit fed6822

16 files changed

+469
-467
lines changed

conformance/tests/admin-network-policy-core-egress-sctp-rules.go

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
5050
defer cancel()
5151
// This test uses `egress-sctp` ANP
5252
// harry-potter-0 is our server pod in gryffindor namespace
53-
clientPod := &v1.Pod{}
53+
serverPod := &v1.Pod{}
5454
err := s.Client.Get(ctx, client.ObjectKey{
5555
Namespace: "network-policy-conformance-gryffindor",
5656
Name: "harry-potter-0",
57-
}, clientPod)
57+
}, serverPod)
5858
framework.ExpectNoError(err, "unable to fetch the server pod")
5959
// luna-lovegood-0 is our client pod in ravenclaw namespace
6060
// ensure egress is ALLOWED to gryffindor from ravenclaw
6161
// egressRule at index0 will take precedence over egressRule at index1; thus ALLOW takes precedence over DENY since rules are ordered
6262
success := kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-0", "sctp",
63-
clientPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
63+
serverPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
6464
assert.Equal(t, true, success)
6565
// luna-lovegood-1 is our client pod in ravenclaw namespace
6666
success = kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-1", "sctp",
67-
clientPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
67+
serverPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
6868
assert.Equal(t, true, success)
6969
})
7070

@@ -73,21 +73,21 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
7373
defer cancel()
7474
// This test uses `egress-sctp` ANP
7575
// cedric-diggory-1 is our server pod in hufflepuff namespace
76-
clientPod := &v1.Pod{}
76+
serverPod := &v1.Pod{}
7777
err := s.Client.Get(ctx, client.ObjectKey{
7878
Namespace: "network-policy-conformance-hufflepuff",
7979
Name: "cedric-diggory-1",
80-
}, clientPod)
80+
}, serverPod)
8181
framework.ExpectNoError(err, "unable to fetch the server pod")
8282
// luna-lovegood-0 is our client pod in ravenclaw namespace
83-
// ensure egress is ALLOWED to hufflepuff from ravenclaw at port 9003; egressRule at index5
83+
// ensure egress is ALLOWED to hufflepuff from ravenclaw at port 9003; egressRule at index5 should take effect
8484
success := kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-0", "sctp",
85-
clientPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
85+
serverPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
8686
assert.Equal(t, true, success)
8787
// luna-lovegood-1 is our client pod in ravenclaw namespace
88-
// ensure egress is DENIED to hufflepuff from ravenclaw for rest of the traffic; egressRule at index6
88+
// ensure egress is DENIED to hufflepuff from ravenclaw for rest of the traffic; egressRule at index6 should take effect
8989
success = kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-1", "sctp",
90-
clientPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, false)
90+
serverPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, false)
9191
assert.Equal(t, true, success)
9292
})
9393

@@ -96,11 +96,11 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
9696
defer cancel()
9797
// This test uses `egress-sctp` ANP
9898
// harry-potter-0 is our server pod in gryffindor namespace
99-
clientPod := &v1.Pod{}
99+
serverPod := &v1.Pod{}
100100
err := s.Client.Get(ctx, client.ObjectKey{
101101
Namespace: "network-policy-conformance-gryffindor",
102102
Name: "harry-potter-1",
103-
}, clientPod)
103+
}, serverPod)
104104
framework.ExpectNoError(err, "unable to fetch the server pod")
105105
anp := &v1alpha1.AdminNetworkPolicy{}
106106
err = s.Client.Get(ctx, client.ObjectKey{
@@ -117,11 +117,11 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
117117
// ensure egress is DENIED to gryffindor from ravenclaw
118118
// egressRule at index0 will take precedence over egressRule at index1; thus DENY takes precedence over ALLOW since rules are ordered
119119
success := kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-0", "sctp",
120-
clientPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, false)
120+
serverPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, false)
121121
assert.Equal(t, true, success)
122122
// luna-lovegood-1 is our client pod in ravenclaw namespace
123123
success = kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-1", "sctp",
124-
clientPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, false)
124+
serverPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, false)
125125
assert.Equal(t, true, success)
126126
})
127127

@@ -130,21 +130,21 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
130130
defer cancel()
131131
// This test uses `egress-sctp` ANP
132132
// draco-malfoy-0 is our server pod in slytherin namespace
133-
clientPod := &v1.Pod{}
133+
serverPod := &v1.Pod{}
134134
err := s.Client.Get(ctx, client.ObjectKey{
135135
Namespace: "network-policy-conformance-slytherin",
136136
Name: "draco-malfoy-0",
137-
}, clientPod)
137+
}, serverPod)
138138
framework.ExpectNoError(err, "unable to fetch the server pod")
139139
// luna-lovegood-0 is our client pod in ravenclaw namespace
140-
// ensure egress to slytherin is DENIED from ravenclaw at port 9003; egressRule at index3
140+
// ensure egress to slytherin is DENIED from ravenclaw at port 9003; egressRule at index3 should take effect
141141
success := kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-0", "sctp",
142-
clientPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, false)
142+
serverPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, false)
143143
assert.Equal(t, true, success)
144144
// luna-lovegood-1 is our client pod in ravenclaw namespace
145145
// ensure egress to slytherin is ALLOWED from ravenclaw for rest of the traffic; matches no rules hence allowed
146146
success = kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-1", "sctp",
147-
clientPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
147+
serverPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
148148
assert.Equal(t, true, success)
149149
})
150150

@@ -153,11 +153,11 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
153153
defer cancel()
154154
// This test uses `egress-sctp` ANP
155155
// harry-potter-0 is our server pod in gryffindor namespace
156-
clientPod := &v1.Pod{}
156+
serverPod := &v1.Pod{}
157157
err := s.Client.Get(ctx, client.ObjectKey{
158158
Namespace: "network-policy-conformance-gryffindor",
159159
Name: "harry-potter-1",
160-
}, clientPod)
160+
}, serverPod)
161161
framework.ExpectNoError(err, "unable to fetch the server pod")
162162
anp := &v1alpha1.AdminNetworkPolicy{}
163163
err = s.Client.Get(ctx, client.ObjectKey{
@@ -174,11 +174,11 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
174174
// ensure egress is PASSED from gryffindor to ravenclaw
175175
// egressRule at index0 will take precedence over egressRule at index1&index2; thus PASS takes precedence over ALLOW/DENY since rules are ordered
176176
success := kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-0", "sctp",
177-
clientPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
177+
serverPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
178178
assert.Equal(t, true, success)
179179
// luna-lovegood-1 is our client pod in ravenclaw namespace
180180
success = kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-1", "sctp",
181-
clientPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
181+
serverPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
182182
assert.Equal(t, true, success)
183183
})
184184

@@ -187,11 +187,11 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
187187
defer cancel()
188188
// This test uses `egress-sctp` ANP
189189
// draco-malfoy-0 is our server pod in slytherin namespace
190-
clientPod := &v1.Pod{}
190+
serverPod := &v1.Pod{}
191191
err := s.Client.Get(ctx, client.ObjectKey{
192192
Namespace: "network-policy-conformance-slytherin",
193193
Name: "draco-malfoy-0",
194-
}, clientPod)
194+
}, serverPod)
195195
framework.ExpectNoError(err, "unable to fetch the server pod")
196196
anp := &v1alpha1.AdminNetworkPolicy{}
197197
err = s.Client.Get(ctx, client.ObjectKey{
@@ -205,14 +205,14 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
205205
err = s.Client.Update(ctx, anp)
206206
framework.ExpectNoError(err, "unable to update the admin network policy")
207207
// luna-lovegood-0 is our client pod in ravenclaw namespace
208-
// ensure egress to slytherin is PASSED from ravenclaw at port 9003; egressRule at index3
208+
// ensure egress to slytherin is PASSED from ravenclaw at port 9003; egressRule at index3 should take effect
209209
success := kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-0", "sctp",
210-
clientPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
210+
serverPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
211211
assert.Equal(t, true, success)
212212
// luna-lovegood-1 is our client pod in ravenclaw namespace
213213
// ensure egress to slytherin is ALLOWED from ravenclaw for rest of the traffic; matches no rules hence allowed
214214
success = kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-1", "sctp",
215-
clientPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
215+
serverPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
216216
assert.Equal(t, true, success)
217217
})
218218
},

conformance/tests/admin-network-policy-core-egress-tcp-rules.go

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
5050
defer cancel()
5151
// This test uses `egress-tcp` ANP
5252
// luna-lovegood-0 is our server pod in ravenclaw namespace
53-
clientPod := &v1.Pod{}
53+
serverPod := &v1.Pod{}
5454
err := s.Client.Get(ctx, client.ObjectKey{
5555
Namespace: "network-policy-conformance-ravenclaw",
5656
Name: "luna-lovegood-0",
57-
}, clientPod)
57+
}, serverPod)
5858
framework.ExpectNoError(err, "unable to fetch the server pod")
5959
// harry-potter-0 is our client pod in gryffindor namespace
6060
// ensure egress is ALLOWED to ravenclaw from gryffindor
6161
// egressRule at index0 will take precedence over egressRule at index1; thus ALLOW takes precedence over DENY since rules are ordered
6262
success := kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-0", "tcp",
63-
clientPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, true)
63+
serverPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, true)
6464
assert.Equal(t, true, success)
6565
success = kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-1", "tcp",
66-
clientPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
66+
serverPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
6767
assert.Equal(t, true, success)
6868
})
6969

@@ -72,21 +72,21 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
7272
defer cancel()
7373
// This test uses `egress-tcp` ANP
7474
// cedric-diggory-1 is our server pod in hufflepuff namespace
75-
clientPod := &v1.Pod{}
75+
serverPod := &v1.Pod{}
7676
err := s.Client.Get(ctx, client.ObjectKey{
7777
Namespace: "network-policy-conformance-hufflepuff",
7878
Name: "cedric-diggory-1",
79-
}, clientPod)
79+
}, serverPod)
8080
framework.ExpectNoError(err, "unable to fetch the server pod")
8181
// harry-potter-0 is our client pod in gryffindor namespace
82-
// ensure egress is ALLOWED to hufflepuff from gryffindor at port 80; egressRule at index5
82+
// ensure egress is ALLOWED to hufflepuff from gryffindor at port 80; egressRule at index5 should take effect
8383
success := kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-0", "tcp",
84-
clientPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
84+
serverPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
8585
assert.Equal(t, true, success)
8686
// harry-potter-1 is our client pod in gryffindor namespace
87-
// ensure egress is DENIED to hufflepuff from gryffindor for rest of the traffic; egressRule at index6
87+
// ensure egress is DENIED to hufflepuff from gryffindor for rest of the traffic; egressRule at index6 should take effect
8888
success = kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-1", "tcp",
89-
clientPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, false)
89+
serverPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, false)
9090
assert.Equal(t, true, success)
9191
})
9292

@@ -95,11 +95,11 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
9595
defer cancel()
9696
// This test uses `egress-tcp` ANP
9797
// luna-lovegood-1 is our server pod in ravenclaw namespace
98-
clientPod := &v1.Pod{}
98+
serverPod := &v1.Pod{}
9999
err := s.Client.Get(ctx, client.ObjectKey{
100100
Namespace: "network-policy-conformance-ravenclaw",
101101
Name: "luna-lovegood-1",
102-
}, clientPod)
102+
}, serverPod)
103103
framework.ExpectNoError(err, "unable to fetch the server pod")
104104
anp := &v1alpha1.AdminNetworkPolicy{}
105105
err = s.Client.Get(ctx, client.ObjectKey{
@@ -116,11 +116,11 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
116116
// ensure egress is DENIED to ravenclaw from gryffindor
117117
// egressRule at index0 will take precedence over egressRule at index1; thus DENY takes precedence over ALLOW since rules are ordered
118118
success := kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-0", "tcp",
119-
clientPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, false)
119+
serverPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, false)
120120
assert.Equal(t, true, success)
121121
// harry-potter-1 is our client pod in gryffindor namespace
122122
success = kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-1", "tcp",
123-
clientPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, false)
123+
serverPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, false)
124124
assert.Equal(t, true, success)
125125
})
126126

@@ -129,21 +129,21 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
129129
defer cancel()
130130
// This test uses `egress-tcp` ANP
131131
// draco-malfoy-0 is our server pod in slytherin namespace
132-
clientPod := &v1.Pod{}
132+
serverPod := &v1.Pod{}
133133
err := s.Client.Get(ctx, client.ObjectKey{
134134
Namespace: "network-policy-conformance-slytherin",
135135
Name: "draco-malfoy-0",
136-
}, clientPod)
136+
}, serverPod)
137137
framework.ExpectNoError(err, "unable to fetch the server pod")
138138
// harry-potter-0 is our client pod in gryffindor namespace
139-
// ensure egress to slytherin is DENIED from gryffindor at port 80; egressRule at index3
139+
// ensure egress to slytherin is DENIED from gryffindor at port 80; egressRule at index3 should take effect
140140
success := kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-0", "tcp",
141-
clientPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, false)
141+
serverPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, false)
142142
assert.Equal(t, true, success)
143143
// harry-potter-1 is our client pod in gryffindor namespace
144144
// ensure egress to slytherin is ALLOWED from gryffindor for rest of the traffic; matches no rules hence allowed
145145
success = kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-1", "tcp",
146-
clientPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
146+
serverPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
147147
assert.Equal(t, true, success)
148148
})
149149

@@ -152,11 +152,11 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
152152
defer cancel()
153153
// This test uses `egress-tcp` ANP
154154
// luna-lovegood-0 is our server pod in ravenclaw namespace
155-
clientPod := &v1.Pod{}
155+
serverPod := &v1.Pod{}
156156
err := s.Client.Get(ctx, client.ObjectKey{
157157
Namespace: "network-policy-conformance-ravenclaw",
158158
Name: "luna-lovegood-0",
159-
}, clientPod)
159+
}, serverPod)
160160
framework.ExpectNoError(err, "unable to fetch the server pod")
161161
anp := &v1alpha1.AdminNetworkPolicy{}
162162
err = s.Client.Get(ctx, client.ObjectKey{
@@ -173,11 +173,11 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
173173
// ensure egress is PASSED from gryffindor to ravenclaw
174174
// egressRule at index0 will take precedence over egressRule at index1&index2; thus PASS takes precedence over ALLOW/DENY since rules are ordered
175175
success := kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-0", "tcp",
176-
clientPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, true)
176+
serverPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, true)
177177
assert.Equal(t, true, success)
178178
// harry-potter-1 is our server pod in gryffindor namespace
179179
success = kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-1", "tcp",
180-
clientPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
180+
serverPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
181181
assert.Equal(t, true, success)
182182
})
183183

@@ -186,11 +186,11 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
186186
defer cancel()
187187
// This test uses `egress-tcp` ANP
188188
// draco-malfoy-0 is our server pod in slytherin namespace
189-
clientPod := &v1.Pod{}
189+
serverPod := &v1.Pod{}
190190
err := s.Client.Get(ctx, client.ObjectKey{
191191
Namespace: "network-policy-conformance-slytherin",
192192
Name: "draco-malfoy-0",
193-
}, clientPod)
193+
}, serverPod)
194194
framework.ExpectNoError(err, "unable to fetch the server pod")
195195
anp := &v1alpha1.AdminNetworkPolicy{}
196196
err = s.Client.Get(ctx, client.ObjectKey{
@@ -204,14 +204,14 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
204204
err = s.Client.Update(ctx, anp)
205205
framework.ExpectNoError(err, "unable to update the admin network policy")
206206
// harry-potter-0 is our client pod in gryffindor namespace
207-
// ensure egress from gryffindor is PASSED to slytherin at port 80; egressRule at index3
207+
// ensure egress from gryffindor is PASSED to slytherin at port 80; egressRule at index3 should take effect
208208
success := kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-0", "tcp",
209-
clientPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, true)
209+
serverPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, true)
210210
assert.Equal(t, true, success)
211211
// harry-potter-1 is our client pod in gryffindor namespace
212212
// ensure egress from gryffindor is ALLOWED to slytherin for rest of the traffic; matches no rules hence allowed
213213
success = kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-1", "tcp",
214-
clientPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
214+
serverPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
215215
assert.Equal(t, true, success)
216216
})
217217
},

0 commit comments

Comments
 (0)