-
Notifications
You must be signed in to change notification settings - Fork 2.8k
test(source): remove flaky log assertions from pod tests #5517
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
Conversation
Hi @u-kai. 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-sigs/prow repository. |
/ok-to-test |
If you removing this capability from tests, we need a compensation. Testing similar capabilities but without paralel execution |
@ivankatliarchuk I personally don't think the log assertions in this test are essential, especially since it's just |
/hold |
compensation for removed testing capability is required. |
as well as static analysis for correct use of test.Parallel() is needed |
The only part that is no longer being tested after my change is the log output. |
Yes, there is no need to validate same logs for each test, so only few tests have logging valided. We could have separate test that just verify log messages. Agree that it does single log level testing, not efficient. |
@ivankatliarchuk |
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
} | ||
|
||
func TestPodSourceLogs(t *testing.T) { | ||
t.Parallel() |
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.
do we need Parallel for that? Just a comment, not necessary need to action
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.
I think it's needed here, because as discussed below, using t.Parallel
at this level is safe and allows us to parallelize the tests.
/unhold |
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.
See my suggestion: t.Parallel()
should be inside the for loop.
apart from that, LGTM. Thanks for your help on this 👍
@mloiseleur
This happens because the parallel tests share state and have conflicting expectations about whether certain log messages should or should not appear. For this reason, I personally prefer keeping the current approach without using |
Make sense to me. We want the CI to be as reliable as we can 👍 |
Got it, I'll leave it as is then. |
/approve |
/test pull-external-dns-unit-test |
/test all |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ivankatliarchuk, mloiseleur 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 |
What does it do ?
Remove flaky log assertions from
TestPodSource
to fix race conditions that caused intermittent test failures with "Expected no debug messages" errors.Example of the race condition failure: : link
Motivation
The
TestPodSource
test was experiencing flaky failures due to race conditions when running in parallel.The issue occurred because:
t.Parallel()
were simultaneouslymodifying the global logrus logger through
LogsUnderTestWithLogLevel()
focusing on the core functionality
Solution: Remove log testing entirely and focus on endpoint generation correctness, which is
the actual functionality being tested.
More