Skip to content

feat(Improvements): Migrate downloader package from legacy jacobsa dependency to testify. - #5029

Open
charith87 wants to merge 3 commits into
masterfrom
charithc_changes_go_7
Open

feat(Improvements): Migrate downloader package from legacy jacobsa dependency to testify.#5029
charith87 wants to merge 3 commits into
masterfrom
charithc_changes_go_7

Conversation

@charith87

Copy link
Copy Markdown
Collaborator

Description

Migrate tests in internal/cache/file/downloader from legacy ogletest to testify:

  • downloader_test.go: Convert to standard Test_* functions with newDownloaderTest(t) helper, t.TempDir(), and assert/require.
  • job_test.go: Convert suite methods to standalone tests using newJobTest(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

  1. Manual - make build passed.
  2. Unit tests - go test -v -count=1 ./internal/cache/file/downloader/... passed.
  3. Integration tests - N/A

Any backward incompatible change? If so, please explain.

N/A

@charith87
charith87 requested a review from meet2mky August 16, 2026 14:02
@charith87
charith87 requested a review from a team as a code owner August 16, 2026 14:02
@github-actions github-actions Bot added the remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR. label Aug 16, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread internal/cache/file/downloader/sparse_downloads_job_test.go
Comment thread internal/cache/file/downloader/downloader_test.go
Comment thread internal/cache/file/downloader/job_test.go
Comment thread internal/cache/file/downloader/job_test.go Outdated
Comment thread internal/cache/file/downloader/job_test.go
Comment thread internal/cache/file/downloader/job_test.go Outdated
Comment thread internal/cache/file/downloader/job_test.go Outdated
@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.88%. Comparing base (872920d) to head (7a2b58c).

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     
Flag Coverage Δ
unittests 83.88% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant