diff --git a/acceptance.bats b/acceptance.bats index a59fe38..8a7e180 100755 --- a/acceptance.bats +++ b/acceptance.bats @@ -182,8 +182,8 @@ resetCacheFolder() { @test "Fail early when passing a non valid -kubernetes-version" { run bin/kubeconform -kubernetes-version 1.25 fixtures/valid.yaml - [[ "$output" == "invalid value "1.25" for flag -kubernetes-version: 1.25 is not a valid version. Valid values are 'master' (default) or full version x.y.z (e.g. '1.27.2')"* ]] - [[ `echo "$output" | wc -l` -eq 1 ]] + [ "${lines[0]}" == 'invalid value "1.25" for flag -kubernetes-version: 1.25 is not a valid version. Valid values are "master" (default) or full version x.y.z (e.g. "1.27.2")' ] + [[ "${lines[1]}" == "Usage:"* ]] [ "$status" -eq 1 ] } diff --git a/pkg/config/config.go b/pkg/config/config.go index 336959e..79447eb 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -52,7 +52,7 @@ func (kv k8sVersionValue) MarshalText() ([]byte, error) { func (kv *k8sVersionValue) UnmarshalText(v []byte) error { if ok, _ := regexp.MatchString(`^(master|\d+\.\d+\.\d+)$`, string(v)); ok != true { - return fmt.Errorf("%v is not a valid version. Valid values are 'master' (default) or full version x.y.z (e.g. '1.27.2')", kv.String()) + return fmt.Errorf("%v is not a valid version. Valid values are \"master\" (default) or full version x.y.z (e.g. \"1.27.2\")", string(v)) } *kv = k8sVersionValue(v) return nil