karmada/pkg/webhook
Mohamed Awnallah f19f9c4a45 pkg/webhook: test OverridePolicy
In this commit, we introduce unit tests for both the `ValidationAdmission`
and `MutatingAdmission` webhooks specifically for the `OverridePolicy` resource.

- Validation webhook tests:
  - Tests the behavior when decoding the request object fails, verifying
    that admission is denied with an appropriate error message.
  - Validates that the webhook denies admission when encountering invalid
    label values in the `OverridePolicy` spec, ensuring proper error messaging.
  - Confirms that valid `OverridePolicy` objects are admitted without errors.

- Mutation webhook tests:
  - Handles decode errors and denies admission when decoding fails.
  - Provides full coverage of policy mutation, including setting default
    namespaces and validating no unnecessary patches.

Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
2024-09-13 10:14:04 +03:00
..
clusteroverridepolicy Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00
clusterpropagationpolicy remove pp/cpp name length limit 2024-08-16 10:34:15 +08:00
clusterresourcebinding Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00
configuration Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00
cronfederatedhpa Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00
federatedhpa Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00
federatedresourcequota pkg: test `federatedresourcequota` webhook 2024-08-01 02:39:44 +00:00
interpreter fix lint issues 2024-05-06 11:36:54 +08:00
multiclusteringress Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00
multiclusterservice Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00
overridepolicy pkg/webhook: test OverridePolicy 2024-09-13 10:14:04 +03:00
propagationpolicy remove pp/cpp name length limit 2024-08-16 10:34:15 +08:00
resourcebinding Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00
resourcedeletionprotection Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00
resourceinterpretercustomization Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00
work Adopt controller-runtime braking changes: generics support PR2783 2024-07-13 16:49:01 +08:00