From c4fcd76214689c74a3521067901397b60e7ba847 Mon Sep 17 00:00:00 2001 From: Francois Poinsot Date: Thu, 23 Nov 2023 12:44:25 +0100 Subject: [PATCH] test with a valid mapping --- Dockerfile.bats | 1 + acceptance.bats | 5 +++++ fixtures/expected_unkown_field.yaml | 12 ++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 fixtures/expected_unkown_field.yaml diff --git a/Dockerfile.bats b/Dockerfile.bats index 964b39b..3016301 100644 --- a/Dockerfile.bats +++ b/Dockerfile.bats @@ -3,3 +3,4 @@ RUN apk --no-cache add ca-certificates parallel libxml2-utils COPY dist/kubeconform_linux_amd64_v1/kubeconform /code/bin/ COPY acceptance.bats acceptance-nonetwork.bats /code/ COPY fixtures /code/fixtures +COPY scripts/fixtures/mapping_v2-expected.json /code/fixtures/registry/mapping_v2.json diff --git a/acceptance.bats b/acceptance.bats index a9d3bcd..906681e 100755 --- a/acceptance.bats +++ b/acceptance.bats @@ -345,3 +345,8 @@ resetCacheFolder() { run bash -c "bin/kubeconform -schema-location default -schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' fixtures/httpproxy.yaml" [ "$status" -eq 0 ] } + +@test "Pass when parsing a valid Kubernetes config with an expected unknown field" { + run bin/kubeconform -schema-location default -schema-location 'fixtures/registry/mapping_v2.json' fixtures/expected_unkown_field.yaml + [ "$status" -eq 0 ] +} \ No newline at end of file diff --git a/fixtures/expected_unkown_field.yaml b/fixtures/expected_unkown_field.yaml new file mode 100644 index 0000000..75d97ea --- /dev/null +++ b/fixtures/expected_unkown_field.yaml @@ -0,0 +1,12 @@ +apiVersion: getambassador.io/v2 +kind: Mapping +metadata: + name: emissary + namespace: default +spec: + # `spec` is tagged with x-kubernetes-preserve-unknown-fields and `ambassador_id` is not declared + ambassador_id: + - this-ambassador + host: some-host.dev + prefix: / + service: some-service.this-namespace.cluster.local \ No newline at end of file