Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yannh committed Dec 24, 2023
1 parent a182e2a commit 74a4e7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions acceptance.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 74a4e7e

Please sign in to comment.