-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for remove-user with a rolebinding name #18602
Conversation
@enj PTAL |
/retest |
@simo5 can you also add a test like my example from #18102 (comment) (remove-role-from-user). |
test/cmd/policy.sh
Outdated
@@ -54,6 +54,10 @@ os::cmd::expect_success_and_text 'oc policy add-role-to-group cluster-admin --ro | |||
os::cmd::expect_success_and_text 'oc policy add-role-to-user --rolebinding-name cluster-admin cluster-admin system:no-user' 'role "cluster-admin" added: "system:no-user"' | |||
os::cmd::expect_success 'oc get rolebinding/cluster-admin --no-headers' | |||
os::cmd::expect_success_and_text 'oc get rolebinding/cluster-admin --no-headers' 'system:no-user' | |||
# Test failure to mix and mismatch | |||
os::cmd::expect_success 'oc create rolebinding mismatch --clusterrole=cluster-admin --user=system:user' | |||
os::cmd::expect_failure 'oc policy remove-user --rolebinding-name mismatch system:no-user' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os::cmd::expect_failure_and_text with specific failure
I could go the whole project creation route like your example, but it's a ton of test overhead for no additional value. |
And of course there is no --rolebinding-name option on this command ... FAIL! :-) |
Signed-off-by: Simo Sorce <simo@redhat.com>
Overhauled the test to use a project and checks for rolebinding mismatches |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enj, simo5 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. |
Automatic merge from submit-queue. Add tests for remove-user with a rolebinding name Fixes openshift#18582
Fixes #18582