Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
k8sFixture "github.com/redhat-developer/gitops-operator/test/openshift/e2e/ginkgo/fixture/k8s"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -29,9 +30,42 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
Eventually(depl).Should(k8sFixture.ExistByName())
Eventually(depl, "60s", "3s").Should(deploymentFixture.HaveReplicas(1))
Eventually(depl, "60s", "3s").Should(deploymentFixture.HaveReadyReplicas(1))
Expect(depl.Spec.Template.Spec.ServiceAccountName).To(Equal("gitops-service-cluster"))
Expect(depl.Spec.Template.Spec.DeprecatedServiceAccount).To(Equal("gitops-service-cluster"))

By("checking Service for cluster exists")
Eventually(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Name: "cluster", Namespace: "openshift-gitops"}}, "60s", "5s").Should(k8sFixture.ExistByName())

By("checking the cluster ServiceAccount, ClusterRole, and ClusterRoleBinding have the expected values")
Eventually(&corev1.ServiceAccount{ObjectMeta: metav1.ObjectMeta{Name: "gitops-service-cluster", Namespace: "openshift-gitops"}}).Should(k8sFixture.ExistByName())

cr := &rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "gitops-service-cluster"}}
Eventually(cr).Should(k8sFixture.ExistByName())
Expect(cr.Rules).To(Equal([]rbacv1.PolicyRule{
{
APIGroups: []string{"argoproj.io"},
Resources: []string{"applications"},
Verbs: []string{"get", "list", "watch"},
},
{
APIGroups: []string{""},
Resources: []string{"secrets"},
Verbs: []string{"get", "list", "watch"},
},
}))

crb := &rbacv1.ClusterRoleBinding{ObjectMeta: metav1.ObjectMeta{Name: "gitops-service-cluster"}}
Eventually(crb).Should(k8sFixture.ExistByName())
Expect(crb.RoleRef).To(Equal(rbacv1.RoleRef{
APIGroup: "rbac.authorization.k8s.io",
Kind: "ClusterRole",
Name: "gitops-service-cluster",
}))
Expect(crb.Subjects).To(Equal([]rbacv1.Subject{{
Kind: "ServiceAccount",
Name: "gitops-service-cluster",
Namespace: "openshift-gitops"},
}))
})
})
})

This file was deleted.

This file was deleted.

This file was deleted.

Loading