-
Notifications
You must be signed in to change notification settings - Fork 1.2k
🐛 Fix builders WithLogger method #1166
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
🐛 Fix builders WithLogger method #1166
Conversation
Signed-off-by: Fabian Ruff <[email protected]>
Hi @databus23. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @vincepri |
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.
/approve
/assign @alvaroaleman
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.
@databus23 Could you add a test for this?
/ok-to-test |
@alvaroaleman Unfortunately I don't really have time to attend to this. I just noticed that |
/test pull-controller-runtime-test-master |
@alvaroaleman Looking at the tests, it should be fairly easy to add a test. Let me try to add a test for this. |
WithLogger(logger). | ||
Build(noop) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(instance).NotTo(BeNil()) |
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.
That test will also succeed without your code changes - Please test that you get the same logger as you inserted, not that you get any logger
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.
No it does not. I tested it. Without my changes the test fails with:
logger expected log.NullLogger but found *zapr.zapLogger
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.
While the test was working I made it more explicit by using a minimal custom testLogger
.
Without my changes the test now fails with:
logger expected *builder.testLogger but found *zapr.zapLogger
Signed-off-by: Fabian Ruff <[email protected]>
1ffd864
to
165310a
Compare
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, databus23, vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The logger in the
Builder
struct is not used anywhere. Instead we need to set it in the controller options.