forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnamespace_policy_test.go
46 lines (40 loc) · 1.08 KB
/
namespace_policy_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package bootstrappolicy
import (
"strings"
"testing"
"k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/bootstrappolicy"
)
func TestOpenshiftNamespacePolicyNamespaces(t *testing.T) {
for ns := range namespaceRoles {
if ns == DefaultOpenShiftSharedResourcesNamespace {
continue
}
if strings.HasPrefix(ns, "openshift-") {
continue
}
t.Errorf("bootstrap role in %q,but must be under %q", ns, "openshift-")
}
for ns := range namespaceRoleBindings {
if ns == DefaultOpenShiftSharedResourcesNamespace {
continue
}
if strings.HasPrefix(ns, "openshift-") {
continue
}
t.Errorf("bootstrap rolebinding in %q,but must be under %q", ns, "openshift-")
}
}
func TestKubeNamespacePolicyNamespaces(t *testing.T) {
for ns := range bootstrappolicy.NamespaceRoles() {
if strings.HasPrefix(ns, "kube-") {
continue
}
t.Errorf("bootstrap role in %q,but must be under %q", ns, "kube-")
}
for ns := range bootstrappolicy.NamespaceRoles() {
if strings.HasPrefix(ns, "kube-") {
continue
}
t.Errorf("bootstrap rolebinding in %q,but must be under %q", ns, "kube-")
}
}