-
Notifications
You must be signed in to change notification settings - Fork 799
feat(subscriber): Add unit tests for k8s operations #5318
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
base: master
Are you sure you want to change the base?
feat(subscriber): Add unit tests for k8s operations #5318
Conversation
Adds unit tests to the subscriber/pkg/k8s package to cover core logic. - Tests the 'addCustomLabels' utility function. - Tests the 'applyRequest' function for both 'get' and 'create' operations using a fake dynamic client. Resolves: litmuschaos#4914 Signed-off-by: Debjyoti Shit <[email protected]>
|
Hi @PriteshKiri , it’s been over a week. Can someone review this PR? Thank you! |
|
@Debjyoti2004 can you please attach the screenshot of output you get after running these tests |
|
Hi @SarthakJain26, here is the screenshot of the test output after running All tests are passing successfully.
Please let me know if you'd like me to run the full module tests as well. |
|
Hi @SarthakJain26, I noticed that the Looking at the logs, Trivy is reporting 1 HIGH vulnerability in the base image:
This PR only adds unit tests under Could you please advise how you’d like to handle this Trivy finding (e.g. updating the base image or adjusting the CI gate)? I’m happy to rebase or update the branch if needed once the image side is addressed. |
|
The screenshot looks good @Debjyoti2004, the build fail is not related to your changes so it can be fixed in a separate PR. You may raise another PR to fix the vulnerability if you are interested. |
|
Hi @SarthakJain26 @PriteshKiri, could you please review this PR when you get a chance? |

Adds unit tests to the subscriber/pkg/k8s package to cover core logic.
Resolves: #4914
Proposed changes
This PR adds unit tests to the
subscriber/pkg/k8spackage to satisfy issue #4914.The new tests in
operations_test.gocover:addCustomLabelsutility function.applyRequestfunction for both "get" and "create" operations, using afake.NewSimpleDynamicClientto mock the Kubernetes API interaction.Types of changes
What types of changes does your code introduce to Litmus? Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Dependency
Special notes for your reviewer:
None.