feat(Improvements): Migrate downloader package from legacy jacobsa dependency to testify. - #5029
feat(Improvements): Migrate downloader package from legacy jacobsa dependency to testify.#5029charith87 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the downloader tests by migrating from the ogletest framework to the standard Go testing package combined with testify/assert and testify/require. The review feedback highlights several critical issues with the migration: first, using require assertions (which invoke FailNow()) inside background goroutines is unsafe and can cause silent failures or hangs, meaning assert should be used instead. Second, assertions within subtests (t.Run) must use the subtest's local t context rather than the parent's context to ensure proper test isolation and accurate failure reporting.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5029 +/- ##
==========================================
- Coverage 83.90% 83.88% -0.02%
==========================================
Files 176 176
Lines 21546 21546
==========================================
- Hits 18078 18074 -4
- Misses 2769 2772 +3
- Partials 699 700 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Migrate tests in
internal/cache/file/downloaderfrom legacyogletesttotestify:downloader_test.go: Convert to standardTest_*functions withnewDownloaderTest(t)helper,t.TempDir(), andassert/require.job_test.go: Convert suite methods to standalone tests usingnewJobTest(t)and testify assertions.parallel_downloads_job_test.go: Migrate parallel download test suite to testify.sparse_downloads_job_test.go: Migrate sparse download tests to table-driven tests with testify.Link to the issue in case of a bug fix.
N/A
Testing details
make buildpassed.go test -v -count=1 ./internal/cache/file/downloader/...passed.Any backward incompatible change? If so, please explain.
N/A