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

Commit

Permalink
Merge pull request #209 from onyiny-ang/master
Browse files Browse the repository at this point in the history
validates contents contained in createdRBACObj in aggregated test
  • Loading branch information
k8s-ci-robot committed Apr 11, 2018
2 parents 0309542 + a15c7d1 commit 8ec3a68
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pkg/crinit/aggregated/aggregated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package aggregated

import (
"bytes"
"strings"
"testing"

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

var (
apiSvcName = v1alpha1.SchemeGroupVersion.Version + "." + v1alpha1.GroupName
apiGroup = v1alpha1.GroupName
apiVersion = v1alpha1.SchemeGroupVersion.Version
apiServerName = strings.Replace(v1alpha1.GroupName, ".", "-", -1) + "-apiserver"
crLabel = strings.Split(v1alpha1.GroupName, ".")[0]
apiSvcName = v1alpha1.SchemeGroupVersion.Version + "." + v1alpha1.GroupName
apiGroup = v1alpha1.GroupName
apiVersion = v1alpha1.SchemeGroupVersion.Version
)

func TestCreateRBACObjects(t *testing.T) {
Expand Down Expand Up @@ -76,6 +79,15 @@ func TestCreateRBACObjects(t *testing.T) {
if createdRBACObj == nil {
t.Errorf("Failed to create RBAC Object")
}
if createdRBACObj.ObjectMeta.Name != apiServerName {
t.Errorf("Unexpected API Server Created. Expected %v, got %v", apiServerName, createdRBACObj.ObjectMeta.Name)
}
if createdRBACObj.ObjectMeta.Namespace != tc.opts.ClusterRegistryNamespace {
t.Errorf("Namespace contents do not match")
}
if createdRBACObj.ObjectMeta.Labels["app"] != crLabel {
t.Errorf("Unexpected Label given to test instance. Expected %v, got %v", crLabel, createdRBACObj.ObjectMeta.Labels["app"])
}
} else {
if createdRBACObj != nil {
t.Errorf("Expected no RBAC Object but got: %v", createdRBACObj)
Expand Down

0 comments on commit 8ec3a68

Please sign in to comment.