Skip to content

Commit

Permalink
HTTP acceptance test for openapi2jsonschema
Browse files Browse the repository at this point in the history
  • Loading branch information
yannh committed Sep 26, 2021
1 parent aebc298 commit ea3c592
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/acceptance.bats
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
#!/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 ]
[ "$output" = "JSON schema written to prometheus_v1.json" ]
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 ]
}

0 comments on commit ea3c592

Please sign in to comment.