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

scripts: add linter rule for using context.WithTimeout on tests #7342

Merged

Conversation

hasson82
Copy link
Contributor

@hasson82 hasson82 commented Jun 22, 2024

This PR is adding a linter rule for checking each context usage in tests is using context.WithTimeout.
Based on #7304.

The PR grew a lot, so decided to ignore some packages in the linter rule and will deal with them in upcoming PRs.

RELEASE NOTES: none

…thub.com:hasson82/grpc-go into hasson82/add-context-with-timeout-checks-to-lint
Copy link

linux-foundation-easycla bot commented Jun 22, 2024

Copy link

codecov bot commented Jun 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.47%. Comparing base (4dd7f55) to head (136b4ba).
Report is 23 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7342      +/-   ##
==========================================
+ Coverage   80.58%   81.47%   +0.89%     
==========================================
  Files         349      348       -1     
  Lines       34056    26744    -7312     
==========================================
- Hits        27445    21791    -5654     
+ Misses       5431     3770    -1661     
- Partials     1180     1183       +3     

see 307 files with indirect coverage changes

@aranjans aranjans added this to the 1.66 Release milestone Jun 24, 2024
@hasson82 hasson82 requested a review from atollena June 28, 2024 20:48
Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. It looks great generally, but I have a nit about creating contexts with timeout only once per test in several of the tests changed.

internal/binarylog/method_logger_test.go Outdated Show resolved Hide resolved
internal/xds/rbac/rbac_engine_test.go Outdated Show resolved Hide resolved
peer/peer_test.go Outdated Show resolved Hide resolved
picker_wrapper_test.go Outdated Show resolved Hide resolved
server_test.go Outdated Show resolved Hide resolved
@hasson82 hasson82 requested a review from dfawley July 3, 2024 18:52
Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

That looks good, thank you.

@zasweq zasweq changed the title Linter rule for using context.WithTimeout on tests Add linter rule for using context.WithTimeout on tests Jul 3, 2024
@zasweq zasweq changed the title Add linter rule for using context.WithTimeout on tests scripts: add linter rule for using context.WithTimeout on tests Jul 3, 2024
@zasweq zasweq merged commit bdd707e into grpc:master Jul 3, 2024
13 checks passed
printchard pushed a commit to printchard/grpc-go that referenced this pull request Jul 8, 2024
printchard pushed a commit to printchard/grpc-go that referenced this pull request Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants