google / go-cloud

The Go Cloud Development Kit (Go CDK): A library and tools for open cloud development in Go.
https://gocloud.dev/
Apache License 2.0
9.57k stars 812 forks source link

all: fix test lint issues detecte by tenv and thelper linters #3441

Closed peczenyj closed 5 months ago

peczenyj commented 5 months ago

here I try to handle two kinds of issues with tests

  1. the usage of os.Setenv in tests that need specific env vars and we need to revert the changes in the end. This usually is done via defer + some cleanup function BUT it may not run in many cases (like in a t.Fatal) and t.Setenv already do this and it is battle tested. for this I used the linter tenv via gitlabci-lint.
  2. the miss of t.Helper() in many test helpers. This was done by using the linter thelper via gitlabci-lint. The motivation is here: https://github.com/kulti/thelper?tab=readme-ov-file#why

this should have no impact in existing code or tests, but may help identify an issue from unit tests or benchmarks

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 73.40%. Comparing base (e0e5901) to head (0657092).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3441 +/- ## ========================================== - Coverage 73.41% 73.40% -0.02% ========================================== Files 113 113 Lines 14947 14947 ========================================== - Hits 10974 10972 -2 - Misses 3199 3201 +2 Partials 774 774 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

vangent commented 5 months ago

Thanks!