Skip to content

test: add unit tests for exec.go file in pkg/utils folder #755

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 two utility functions in the exec.go file inside the utils package:

  • SetExecCommandAttributes
  • checkPodStatus

These are pure functions and testable without external dependencies.
This contribution is part of a larger effort to improve test coverage across the utils package.

⚠️ Note: This PR provides partial coverage (currently ~33%) since the Exec() function depends on Kubernetes APIs and remote SPDY execution, which would require more advanced mocking or integration setup. That work can be done in a follow-up PR.


Fixes #752


Special notes for your reviewer:

  • Tests are written with table-driven and edge case validation
  • Maintainers are welcome to suggest how to approach testing Exec() in a future PR (e.g., mocking clients or using fake.Clientset)
  • This aligns with LitmusChaos goals of improving code quality and test coverage

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 (N/A)
  • Labelled this PR & related issue with requires-upgrade tag (N/A)
  • PR message has upgrade related information (N/A)
  • Commit has unit tests
  • Commit has integration tests (N/A)
  • E2E run Required for the changes (N/A)

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