Skip to content

Commit 5bd8a74

Browse files
committed
OCPBUGS-77762: Add an e2e to check the default network polocy
1 parent 54dc4ef commit 5bd8a74

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

test/cvo/cvo.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ var _ = g.Describe(`[Jira:"Cluster Version Operator"] cluster-version-operator`,
5757
o.Expect(err).NotTo(o.HaveOccurred(), "Failed to create Kubernetes client")
5858
})
5959

60+
g.It("should have a network policy", g.Label("OCPBUGS-77762"), func() {
61+
ctx := context.Background()
62+
err := util.SkipIfHypershift(ctx, restCfg)
63+
o.Expect(err).NotTo(o.HaveOccurred(), "Failed to determine if cluster is HyperShift")
64+
err = util.SkipIfMicroshift(ctx, restCfg)
65+
o.Expect(err).NotTo(o.HaveOccurred(), "Failed to determine if cluster is MicroShift")
66+
67+
g.By("Checking if the default network policy exists on the namespace")
68+
if _, err := kubeClient.NetworkingV1().NetworkPolicies(external.DefaultCVONamespace).
69+
Get(ctx, "default-deny", metav1.GetOptions{}); err != nil {
70+
o.Expect(err).NotTo(o.HaveOccurred(), "Failed to get the default network policy")
71+
}
72+
})
73+
6074
// Migrated from case NonHyperShiftHOST-Author:jiajliu-Low-46922-check runlevel and scc in cvo ns
6175
// Refer to https://github.com/openshift/openshift-tests-private/blob/40374cf20946ff03c88712839a5626af2c88ab31/test/extended/ota/cvo/cvo.go#L1081
6276
g.It("should have correct runlevel and scc", func() {

0 commit comments

Comments
 (0)