-
Notifications
You must be signed in to change notification settings - Fork 1.3k
test: refactor cloudevent_source_test.go #6759
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
|
/run-e2e internal |
wozniakjan
left a comment
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.
great effort! thank you so much for fixing these time.Sleeps with more deterministic behavior. I think it would benefit greatly from using gomega (no need to add ginkgo to the mix, I think that won't be necessary)
|
Thanks Jan! I've just force pushed some changes, lmk what you think when you have time. :-) |
fe53f0a to
ca1fdfb
Compare
JorTurFer
left a comment
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.
This looks nice! just small nit inline
2c9f27c to
881e075
Compare
Refactors the cloudevent_source test to rely on events instead of sleeping in order to progress and also improves the cleanup between and after tests. We've noticed flakes with this test where the magic sleep timings don't play well on certain machines and platforms. This commit also adds several more helper test functions that: * Allow you to wait for Kubernetes events after calling a trigger function * Allows you to consistently validate a condition up to a duration * Allows you to execute commands on pods with TTY turned off (this change is due to several weird test flakes we've seen where the output of an exec command returned to the user is unexpected) Signed-off-by: Max Cao <macao@redhat.com>
|
Thanks! Had to rebase to resolve the merge conflict. |
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.
Pull Request Overview
This PR refactors the cloud event source test to improve its reliability by replacing fixed sleep timings with event watchers and by enhancing the test cleanup process. Key changes include:
- Replacing magic sleep durations with event-based triggers and consistency checks.
- Adding alternate execution functions for commands without TTY and updating logging messages.
- Improving cleanup by using t.Cleanup in the main test function.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/internals/cloudevent_source/cloudevent_source_test.go | Refactored several test functions to use event watchers, deferred deletion, and improved logging to reduce flakiness |
| tests/helper/helper.go | Introduced ExecCommandOnSpecificPodWithoutTTY and implemented the KedaConsistently function to support event watching and polling |
Comments suppressed due to low confidence (1)
tests/internals/cloudevent_source/cloudevent_source_test.go:623
- The log message in testErrEventSourceCreation mentions 'include filter' even though the function is focused on testing creation errors. Consider updating the log message to more accurately reflect its purpose (e.g., mention 'creation error') for better clarity.
t.Logf("--- test emitting eventsource about scaledobject err with include filter --- [isClusterScope: %t]", isClusterScope)
|
/run-e2e internal |
wozniakjan
left a comment
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, thank you!
I could see some minor code structure changes in the future to make the code a bit cleaner, but this fixes a real flaky test so I shouldn't dwell on nitpicks :)
Refactors the cloudevent_source test to rely on events instead of sleeping in order to progress and also improves the cleanup between and after tests. We've noticed flakes with this test where the magic sleep timings don't play well on certain machines and platforms. This commit also adds several more helper test functions that: * Allow you to wait for Kubernetes events after calling a trigger function * Allows you to consistently validate a condition up to a duration * Allows you to execute commands on pods with TTY turned off (this change is due to several weird test flakes we've seen where the output of an exec command returned to the user is unexpected) Signed-off-by: Max Cao <macao@redhat.com> Signed-off-by: David Pochopsky <david.pochopsky@united.com>
Refactors the
cloudevent_source_test.gotest to rely on events instead of sleeping in order to progress and also improves the cleanup between and after tests. We've noticed flakes with this test where the magic sleep timings don't play well on certain machines and platforms.This commit also adds several more helper test functions that:
we've seen where the output of an exec command returned to the user is unexpected)
Checklist