Add e2e test

This commit is contained in:
Manuel Alejandro de Brito Fontes 2018-12-21 19:30:34 -03:00
parent 9be174738d
commit 1109db2d09

View file

@ -75,29 +75,32 @@ var _ = framework.IngressNginxDescribe("Pod Security Policies", func() {
f.NewEchoDeployment() f.NewEchoDeployment()
}) })
AfterEach(func() { // running tests in parallel can update the cluster roles, which introduce a failure
role, err := f.KubeClientSet.RbacV1().ClusterRoles().Get("nginx-ingress-clusterrole", metav1.GetOptions{}) /*
Expect(err).NotTo(HaveOccurred(), "getting ingress controller cluster role") AfterEach(func() {
Expect(role).NotTo(BeNil()) 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 index := -1
for idx, rule := range role.Rules { for idx, rule := range role.Rules {
found := false found := false
for _, rn := range rule.ResourceNames { for _, rn := range rule.ResourceNames {
if rn == ingressControllerPSP { if rn == ingressControllerPSP {
found = true found = true
break break
}
}
if found {
index = idx
} }
} }
if found {
index = idx
}
}
role.Rules = append(role.Rules[:index], role.Rules[index+1:]...) role.Rules = append(role.Rules[:index], role.Rules[index+1:]...)
_, err = f.KubeClientSet.RbacV1().ClusterRoles().Update(role) _, err = f.KubeClientSet.RbacV1().ClusterRoles().Update(role)
Expect(err).NotTo(HaveOccurred(), "updating ingress controller cluster role to use a pod security policy") 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() { It("should be running with a Pod Security Policy", func() {
f.WaitForNginxConfiguration( f.WaitForNginxConfiguration(