Skip to content

Commit

Permalink
WIP:tests
Browse files Browse the repository at this point in the history
Signed-off-by: Simo Sorce <[email protected]>
  • Loading branch information
simo5 committed Jul 23, 2018
1 parent 4a226f8 commit dac5244
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions test/integration/authorization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ func TestAuthorizationSubjectAccessReviewAPIGroup(t *testing.T) {
kubeAuthInterface: clusterAdminSARGetter,
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: true,
Reason: "allowed by openshift authorizer",
Reason: `RBAC: allowed by RoleBinding "admin/hammer-project" of ClusterRole "admin" to User "harold"`,
Namespace: "hammer-project",
},
}.run(t)
Expand All @@ -889,7 +889,7 @@ func TestAuthorizationSubjectAccessReviewAPIGroup(t *testing.T) {
kubeAuthInterface: clusterAdminSARGetter,
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: false,
Reason: `User "harold" cannot get horizontalpodautoscalers in project "hammer-project"`,
Reason: ``,
Namespace: "hammer-project",
},
}.run(t)
Expand All @@ -903,7 +903,7 @@ func TestAuthorizationSubjectAccessReviewAPIGroup(t *testing.T) {
kubeAuthInterface: clusterAdminKubeClient.Authorization(),
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: false,
Reason: `User "harold" cannot get horizontalpodautoscalers.foo in project "hammer-project"`,
Reason: ``,
Namespace: "hammer-project",
},
}.run(t)
Expand All @@ -917,7 +917,7 @@ func TestAuthorizationSubjectAccessReviewAPIGroup(t *testing.T) {
kubeAuthInterface: clusterAdminSARGetter,
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: false,
Reason: `User "harold" cannot get horizontalpodautoscalers.* in project "hammer-project"`,
Reason: ``,
Namespace: "hammer-project",
},
}.run(t)
Expand Down Expand Up @@ -1068,7 +1068,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
kubeAuthInterface: clusterAdminLocalSARGetter,
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: true,
Reason: "allowed by openshift authorizer",
Reason: `RBAC: allowed by RoleBinding "view/default" of ClusterRole "view" to User "danny"`,
Namespace: "default",
},
}.run(t)
Expand Down Expand Up @@ -1133,7 +1133,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
kubeAuthInterface: haroldSARGetter,
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: true,
Reason: "allowed by openshift authorizer",
Reason: `RBAC: allowed by RoleBinding "view/hammer-project" of ClusterRole "view" to User "valerie"`,
Namespace: "hammer-project",
},
}.run(t)
Expand All @@ -1160,7 +1160,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
kubeAuthInterface: markSARGetter,
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: true,
Reason: "allowed by openshift authorizer",
Reason: `RBAC: allowed by RoleBinding "edit/mallet-project" of ClusterRole "edit" to User "edgar"`,
Namespace: "mallet-project",
},
}.run(t)
Expand Down Expand Up @@ -1214,7 +1214,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
kubeAuthInterface: haroldSARGetter,
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: true,
Reason: "allowed by openshift authorizer",
Reason: `RBAC: allowed by RoleBinding "admin/hammer-project" of ClusterRole "admin" to User "harold"`,
Namespace: "hammer-project",
},
}.run(t)
Expand Down Expand Up @@ -1253,7 +1253,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
kubeAuthInterface: haroldSARGetter,
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: true,
Reason: "allowed by openshift authorizer",
Reason: `RBAC: allowed by RoleBinding "admin/hammer-project" of ClusterRole "admin" to User "harold"`,
Namespace: "hammer-project",
},
}.run(t)
Expand All @@ -1264,7 +1264,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
kubeAuthInterface: anonymousSARGetter,
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: true,
Reason: "allowed by openshift authorizer",
Reason: `RBAC: allowed by RoleBinding "edit/hammer-project" of ClusterRole "edit" to User "system:anonymous"`,
Namespace: "hammer-project",
},
}.run(t)
Expand Down Expand Up @@ -1368,8 +1368,8 @@ func TestBrowserSafeAuthorizer(t *testing.T) {
if errProxy == nil {
return false
}
return strings.Contains(errProxy.Error(), `cannot "unsafeproxy" "pods" with name "podX1:8080" in project "ns"`) ||
strings.Contains(errProxy.Error(), `cannot get pods/unsafeproxy in project "ns"`)
return strings.Contains(errProxy.Error(), `cannot proxy pods in namespace "ns"`) ||
strings.Contains(errProxy.Error(), `cannot get pods/proxy in namespace "ns"`)
}

for _, tc := range []struct {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/bootstrap_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func TestBootstrapPolicySelfSubjectAccessReviews(t *testing.T) {
kubeAuthInterface: valerieKubeClient.Authorization(),
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: false,
Reason: `User "valerie" cannot create policybindings in project "openshift"`,
Reason: ``,
Namespace: "openshift",
},
}.run(t)
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestSelfSubjectAccessReviewsNonExistingNamespace(t *testing.T) {
kubeAuthInterface: valerieKubeClient.Authorization(),
response: authorizationapi.SubjectAccessReviewResponse{
Allowed: false,
Reason: `User "valerie" cannot create pods in project "foo"`,
Reason: ``,
Namespace: "foo",
},
}.run(t)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/oauth_cert_fallback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestOAuthCertFallback(t *testing.T) {
certUser = "system:admin"

unauthorizedError = "Unauthorized"
anonymousError = `users.user.openshift.io "~" is forbidden: User "system:anonymous" cannot get users.user.openshift.io at the cluster scope: User "system:anonymous" cannot get users.user.openshift.io at the cluster scope`
anonymousError = `users.user.openshift.io "~" is forbidden: User "system:anonymous" cannot get users.user.openshift.io at the cluster scope`
)

// Build master config
Expand Down

0 comments on commit dac5244

Please sign in to comment.