Skip to content
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

Restore delegated_test.go #16180

Merged
merged 1 commit into from
Jan 20, 2018

Conversation

mrogers950
Copy link
Contributor

delegated_test.go covered waitForRoleBinding() and was removed in c96408a. This updates it to use native RBAC objects.
One of the fixes for #15836

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 6, 2017
@enj
Copy link
Contributor

enj commented Sep 6, 2017

@deads2k do you remember the purpose of that old test?

@deads2k
Copy link
Contributor

deads2k commented Sep 7, 2017

@deads2k do you remember the purpose of that old test?

That test made sure we waited for the rolebinding before returning so that clients could immediately access resources in the project.

@mrogers950
Copy link
Contributor Author

@enj I've fixed the restored version and rebased.

@mrogers950
Copy link
Contributor Author

/retest

@mrogers950
Copy link
Contributor Author

/retest

@mrogers950
Copy link
Contributor Author

@enj

@mrogers950
Copy link
Contributor Author

@enj does this need anything else?

@enj
Copy link
Contributor

enj commented Jan 12, 2018

/approve

Delegating review to @simo5 @php-coder @adelton

if t.bindings[bootstrappolicy.AdminRoleName] != nil {
return t.bindings[bootstrappolicy.AdminRoleName], nil
}
return nil, errors.NotFound("")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, it's better to use non-empty error message. If we were searching for bootstrappolicy.AdminRoleName, we can include that in the message.


select {
case <-callReturnedCh:
t.Errorf("too fast, should have blocked")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use t.Error() here and rephrase the error message to provide more details (like what happens, what is expected, waiting time).

I just imagined myself, if I would found too fast, should have blocked error somewhere in the long test execution log, then I'd like to have more details.

"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy"
)

func TestDelegatedWait(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to split this to 2 functions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P.S. Unless I miss something. Do we really need to check 2 cases sequentially within one test method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, to test the unblock we want to ensure it blocked in the first place, so it makes sense to me to have this sequence in one test.

cache.namespacelister.lock.Lock()
defer cache.namespacelister.lock.Unlock()
cache.namespacelister.bindings[bootstrappolicy.AdminRoleName] = &rbac.RoleBinding{
ObjectMeta: metav1.ObjectMeta{Name: bootstrappolicy.AdminRoleName},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to extract this to a function in the testRoleBindingLister struct?

}
}

func testWait(storage *REST) chan struct{} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testWait() is to generic name and tells me nothing. Consider to rename it to something more meaningful, for example, waitForAdminRoleInTheStorage().

@mrogers950
Copy link
Contributor Author

@php-coder rebased and updated

@enj
Copy link
Contributor

enj commented Jan 16, 2018

/approve

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 16, 2018
@mrogers950
Copy link
Contributor Author

flake #17882

@mrogers950
Copy link
Contributor Author

/test extended_conformance_install

@simo5
Copy link
Contributor

simo5 commented Jan 19, 2018

/retest

@simo5
Copy link
Contributor

simo5 commented Jan 19, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 19, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enj, mrogers950, 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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 18163, 18139, 18193, 18194, 16180).

@openshift-merge-robot openshift-merge-robot merged commit 5176de6 into openshift:master Jan 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants