From 1109db2d099d622b6d86f3699a18fc11843e0626 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Fri, 21 Dec 2018 19:30:34 -0300 Subject: [PATCH] Add e2e test --- test/e2e/settings/pod_security_policy.go | 41 +++++++++++++----------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/test/e2e/settings/pod_security_policy.go b/test/e2e/settings/pod_security_policy.go index 9dfe226cb..5eb9bfd8b 100644 --- a/test/e2e/settings/pod_security_policy.go +++ b/test/e2e/settings/pod_security_policy.go @@ -75,29 +75,32 @@ var _ = framework.IngressNginxDescribe("Pod Security Policies", func() { f.NewEchoDeployment() }) - AfterEach(func() { - role, err := f.KubeClientSet.RbacV1().ClusterRoles().Get("nginx-ingress-clusterrole", metav1.GetOptions{}) - Expect(err).NotTo(HaveOccurred(), "getting ingress controller cluster role") - Expect(role).NotTo(BeNil()) + // running tests in parallel can update the cluster roles, which introduce a failure + /* + AfterEach(func() { + role, err := f.KubeClientSet.RbacV1().ClusterRoles().Get("nginx-ingress-clusterrole", metav1.GetOptions{}) + Expect(err).NotTo(HaveOccurred(), "getting ingress controller cluster role") + Expect(role).NotTo(BeNil()) - index := -1 - for idx, rule := range role.Rules { - found := false - for _, rn := range rule.ResourceNames { - if rn == ingressControllerPSP { - found = true - break + index := -1 + for idx, rule := range role.Rules { + found := false + for _, rn := range rule.ResourceNames { + if rn == ingressControllerPSP { + found = true + break + } + } + if found { + index = idx } } - if found { - index = idx - } - } - role.Rules = append(role.Rules[:index], role.Rules[index+1:]...) - _, err = f.KubeClientSet.RbacV1().ClusterRoles().Update(role) - Expect(err).NotTo(HaveOccurred(), "updating ingress controller cluster role to use a pod security policy") - }) + role.Rules = append(role.Rules[:index], role.Rules[index+1:]...) + _, err = f.KubeClientSet.RbacV1().ClusterRoles().Update(role) + Expect(err).NotTo(HaveOccurred(), "updating ingress controller cluster role to use a pod security policy") + }) + */ It("should be running with a Pod Security Policy", func() { f.WaitForNginxConfiguration(