From b33767a477f481be21935327f4af169250456293 Mon Sep 17 00:00:00 2001 From: Yann Hamon Date: Sun, 15 Nov 2020 16:24:27 +0100 Subject: [PATCH] fix acc tests --- acceptance.bats | 6 +++--- pkg/registry/registry.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/acceptance.bats b/acceptance.bats index df19fd2..398c529 100755 --- a/acceptance.bats +++ b/acceptance.bats @@ -114,7 +114,7 @@ } @test "Pass when using a valid HTTP -schema-location" { - run bin/kubeconform -schema-location 'https://kubernetesjsonschema.dev/{{ .NormalizedVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json' fixtures/valid.yaml + run bin/kubeconform -schema-location 'https://kubernetesjsonschema.dev/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json' fixtures/valid.yaml [ "$status" -eq 0 ] } @@ -129,12 +129,12 @@ } @test "Pass with a valid input when validating against openshift manifests" { - run bin/kubeconform -kubernetes-version 3.8.0 -schema-location 'https://raw.githubusercontent.com/garethr/openshift-json-schema/master/{{ .NormalizedVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}.json' -summary fixtures/valid.yaml + run bin/kubeconform -kubernetes-version 3.8.0 -schema-location 'https://raw.githubusercontent.com/garethr/openshift-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}.json' -summary fixtures/valid.yaml [ "$status" -eq 0 ] } @test "Fail with an invalid input when validating against openshift manifests" { - run bin/kubeconform -kubernetes-version 3.8.0 -schema-location 'https://raw.githubusercontent.com/garethr/openshift-json-schema/master/{{ .NormalizedVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}.json' -summary fixtures/invalid.yaml + run bin/kubeconform -kubernetes-version 3.8.0 -schema-location 'https://raw.githubusercontent.com/garethr/openshift-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}.json' -summary fixtures/invalid.yaml [ "$status" -eq 1 ] } diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go index b7c8e20..6ddfbb7 100644 --- a/pkg/registry/registry.go +++ b/pkg/registry/registry.go @@ -69,7 +69,7 @@ func schemaPath(tpl, resourceKind, resourceAPIVersion, k8sVersion string, strict func New(schemaLocation string, strict bool, skipTLS bool) Registry { if !strings.HasSuffix(schemaLocation, "json") { // If we dont specify a full templated path, we assume the paths of kubernetesjsonschema.dev - schemaLocation += "/{{ .NormalizedVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json" + schemaLocation += "/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json" } if strings.HasPrefix(schemaLocation, "http") {