Skip to content

Commit 46bdbfa

Browse files
author
OpenShift Bot
authored
Merge pull request #12461 from mfojtik/clusterroles-selector
Merged by openshift-bot
2 parents 4d6e336 + f2a189d commit 46bdbfa

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

pkg/authorization/registry/role/policybased/virtual_storage.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (m *VirtualStorage) NewList() runtime.Object {
4747
}
4848

4949
func (m *VirtualStorage) List(ctx kapi.Context, options *kapi.ListOptions) (runtime.Object, error) {
50-
policyList, err := m.PolicyStorage.ListPolicies(ctx, options)
50+
policyList, err := m.PolicyStorage.ListPolicies(ctx, &kapi.ListOptions{})
5151
if err != nil {
5252
return nil, err
5353
}

pkg/authorization/registry/rolebinding/policybased/virtual_storage.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (m *VirtualStorage) NewList() runtime.Object {
5454
}
5555

5656
func (m *VirtualStorage) List(ctx kapi.Context, options *kapi.ListOptions) (runtime.Object, error) {
57-
policyBindingList, err := m.BindingRegistry.ListPolicyBindings(ctx, options)
57+
policyBindingList, err := m.BindingRegistry.ListPolicyBindings(ctx, &kapi.ListOptions{})
5858
if err != nil {
5959
return nil, err
6060
}

test/cmd/admin.sh

+14
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,20 @@ os::cmd::expect_success "oadm policy reconcile-cluster-role-bindings --confirm"
267267
echo "admin-role-reapers: ok"
268268
os::test::junit::declare_suite_end
269269

270+
os::test::junit::declare_suite_start "cmd/admin/role-selectors"
271+
os::cmd::expect_success "oc create -f test/extended/testdata/roles/policy-clusterroles.yaml"
272+
os::cmd::expect_success "oc get clusterrole/basic-user2"
273+
os::cmd::expect_success "oc label clusterrole/basic-user2 foo=bar"
274+
os::cmd::expect_success_and_not_text "oc get clusterroles --selector=foo=bar" "No resources found"
275+
os::cmd::expect_success_and_text "oc get clusterroles --selector=foo=unknown" "No resources found"
276+
os::cmd::expect_success "oc get clusterrolebinding/basic-users2"
277+
os::cmd::expect_success "oc label clusterrolebinding/basic-users2 foo=bar"
278+
os::cmd::expect_success_and_not_text "oc get clusterrolebindings --selector=foo=bar" "No resources found"
279+
os::cmd::expect_success_and_text "oc get clusterroles --selector=foo=unknown" "No resources found"
280+
os::cmd::expect_success "oc delete clusterrole/basic-user2"
281+
os::test::junit::declare_suite_end
282+
echo "admin-role-selectors: ok"
283+
270284
os::test::junit::declare_suite_start "cmd/admin/ui-project-commands"
271285
# Test the commands the UI projects page tells users to run
272286
# These should match what is described in projects.html

0 commit comments

Comments
 (0)