From 74a4e7e5e1421bf44343cb133ff9d19f18de678b Mon Sep 17 00:00:00 2001 From: Yann Hamon Date: Sun, 24 Dec 2023 17:58:29 +0100 Subject: [PATCH] fix tests --- acceptance.bats | 4 ++-- pkg/config/config.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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