@@ -33,6 +33,7 @@ import (
3333func init () {
3434 ConformanceTests = append (ConformanceTests ,
3535 AdminNetworkPolicyEgressTCP ,
36+ AdminNetworkPolicyEgressNamedPort ,
3637 )
3738}
3839
@@ -61,10 +62,10 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
6162 // egressRule at index0 will take precedence over egressRule at index1; thus ALLOW takes precedence over DENY since rules are ordered
6263 success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
6364 serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , true )
64- assert .Equal ( t , true , success )
65+ assert .True ( t , success )
6566 success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
6667 serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , true )
67- assert .Equal ( t , true , success )
68+ assert .True ( t , success )
6869 })
6970
7071 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{
7980 }, serverPod )
8081 require .NoErrorf (t , err , "unable to fetch the server pod" )
8182 // 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
8384 success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
8485 serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , true )
85- assert .Equal ( t , true , success )
86+ assert .True ( t , success )
8687 // harry-potter-1 is our client pod in gryffindor namespace
8788 // ensure egress is DENIED to hufflepuff from gryffindor for rest of the traffic; egressRule at index6 should take effect
8889 success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
8990 serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , false )
90- assert .Equal ( t , true , success )
91+ assert .True ( t , success )
9192 })
9293
9394 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{
117118 // egressRule at index0 will take precedence over egressRule at index1; thus DENY takes precedence over ALLOW since rules are ordered
118119 success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
119120 serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , false )
120- assert .Equal ( t , true , success )
121+ assert .True ( t , success )
121122 // harry-potter-1 is our client pod in gryffindor namespace
122123 success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
123124 serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , false )
124- assert .Equal ( t , true , success )
125+ assert .True ( t , success )
125126 })
126127
127128 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{
139140 // ensure egress to slytherin is DENIED from gryffindor at port 80; egressRule at index3 should take effect
140141 success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
141142 serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , false )
142- assert .Equal ( t , true , success )
143+ assert .True ( t , success )
143144 // harry-potter-1 is our client pod in gryffindor namespace
144145 // ensure egress to slytherin is ALLOWED from gryffindor for rest of the traffic; matches no rules hence allowed
145146 success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
146147 serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , true )
147- assert .Equal ( t , true , success )
148+ assert .True ( t , success )
148149 })
149150
150151 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{
174175 // egressRule at index0 will take precedence over egressRule at index1&index2; thus PASS takes precedence over ALLOW/DENY since rules are ordered
175176 success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
176177 serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , true )
177- assert .Equal ( t , true , success )
178+ assert .True ( t , success )
178179 // harry-potter-1 is our server pod in gryffindor namespace
179180 success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
180181 serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , true )
181- assert .Equal ( t , true , success )
182+ assert .True ( t , success )
182183 })
183184
184185 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{
207208 // ensure egress from gryffindor is PASSED to slytherin at port 80; egressRule at index3 should take effect
208209 success := kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-0" , "tcp" ,
209210 serverPod .Status .PodIP , int32 (80 ), s .TimeoutConfig .RequestTimeout , true )
210- assert .Equal ( t , true , success )
211+ assert .True ( t , success )
211212 // harry-potter-1 is our client pod in gryffindor namespace
212213 // ensure egress from gryffindor is ALLOWED to slytherin for rest of the traffic; matches no rules hence allowed
213214 success = kubernetes .PokeServer (t , s .ClientSet , & s .KubeConfig , "network-policy-conformance-gryffindor" , "harry-potter-1" , "tcp" ,
214215 serverPod .Status .PodIP , int32 (8080 ), s .TimeoutConfig .RequestTimeout , true )
215- assert .Equal ( t , true , success )
216+ assert .True ( t , success )
216217 })
217218 },
218219}
0 commit comments