Skip to content

Added unit tests for resourcedistribution#150

Open
GautamBytes wants to merge 2 commits intoopenkruise:masterfrom
GautamBytes:add-resourcedistribution-generator-tests
Open

Added unit tests for resourcedistribution#150
GautamBytes wants to merge 2 commits intoopenkruise:masterfrom
GautamBytes:add-resourcedistribution-generator-tests

Conversation

@GautamBytes
Copy link
Copy Markdown
Contributor

What's in this PR?

This pull request introduces a robust and comprehensive unit test suite for the ResourceDistribution generator. The primary goal is to validate the generator's behavior across its full feature set, ensuring its output is correct and its error handling is reliable.

Key Contributions

  • Expanded Test Coverage: Adds tests for core features that were previously untested, including:

    • Data generation from literalSources.
    • Applying resourceOptions (labels, annotations) to the inner resource.
    • Advanced namespace targeting with matchExpressions and excludedNamespaces.
  • Robust Assertions: The test validation logic has been refactored to unmarshal the expected and actual YAML into unstructured.Unstructured objects. These objects are then compared directly, making the tests more reliable and independent of formatting or key order.

Signed-off-by: GautamBytes <manchandanigautam@gmail.com>
@kruise-bot kruise-bot requested review from FillZpp and furykerry July 12, 2025 16:46
@kruise-bot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hantmac for approval by writing /assign @hantmac in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: GautamBytes <manchandanigautam@gmail.com>
@GautamBytes
Copy link
Copy Markdown
Contributor Author

@furykerry please take a look!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants