Skip to content

chore: Use standardized test timeouts and delays #3291

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

Merged
merged 16 commits into from
Aug 1, 2022
Merged

Conversation

mafredri
Copy link
Member

This PR introduces a new package called testutil for exposing standard delays and intervals that can be used in tests.

This is so that we can increase or decrease the values depending on platform.

The motivation behind this PR is that Windows tests are flaking due to timeouts, not that they failed to complete.

Motivation behind putting this package in internal can be found in #1405.

PS. I'm not married to the name, I tried floating a few different ideas in my mind:

codertest
ctest
durtest
testdur
tests
testtime
testwait
testy
timetest
waittest

But I didn't really like any of them. I consider this package something we will expand in the future.

  • chore: Standardize waits and intervals between tests
  • chore: Add linter for timeouts

@mafredri mafredri requested a review from a team as a code owner July 29, 2022 12:22
@mafredri mafredri self-assigned this Jul 29, 2022
@mafredri mafredri requested review from a team and removed request for a team July 29, 2022 12:22
// constants for timeouts and delays in usual scenarios, this allows us
// to tweak them based on platform (important to avoid CI flakes).
//nolint:unused,deadcode,varnamelen
func useStandardTimeoutsAndDelaysInTests(m dsl.Matcher) {
Copy link
Member

Choose a reason for hiding this comment

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

👍 Nice!

@mafredri mafredri force-pushed the mafredri/test-timeouts branch from 1d55b5d to 995de74 Compare July 29, 2022 14:55
@mafredri mafredri force-pushed the mafredri/test-timeouts branch from 995de74 to 87432e6 Compare July 29, 2022 14:55
Copy link
Contributor

@AbhineetJain AbhineetJain left a comment

Choose a reason for hiding this comment

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

Just have a small question, but this is an awesome PR! 🔥

Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

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

I'm a fan of testtime or testdir more.

util packages expand infinitely, I'm convinced!

@mafredri
Copy link
Member Author

mafredri commented Aug 1, 2022

I moved the testutil package from /internal to / based on team feedback. I'll leave it as testutil for now, it's a distinct name so changing it in the future should be quite easy if we find a better fit.

@mafredri mafredri force-pushed the mafredri/test-timeouts branch from 563138e to 422e72b Compare August 1, 2022 10:09
@mafredri mafredri merged commit 4730c58 into main Aug 1, 2022
@mafredri mafredri deleted the mafredri/test-timeouts branch August 1, 2022 12:45
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.

4 participants