Skip to content

Commit c432c06

Browse files
committed
refactor
Signed-off-by: Coleen Iona Quadros <[email protected]>
1 parent c418dba commit c432c06

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

tests/pkg/tests/observability_rbac_test.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var _ = Describe("Observability:", Ordered, func() {
2828
It("RHACM4K-1406 - Observability - RBAC - only authorized user could query managed cluster metrics data [Observability][Integration]@ocpInterop @non-ui-post-restore @non-ui-post-release @non-ui-pre-upgrade @non-ui-post-upgrade @post-upgrade @post-restore @e2e @post-release (requires-ocp/g0) (obs_rbac/g0)", func() {
2929
By("Logging in as admin and querying managed cluster metrics data", func() {
3030
Eventually(func() error {
31-
err = utils.LoginOCUser(testOptions, "e2eadmin", "e2eadmin")
31+
err = utils.LoginOCUser(testOptions, "admin", "admin")
3232
if err != nil {
3333
klog.Errorf("Failed to login as admin: %v", err)
3434
return err
@@ -83,7 +83,7 @@ var _ = Describe("Observability:", Ordered, func() {
8383
})
8484

8585
It("RHACM4K-1439 - Observability - RBAC - Verify only cluster-manager-admin role can deploy MCO CR [Observability][Integration]@ocpInterop @non-ui-post-restore @non-ui-post-release @non-ui-pre-upgrade @non-ui-post-upgrade @post-upgrade @post-restore @e2e @post-release (requires-ocp/g0) (obs_rbac/g0)", func() {
86-
By("Logging as kube:admin checking if MCO can be deleted by user1 and e2eadmin", func() {
86+
By("Logging as kube:admin checking if MCO can be deleted by user1 and admin", func() {
8787
Eventually(func() error {
8888
_, err = exec.Command("oc", "config", "use-context", testOptions.HubCluster.KubeContext).CombinedOutput()
8989
if err != nil {
@@ -100,8 +100,8 @@ var _ = Describe("Observability:", Ordered, func() {
100100
if bytes.Contains(out.Bytes(), []byte("user1")) {
101101
return fmt.Errorf("user1 can delete multiclusterobservabilities.observability.open-cluster-management.io CR")
102102
}
103-
if !bytes.Contains(out.Bytes(), []byte("e2eadmin")) {
104-
return fmt.Errorf("e2eadmin can't delete multiclusterobservabilities.observability.open-cluster-management.io CR")
103+
if !bytes.Contains(out.Bytes(), []byte("admin")) {
104+
return fmt.Errorf("admin can't delete multiclusterobservabilities.observability.open-cluster-management.io CR")
105105
}
106106
return nil
107107
}, EventuallyTimeoutMinute*1, EventuallyIntervalSecond*5).Should(Succeed())
@@ -110,7 +110,6 @@ var _ = Describe("Observability:", Ordered, func() {
110110

111111
AfterEach(func() {
112112
os.Unsetenv("USER_TOKEN")
113-
_, _ = exec.Command("oc", "config", "use-context", testOptions.HubCluster.KubeContext).CombinedOutput()
114113
if CurrentSpecReport().Failed() {
115114
utils.LogFailingTestStandardDebugInfo(testOptions)
116115
}

tests/setup_rbac_test.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
create_test_users() {
66
echo CREATING USER PASSWORDS SECRET
7-
htpasswd -c -B -b users.htpasswd e2eadmin e2eadmin
7+
htpasswd -c -B -b users.htpasswd admin admin
88
htpasswd -B -b users.htpasswd user1 user1
99
oc create ns openshift-config
1010
oc delete secret htpass-user-test -n openshift-config &>/dev/null
@@ -34,7 +34,7 @@ EOL
3434

3535
create_role_bindings() {
3636
echo CREATING ROLE BINDINGS
37-
oc create clusterrolebinding cluster-manager-admin-binding --clusterrole=open-cluster-management:cluster-manager-admin --user=e2eadmin
37+
oc create clusterrolebinding cluster-manager-admin-binding --clusterrole=open-cluster-management:cluster-manager-admin --user=admin
3838
oc create rolebinding view-binding-user1 --clusterrole=view --user=user1 -n local-cluster
3939
}
4040

0 commit comments

Comments
 (0)