Add simple regression tests for openapi2jsonschema

This commit is contained in:
Yann Hamon 2021-09-26 13:46:05 +02:00
parent 54e0b8f5bb
commit dfd7a5a102
6 changed files with 11967 additions and 0 deletions

6
scripts/Dockerfile.bats Normal file
View file

@ -0,0 +1,6 @@
FROM python:3.9.7-alpine3.14
RUN apk --no-cache add bats
COPY acceptance.bats openapi2jsonschema.py requirements.txt /code/
COPY fixtures /code/fixtures
WORKDIR /code
RUN pip install -r requirements.txt

9
scripts/Makefile Normal file
View file

@ -0,0 +1,9 @@
#!/usr/bin/make -f
# This is really early days
build-python-bats:
docker build -t python-bats -f Dockerfile.bats .
docker-acceptance: build-python-bats
docker run --entrypoint "/usr/bin/bats" -t python-bats /code/acceptance.bats

9
scripts/acceptance.bats Normal file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bats
@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 ]
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

1
scripts/requirements.txt Normal file
View file

@ -0,0 +1 @@
pyyaml