Define NoOptDefVal for validate flag

validate flag does not have default value defined when there is no
parameter passed, therefore it tries to use next irrelevant flag.

This PR defines NoOptDefVal for validate flag which is set "strict".
This commit is contained in:
Arda Güçlü
2022-05-06 10:25:40 +03:00
parent 7141b6d58d
commit 0245e74590
2 changed files with 10 additions and 0 deletions

View File

@@ -170,6 +170,12 @@ run_kubectl_create_validate_tests() {
create_and_use_new_namespace
## test --validate no value expects default strict is used
kube::log::status "Testing kubectl create --validate"
# create and verify
output_message=$(! kubectl create -f hack/testdata/invalid-deployment-unknown-and-duplicate-fields.yaml --validate 2>&1)
has_one_of_error_message "${output_message}" 'strict decoding error' 'error validating data'
## test --validate=true
kube::log::status "Testing kubectl create --validate=true"
# create and verify