Skip to content
This repository was archived by the owner on Mar 26, 2021. It is now read-only.

Commit 8ec3a68

Browse files
authored
Merge pull request #209 from onyiny-ang/master
validates contents contained in createdRBACObj in aggregated test
2 parents 0309542 + a15c7d1 commit 8ec3a68

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

pkg/crinit/aggregated/aggregated_test.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package aggregated
1818

1919
import (
2020
"bytes"
21+
"strings"
2122
"testing"
2223

2324
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -29,9 +30,11 @@ import (
2930
)
3031

3132
var (
32-
apiSvcName = v1alpha1.SchemeGroupVersion.Version + "." + v1alpha1.GroupName
33-
apiGroup = v1alpha1.GroupName
34-
apiVersion = v1alpha1.SchemeGroupVersion.Version
33+
apiServerName = strings.Replace(v1alpha1.GroupName, ".", "-", -1) + "-apiserver"
34+
crLabel = strings.Split(v1alpha1.GroupName, ".")[0]
35+
apiSvcName = v1alpha1.SchemeGroupVersion.Version + "." + v1alpha1.GroupName
36+
apiGroup = v1alpha1.GroupName
37+
apiVersion = v1alpha1.SchemeGroupVersion.Version
3538
)
3639

3740
func TestCreateRBACObjects(t *testing.T) {
@@ -76,6 +79,15 @@ func TestCreateRBACObjects(t *testing.T) {
7679
if createdRBACObj == nil {
7780
t.Errorf("Failed to create RBAC Object")
7881
}
82+
if createdRBACObj.ObjectMeta.Name != apiServerName {
83+
t.Errorf("Unexpected API Server Created. Expected %v, got %v", apiServerName, createdRBACObj.ObjectMeta.Name)
84+
}
85+
if createdRBACObj.ObjectMeta.Namespace != tc.opts.ClusterRegistryNamespace {
86+
t.Errorf("Namespace contents do not match")
87+
}
88+
if createdRBACObj.ObjectMeta.Labels["app"] != crLabel {
89+
t.Errorf("Unexpected Label given to test instance. Expected %v, got %v", crLabel, createdRBACObj.ObjectMeta.Labels["app"])
90+
}
7991
} else {
8092
if createdRBACObj != nil {
8193
t.Errorf("Expected no RBAC Object but got: %v", createdRBACObj)

0 commit comments

Comments
 (0)