Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some nits in conformance package #124

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions conformance/tests/admin-network-policy-core-egress-sctp-rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
defer cancel()
// This test uses `egress-sctp` ANP
// harry-potter-0 is our server pod in gryffindor namespace
clientPod := &v1.Pod{}
serverPod := &v1.Pod{}
err := s.Client.Get(ctx, client.ObjectKey{
Namespace: "network-policy-conformance-gryffindor",
Name: "harry-potter-0",
}, clientPod)
}, serverPod)
framework.ExpectNoError(err, "unable to fetch the server pod")
// luna-lovegood-0 is our client pod in ravenclaw namespace
// ensure egress is ALLOWED to gryffindor from ravenclaw
// egressRule at index0 will take precedence over egressRule at index1; thus ALLOW takes precedence over DENY since rules are ordered
success := kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-0", "sctp",
clientPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
serverPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
assert.Equal(t, true, success)
// luna-lovegood-1 is our client pod in ravenclaw namespace
success = kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-1", "sctp",
clientPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
serverPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
assert.Equal(t, true, success)
})

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

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

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

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

Expand All @@ -187,11 +187,11 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
defer cancel()
// This test uses `egress-sctp` ANP
// draco-malfoy-0 is our server pod in slytherin namespace
clientPod := &v1.Pod{}
serverPod := &v1.Pod{}
err := s.Client.Get(ctx, client.ObjectKey{
Namespace: "network-policy-conformance-slytherin",
Name: "draco-malfoy-0",
}, clientPod)
}, serverPod)
framework.ExpectNoError(err, "unable to fetch the server pod")
anp := &v1alpha1.AdminNetworkPolicy{}
err = s.Client.Get(ctx, client.ObjectKey{
Expand All @@ -205,14 +205,14 @@ var AdminNetworkPolicyEgressSCTP = suite.ConformanceTest{
err = s.Client.Update(ctx, anp)
framework.ExpectNoError(err, "unable to update the admin network policy")
// luna-lovegood-0 is our client pod in ravenclaw namespace
// ensure egress to slytherin is PASSED from ravenclaw at port 9003; egressRule at index3
// ensure egress to slytherin is PASSED from ravenclaw at port 9003; egressRule at index3 should take effect
success := kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-0", "sctp",
clientPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
serverPod.Status.PodIP, int32(9003), s.TimeoutConfig.RequestTimeout, true)
assert.Equal(t, true, success)
// luna-lovegood-1 is our client pod in ravenclaw namespace
// ensure egress to slytherin is ALLOWED from ravenclaw for rest of the traffic; matches no rules hence allowed
success = kubernetes.PokeServer(t, "network-policy-conformance-ravenclaw", "luna-lovegood-1", "sctp",
clientPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
serverPod.Status.PodIP, int32(9005), s.TimeoutConfig.RequestTimeout, true)
assert.Equal(t, true, success)
})
},
Expand Down
56 changes: 28 additions & 28 deletions conformance/tests/admin-network-policy-core-egress-tcp-rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
defer cancel()
// This test uses `egress-tcp` ANP
// luna-lovegood-0 is our server pod in ravenclaw namespace
clientPod := &v1.Pod{}
serverPod := &v1.Pod{}
err := s.Client.Get(ctx, client.ObjectKey{
Namespace: "network-policy-conformance-ravenclaw",
Name: "luna-lovegood-0",
}, clientPod)
}, serverPod)
framework.ExpectNoError(err, "unable to fetch the server pod")
// harry-potter-0 is our client pod in gryffindor namespace
// ensure egress is ALLOWED to ravenclaw from gryffindor
// egressRule at index0 will take precedence over egressRule at index1; thus ALLOW takes precedence over DENY since rules are ordered
success := kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-0", "tcp",
clientPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, true)
serverPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, true)
assert.Equal(t, true, success)
success = kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-1", "tcp",
clientPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
serverPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
assert.Equal(t, true, success)
})

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

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

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

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

Expand All @@ -186,11 +186,11 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
defer cancel()
// This test uses `egress-tcp` ANP
// draco-malfoy-0 is our server pod in slytherin namespace
clientPod := &v1.Pod{}
serverPod := &v1.Pod{}
err := s.Client.Get(ctx, client.ObjectKey{
Namespace: "network-policy-conformance-slytherin",
Name: "draco-malfoy-0",
}, clientPod)
}, serverPod)
framework.ExpectNoError(err, "unable to fetch the server pod")
anp := &v1alpha1.AdminNetworkPolicy{}
err = s.Client.Get(ctx, client.ObjectKey{
Expand All @@ -204,14 +204,14 @@ var AdminNetworkPolicyEgressTCP = suite.ConformanceTest{
err = s.Client.Update(ctx, anp)
framework.ExpectNoError(err, "unable to update the admin network policy")
// harry-potter-0 is our client pod in gryffindor namespace
// ensure egress from gryffindor is PASSED to slytherin at port 80; egressRule at index3
// ensure egress from gryffindor is PASSED to slytherin at port 80; egressRule at index3 should take effect
success := kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-0", "tcp",
clientPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, true)
serverPod.Status.PodIP, int32(80), s.TimeoutConfig.RequestTimeout, true)
assert.Equal(t, true, success)
// harry-potter-1 is our client pod in gryffindor namespace
// ensure egress from gryffindor is ALLOWED to slytherin for rest of the traffic; matches no rules hence allowed
success = kubernetes.PokeServer(t, "network-policy-conformance-gryffindor", "harry-potter-1", "tcp",
clientPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
serverPod.Status.PodIP, int32(8080), s.TimeoutConfig.RequestTimeout, true)
assert.Equal(t, true, success)
})
},
Expand Down
Loading