From ea3c592d63cdacb957c8982061bf8f011cefc1b9 Mon Sep 17 00:00:00 2001 From: Yann Hamon Date: Sun, 26 Sep 2021 23:27:03 +0200 Subject: [PATCH] HTTP acceptance test for openapi2jsonschema --- scripts/acceptance.bats | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/acceptance.bats b/scripts/acceptance.bats index 811017c..dc66f75 100644 --- a/scripts/acceptance.bats +++ b/scripts/acceptance.bats @@ -1,5 +1,9 @@ #!/usr/bin/env bats +setup() { + rm -f prometheus_v1.json +} + @test "Should generate expected prometheus resource" { run ./openapi2jsonschema.py fixtures/prometheus-operator-0prometheusCustomResourceDefinition.yaml [ "$status" -eq 0 ] @@ -7,3 +11,11 @@ run diff prometheus_v1.json ./fixtures/prometheus_v1-expected.json [ "$status" -eq 0 ] } + +@test "Should generate expected prometheus resource from an HTTP resource" { + run ./openapi2jsonschema.py https://raw.githubusercontent.com/yannh/kubeconform/aebc298047c386116eeeda9b1ada83671a58aedd/scripts/fixtures/prometheus-operator-0prometheusCustomResourceDefinition.yaml + [ "$status" -eq 0 ] + [ "$output" = "JSON schema written to prometheus_v1.json" ] + run diff prometheus_v1.json ./fixtures/prometheus_v1-expected.json + [ "$status" -eq 0 ] +}