Skip to content

Commit

Permalink
Add remove test with mismatched rolebinding name
Browse files Browse the repository at this point in the history
Signed-off-by: Simo Sorce <[email protected]>
  • Loading branch information
simo5 committed Feb 14, 2018
1 parent 5b73b36 commit 432897d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/cmd/policy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ os::cmd::expect_failure_and_text 'oc get rolebinding/cluster-admin --no-headers'
os::cmd::expect_success 'oc policy remove-group system:unauthenticated'
os::cmd::expect_success 'oc policy remove-user system:no-user'

# Test failure to mix and mismatch role/rolebiding removal
os::cmd::expect_success 'oc login -u local-admin -p pw'
os::cmd::expect_success 'oc new-project mismatch-prj'
os::cmd::expect_success 'oc create rolebinding match --clusterrole=admin --user=user'
os::cmd::expect_success 'oc create rolebinding mismatch --clusterrole=edit --user=user'
os::cmd::expect_failure_and_text 'oc policy remove-role-from-user admin user --rolebinding-name mismatch' 'rolebinding mismatch'
os::cmd::expect_success_and_text 'oc policy remove-user user' 'user'
os::cmd::expect_failure_and_text 'oc get rolebinding mismatch --no-headers' 'NotFound'
os::cmd::expect_failure_and_text 'oc get rolebinding match --no-headers' 'NotFound'
os::cmd::expect_success "oc login -u system:admin -n '${project}'"
os::cmd::expect_success 'oc delete project mismatch-prj'

# check to make sure that our SCC policies don't prevent GC from deleting pods
os::cmd::expect_success 'oc create -f ${OS_ROOT}/test/testdata/privileged-pod.yaml'
os::cmd::expect_success 'oc delete pod/test-build-pod-issue --cascade=false'
Expand Down

0 comments on commit 432897d

Please sign in to comment.