Skip to content

Conversation

@Debjyoti2004
Copy link

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: #4914

Proposed changes

This PR adds unit tests to the subscriber/pkg/k8s package to satisfy issue #4914.

The new tests in operations_test.go cover:

  • The addCustomLabels utility function.
  • The applyRequest function for both "get" and "create" operations, using a fake.NewSimpleDynamicClient to mock the Kubernetes API interaction.

Types of changes

What types of changes does your code introduce to Litmus? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices applies)

Checklist

Put an x in 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.

  • I have read the CONTRIBUTING doc
  • I have signed the commit for DCO to be passed.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)

Dependency

  • None.

Special notes for your reviewer:

None.

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]>
@Debjyoti2004
Copy link
Author

Hi @PriteshKiri , it’s been over a week. Can someone review this PR? Thank you!

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.

feat: add k8s subscriber unit test

2 participants