Skip to content

Restore delegated_test.go - #16180

Merged
openshift-merge-robot merged 1 commit into
openshift:masterfrom
mrogers950:delegated_test
Jan 20, 2018
Merged

openshift-merge-robot merged 1 commit into
openshift:masterfrom
mrogers950:delegated_test

Conversation

@mrogers950

Copy link
Copy Markdown

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

enj commented Sep 6, 2017

Copy link
Copy Markdown
Contributor

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

@deads2k

deads2k commented Sep 7, 2017

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Author

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

@mrogers950

Copy link
Copy Markdown
Author

/retest

@mrogers950

Copy link
Copy Markdown
Author

/retest

@mrogers950

Copy link
Copy Markdown
Author

@enj

@mrogers950

Copy link
Copy Markdown
Author

@enj does this need anything else?

@enj

enj commented Jan 12, 2018

Copy link
Copy Markdown
Contributor

/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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
Author

@php-coder rebased and updated

@enj

enj commented Jan 16, 2018

Copy link
Copy Markdown
Contributor

/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
Copy Markdown
Author

flake #17882

@mrogers950

Copy link
Copy Markdown
Author

/test extended_conformance_install

@simo5

simo5 commented Jan 19, 2018

Copy link
Copy Markdown

/retest

@simo5

simo5 commented Jan 19, 2018

Copy link
Copy Markdown

/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
Copy Markdown

[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.

Details 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
Copy Markdown
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