Skip to content

Commit dac5244

Browse files
committed
WIP:tests
Signed-off-by: Simo Sorce <[email protected]>
1 parent 4a226f8 commit dac5244

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

test/integration/authorization_test.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ func TestAuthorizationSubjectAccessReviewAPIGroup(t *testing.T) {
875875
kubeAuthInterface: clusterAdminSARGetter,
876876
response: authorizationapi.SubjectAccessReviewResponse{
877877
Allowed: true,
878-
Reason: "allowed by openshift authorizer",
878+
Reason: `RBAC: allowed by RoleBinding "admin/hammer-project" of ClusterRole "admin" to User "harold"`,
879879
Namespace: "hammer-project",
880880
},
881881
}.run(t)
@@ -889,7 +889,7 @@ func TestAuthorizationSubjectAccessReviewAPIGroup(t *testing.T) {
889889
kubeAuthInterface: clusterAdminSARGetter,
890890
response: authorizationapi.SubjectAccessReviewResponse{
891891
Allowed: false,
892-
Reason: `User "harold" cannot get horizontalpodautoscalers in project "hammer-project"`,
892+
Reason: ``,
893893
Namespace: "hammer-project",
894894
},
895895
}.run(t)
@@ -903,7 +903,7 @@ func TestAuthorizationSubjectAccessReviewAPIGroup(t *testing.T) {
903903
kubeAuthInterface: clusterAdminKubeClient.Authorization(),
904904
response: authorizationapi.SubjectAccessReviewResponse{
905905
Allowed: false,
906-
Reason: `User "harold" cannot get horizontalpodautoscalers.foo in project "hammer-project"`,
906+
Reason: ``,
907907
Namespace: "hammer-project",
908908
},
909909
}.run(t)
@@ -917,7 +917,7 @@ func TestAuthorizationSubjectAccessReviewAPIGroup(t *testing.T) {
917917
kubeAuthInterface: clusterAdminSARGetter,
918918
response: authorizationapi.SubjectAccessReviewResponse{
919919
Allowed: false,
920-
Reason: `User "harold" cannot get horizontalpodautoscalers.* in project "hammer-project"`,
920+
Reason: ``,
921921
Namespace: "hammer-project",
922922
},
923923
}.run(t)
@@ -1068,7 +1068,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
10681068
kubeAuthInterface: clusterAdminLocalSARGetter,
10691069
response: authorizationapi.SubjectAccessReviewResponse{
10701070
Allowed: true,
1071-
Reason: "allowed by openshift authorizer",
1071+
Reason: `RBAC: allowed by RoleBinding "view/default" of ClusterRole "view" to User "danny"`,
10721072
Namespace: "default",
10731073
},
10741074
}.run(t)
@@ -1133,7 +1133,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
11331133
kubeAuthInterface: haroldSARGetter,
11341134
response: authorizationapi.SubjectAccessReviewResponse{
11351135
Allowed: true,
1136-
Reason: "allowed by openshift authorizer",
1136+
Reason: `RBAC: allowed by RoleBinding "view/hammer-project" of ClusterRole "view" to User "valerie"`,
11371137
Namespace: "hammer-project",
11381138
},
11391139
}.run(t)
@@ -1160,7 +1160,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
11601160
kubeAuthInterface: markSARGetter,
11611161
response: authorizationapi.SubjectAccessReviewResponse{
11621162
Allowed: true,
1163-
Reason: "allowed by openshift authorizer",
1163+
Reason: `RBAC: allowed by RoleBinding "edit/mallet-project" of ClusterRole "edit" to User "edgar"`,
11641164
Namespace: "mallet-project",
11651165
},
11661166
}.run(t)
@@ -1214,7 +1214,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
12141214
kubeAuthInterface: haroldSARGetter,
12151215
response: authorizationapi.SubjectAccessReviewResponse{
12161216
Allowed: true,
1217-
Reason: "allowed by openshift authorizer",
1217+
Reason: `RBAC: allowed by RoleBinding "admin/hammer-project" of ClusterRole "admin" to User "harold"`,
12181218
Namespace: "hammer-project",
12191219
},
12201220
}.run(t)
@@ -1253,7 +1253,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
12531253
kubeAuthInterface: haroldSARGetter,
12541254
response: authorizationapi.SubjectAccessReviewResponse{
12551255
Allowed: true,
1256-
Reason: "allowed by openshift authorizer",
1256+
Reason: `RBAC: allowed by RoleBinding "admin/hammer-project" of ClusterRole "admin" to User "harold"`,
12571257
Namespace: "hammer-project",
12581258
},
12591259
}.run(t)
@@ -1264,7 +1264,7 @@ func TestAuthorizationSubjectAccessReview(t *testing.T) {
12641264
kubeAuthInterface: anonymousSARGetter,
12651265
response: authorizationapi.SubjectAccessReviewResponse{
12661266
Allowed: true,
1267-
Reason: "allowed by openshift authorizer",
1267+
Reason: `RBAC: allowed by RoleBinding "edit/hammer-project" of ClusterRole "edit" to User "system:anonymous"`,
12681268
Namespace: "hammer-project",
12691269
},
12701270
}.run(t)
@@ -1368,8 +1368,8 @@ func TestBrowserSafeAuthorizer(t *testing.T) {
13681368
if errProxy == nil {
13691369
return false
13701370
}
1371-
return strings.Contains(errProxy.Error(), `cannot "unsafeproxy" "pods" with name "podX1:8080" in project "ns"`) ||
1372-
strings.Contains(errProxy.Error(), `cannot get pods/unsafeproxy in project "ns"`)
1371+
return strings.Contains(errProxy.Error(), `cannot proxy pods in namespace "ns"`) ||
1372+
strings.Contains(errProxy.Error(), `cannot get pods/proxy in namespace "ns"`)
13731373
}
13741374

13751375
for _, tc := range []struct {

test/integration/bootstrap_policy_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func TestBootstrapPolicySelfSubjectAccessReviews(t *testing.T) {
9898
kubeAuthInterface: valerieKubeClient.Authorization(),
9999
response: authorizationapi.SubjectAccessReviewResponse{
100100
Allowed: false,
101-
Reason: `User "valerie" cannot create policybindings in project "openshift"`,
101+
Reason: ``,
102102
Namespace: "openshift",
103103
},
104104
}.run(t)
@@ -148,7 +148,7 @@ func TestSelfSubjectAccessReviewsNonExistingNamespace(t *testing.T) {
148148
kubeAuthInterface: valerieKubeClient.Authorization(),
149149
response: authorizationapi.SubjectAccessReviewResponse{
150150
Allowed: false,
151-
Reason: `User "valerie" cannot create pods in project "foo"`,
151+
Reason: ``,
152152
Namespace: "foo",
153153
},
154154
}.run(t)

test/integration/oauth_cert_fallback_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestOAuthCertFallback(t *testing.T) {
3535
certUser = "system:admin"
3636

3737
unauthorizedError = "Unauthorized"
38-
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`
38+
anonymousError = `users.user.openshift.io "~" is forbidden: User "system:anonymous" cannot get users.user.openshift.io at the cluster scope`
3939
)
4040

4141
// Build master config

0 commit comments

Comments
 (0)