In this commit, we introduce unit tests for both the `MutatingAdmission` and `ValidatingAdmission` webhooks specifically for the `FederatedHPA` resource. The tests include: - Validation webhook tests: - Verifies that admission is denied with an appropriate error message when decoding the request object fails. - Ensures admission is denied when the `FederatedHPA` spec contains invalid values, such as a `minReplicas` set to zero, and the correct error message is returned. - Confirms that a valid `FederatedHPA` object is allowed through without errors. - Mutation webhook tests: - Verifies that admission is denied when decoding the request object fails, returning the appropriate error message. - Ensures that the `FederatedHPA` object is correctly mutated when provided with default values, including scale policies and CPU utilization. - Confirms that no patches are applied when the `FederatedHPA` object is handled correctly and that admission is allowed for valid `FederatedHPA` objects. Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com> |
||
---|---|---|
.. | ||
mutating.go | ||
mutating_test.go | ||
validating.go | ||
validating_test.go |