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

test: fix and optimize flaky cron tests. Partial fix for #10807 #14024

Merged
merged 1 commit into from
Dec 22, 2024

Conversation

MasonM
Copy link
Contributor

@MasonM MasonM commented Dec 22, 2024

Fixes #10807

Motivation

The cron tests have been some of the slowest and flakiest for awhile now, mostly due to using time.Sleep() to wait a fixed amount of time. The TestCronSuite function tries to workaround the flakiness by running the suite at the 30 second mark, but this is only effective for the first test in the suite.

Modifications

This changes nearly all the cron tests to remove the time.Sleep() calls and instead use the API to poll for changes. The two tests I couldn't fix to stop using time.Sleep() are TestBasicForbid and TestCronCountersForbid, since I don't know of any way of verifying the concurrencyPolicy is respected without sleeping.

Also, most of the cron fixture data wasn't specifying workflow metadata properly using workflowMetadata, which meant they weren't being cleaned up automatically, so I fixed that too.

Verification

Ran make test-cron locally

The cron tests have been some of the slowest and flakiest for awhile
now, mostly due to using `time.Sleep()` to wait a fixed amount of time.
The `TestCronSuite` function tries to workaround the flakiness by
running the suite at the 30 second mark, but this is only effective for the
first time in the suite.

This changes nearly all the cron tests to remove the `time.Sleep()`
calls and instead use the API to poll for changes. The one test I
couldn't fix to stop using `time.Sleep()` is `TestBasicForbid`, since I
don't know any way of verifying the `concurrencyPolicy` is respected.

Also, most of the cron fixture data wasn't specifying workflow metadata
properly using `workflowMetadata`, which meant they weren't being
cleaned up automatically, so I fixed that too.

Signed-off-by: Mason Malone <[email protected]>
@MasonM MasonM marked this pull request as ready for review December 22, 2024 19:46
@MasonM MasonM requested a review from terrytangyuan December 22, 2024 19:48
Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

This is great. Thanks!

@terrytangyuan terrytangyuan merged commit 9d1efe9 into argoproj:main Dec 22, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flakey tests
2 participants