You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to refactor and cleanup webhooks validation, as we realized that we could increase readability and test coverage
Acceptance criteria
The file api/policies/v1/policy_validation_matchconditions.go was copy-pasted from k8s.io/kubernetes (see license, copyright, comment at its beginning). We tried to import as-is, but it makes more sense to own it instead. For that:
Enable linter in the file (check golangci-lint.yml).
Consider moving its functions into api/policies/v1/policy_validation.go and perform any cleanup necessary.
Factories should be refactored with the builder pattern.
Add integration tests for the webhooks methods: ValidateCreate, ValidateDelete, and ValidateUpdate.
ATM We test each validator in isolation (see policy_validation_test.go), however, we do not test that the validators are correctly integrated into the webhooks. We could for instance add just a couple of test cases: one with a valid resource and one with a resource that all fields in an invalid state, so that we are sure we are passing through the right validators.
The text was updated successfully, but these errors were encountered:
We need to refactor and cleanup webhooks validation, as we realized that we could increase readability and test coverage
Acceptance criteria
api/policies/v1/policy_validation_matchconditions.go
was copy-pasted from k8s.io/kubernetes (see license, copyright, comment at its beginning). We tried to import as-is, but it makes more sense to own it instead. For that:golangci-lint.yml
).api/policies/v1/policy_validation.go
and perform any cleanup necessary.ValidateCreate
,ValidateDelete
, andValidateUpdate
.ATM We test each validator in isolation (see
policy_validation_test.go
), however, we do not test that the validators are correctly integrated into the webhooks. We could for instance add just a couple of test cases: one with a valid resource and one with a resource that all fields in an invalid state, so that we are sure we are passing through the right validators.The text was updated successfully, but these errors were encountered: