Skip to content

test: add unit tests for retry.go in pkg/utils folder #754

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Prakhar-Shankar
Copy link

What this PR does / why we need it:

This PR adds unit tests for the retry package (retry.go) under the utils directory.
It improves test coverage by validating:

  • Retry success and failure flows
  • Timeouts
  • Special case: breaking on "container is in terminated state"
  • Nil action handling

It also modifies Try() to use .Error() == "..." instead of pointer comparison, making it more testable and idiomatic.

Which issue this PR fixes (optional, in fixes #<issue number> format):
Fixes #752
(Update once issue is created)

Special notes for your reviewer:

  • All tests are table-driven and isolated
  • 100% coverage for retry.go can be verified using go test -cover
  • Let me know if you'd prefer a separate PR for the .Error() check improvement

Checklist:

  • Fixes Add unit tests for pkg/utils folder #752
  • PR message has documentation-related information
  • Labelled this PR & related issue with breaking-changes tag (Not applicable)
  • PR message has breaking changes-related information (None)
  • Labelled this PR & related issue with requires-upgrade tag (Not applicable)
  • PR message has upgrade-related information (None)
  • Commit has unit tests
  • Commit has integration tests (Not needed)
  • E2E run Required for the changes (Not needed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add unit tests for pkg/utils folder
1 participant