@@ -33,6 +33,7 @@ import (
33
33
func init () {
34
34
ConformanceTests = append (ConformanceTests ,
35
35
AdminNetworkPolicyEgressTCP ,
36
+ AdminNetworkPolicyEgressNamedPort ,
36
37
)
37
38
}
38
39
@@ -61,10 +62,10 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
61
62
// egressRule at index0 will take precedence over egressRule at index1; thus ALLOW takes precedence over DENY since rules are ordered
62
63
success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
63
64
serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , true )
64
- assert .Equal ( t , true , success )
65
+ assert .True ( t , success )
65
66
success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
66
67
serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , true )
67
- assert .Equal ( t , true , success )
68
+ assert .True ( t , success )
68
69
})
69
70
70
71
t .Run ("Should support an 'allow-egress' policy for TCP protocol at the specified port" , func (t * testing.T ) {
@@ -79,15 +80,15 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
79
80
}, serverPod )
80
81
require .NoErrorf (t , err , "unable to fetch the server pod" )
81
82
// 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 should take effect
83
+ // ensure egress is ALLOWED to hufflepuff from gryffindor at port 8080 ; egressRule at index5 should take effect
83
84
success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
84
85
serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , true )
85
- assert .Equal ( t , true , success )
86
+ assert .True ( t , success )
86
87
// harry-potter-1 is our client pod in gryffindor namespace
87
88
// ensure egress is DENIED to hufflepuff from gryffindor for rest of the traffic; egressRule at index6 should take effect
88
89
success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
89
90
serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , false )
90
- assert .Equal ( t , true , success )
91
+ assert .True ( t , success )
91
92
})
92
93
93
94
t .Run ("Should support an 'deny-egress' policy for TCP protocol; ensure rule ordering is respected" , func (t * testing.T ) {
@@ -117,11 +118,11 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
117
118
// egressRule at index0 will take precedence over egressRule at index1; thus DENY takes precedence over ALLOW since rules are ordered
118
119
success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
119
120
serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , false )
120
- assert .Equal ( t , true , success )
121
+ assert .True ( t , success )
121
122
// harry-potter-1 is our client pod in gryffindor namespace
122
123
success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
123
124
serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , false )
124
- assert .Equal ( t , true , success )
125
+ assert .True ( t , success )
125
126
})
126
127
127
128
t .Run ("Should support a 'deny-egress' policy for TCP protocol at the specified port" , func (t * testing.T ) {
@@ -139,12 +140,12 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
139
140
// ensure egress to slytherin is DENIED from gryffindor at port 80; egressRule at index3 should take effect
140
141
success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
141
142
serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , false )
142
- assert .Equal ( t , true , success )
143
+ assert .True ( t , success )
143
144
// harry-potter-1 is our client pod in gryffindor namespace
144
145
// ensure egress to slytherin is ALLOWED from gryffindor for rest of the traffic; matches no rules hence allowed
145
146
success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
146
147
serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , true )
147
- assert .Equal ( t , true , success )
148
+ assert .True ( t , success )
148
149
})
149
150
150
151
t .Run ("Should support an 'pass-egress' policy for TCP protocol; ensure rule ordering is respected" , func (t * testing.T ) {
@@ -174,11 +175,11 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
174
175
// egressRule at index0 will take precedence over egressRule at index1&index2; thus PASS takes precedence over ALLOW/DENY since rules are ordered
175
176
success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
176
177
serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , true )
177
- assert .Equal ( t , true , success )
178
+ assert .True ( t , success )
178
179
// harry-potter-1 is our server pod in gryffindor namespace
179
180
success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
180
181
serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , true )
181
- assert .Equal ( t , true , success )
182
+ assert .True ( t , success )
182
183
})
183
184
184
185
t .Run ("Should support a 'pass-egress' policy for TCP protocol at the specified port" , func (t * testing.T ) {
@@ -207,12 +208,12 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
207
208
// ensure egress from gryffindor is PASSED to slytherin at port 80; egressRule at index3 should take effect
208
209
success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
209
210
serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , true )
210
- assert .Equal ( t , true , success )
211
+ assert .True ( t , success )
211
212
// harry-potter-1 is our client pod in gryffindor namespace
212
213
// ensure egress from gryffindor is ALLOWED to slytherin for rest of the traffic; matches no rules hence allowed
213
214
success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
214
215
serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , true )
215
- assert .Equal ( t , true , success )
216
+ assert .True ( t , success )
216
217
})
217
218
},
218
219
}
0 commit comments