In this commit, we add unit tests for the `ValidatingAdmission` validation webhook specifically for the resource deletion protection feature. These tests ensure that the webhook correctly handles various admission scenarios: - Tests the behavior when decoding the request object fails, verifying that admission is denied with an appropriate error message. - Ensures that resources labeled with `DeletionProtectionAlways` are denied deletion, validating that the error message is returned. - Confirms that resources without the deletion protection label are allowed to be deleted without errors. - Validates that resources with other labels are not impacted and are allowed to be deleted. - Confirms that non-delete operations (e.g., create) are allowed by default. Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com> |
||
---|---|---|
.. | ||
validating.go | ||
validating_test.go |