Skip to content

Conversation

@Diaphteiros
Copy link
Contributor

What this PR does / why we need it:
Adds two functionalities to the testing library:

  • The (Complex)Environment can now be instructed to inject UIDs into k8s objects, which the fake client doesn't do by default.
  • Further methods have been added to match the error returned by a failed reconciliation, which was not possible with the ShouldNotReconcile function (and its relatives) before.

Which issue(s) this PR fixes:
Required for openmcp-project/openmcp-operator#67
Required for openmcp-project/mcp-operator#103

Special notes for your reviewer:
Refactored out of #66

Release note:

The testing library's `ComplexEnvironment` and `Environment` types can now be configured to add UIDs to created resources (the fake client doesn't do this). Use the `WithUIDs` method in the builder and additionally use `InjectUIDOnObjectCreation` if you overwrite the fake client's interceptor funcs to enable this functionality.
Next to the `ShouldNotReconcile`/`ShouldEventuallyNotReconcile` methods from the testing library's `Environment`/`ComplexEnvironment` types, there are now `ShouldNotReconcileWithError` and `ShouldEventuallyNotReconcileWithError` which allow to verify properties of the error returned by the reconciliation in addition to ensuring that one occurred.

reshnm
reshnm previously approved these changes Jul 14, 2025
@Diaphteiros Diaphteiros merged commit 2058178 into main Jul 14, 2025
7 checks passed
@Diaphteiros Diaphteiros deleted the testing branch July 14, 2025 14:48
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.

2 participants