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

Add t.Parallel to unit tests #3297

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

gmlewis
Copy link
Collaborator

@gmlewis gmlewis commented Oct 1, 2024

On my system, this cuts testing time by approximately half.

Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Oct 1, 2024
Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.01%. Comparing base (2b8c7fa) to head (d69e822).
Report is 129 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3297      +/-   ##
==========================================
- Coverage   97.72%   93.01%   -4.72%     
==========================================
  Files         153      172      +19     
  Lines       13390    11777    -1613     
==========================================
- Hits        13085    10954    -2131     
- Misses        215      729     +514     
- Partials       90       94       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gmlewis
Copy link
Collaborator Author

gmlewis commented Oct 3, 2024

@alexandear - might you have time to review this PR, please?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to enable tparallel and paralleltest in golangci-lint's config to automatically verify existence of t.Parallel in a test?

From https://golangci-lint.run/usage/linters/

tparallel detects inappropriate usage of t.Parallel() method in your Go test codes.

paralleltest detects missing usage of t.Parallel() method in your Go test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a good idea. There are some tests that cannot use t.Parallel because of a helper function, but those could be exceptions. Thanks, I'll investigate.

github/actions_cache_test.go Show resolved Hide resolved
Copy link
Contributor

@alexandear alexandear Oct 4, 2024

Choose a reason for hiding this comment

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

The PR's title states, "Add t.Parallel to unit tests". But changes include integration tests. Is it intentional, or we should revert changes on the integration folder?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point!
I'll revert the changes to the integration tests.

Signed-off-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsReview PR is awaiting a review before merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants