mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-16 16:37:01 +00:00
Add simple regression tests for openapi2jsonschema
This commit is contained in:
parent
54e0b8f5bb
commit
dfd7a5a102
6 changed files with 11967 additions and 0 deletions
6
scripts/Dockerfile.bats
Normal file
6
scripts/Dockerfile.bats
Normal 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
9
scripts/Makefile
Normal 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
9
scripts/acceptance.bats
Normal 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
7097
scripts/fixtures/prometheus_v1-expected.json
Normal file
7097
scripts/fixtures/prometheus_v1-expected.json
Normal file
File diff suppressed because it is too large
Load diff
1
scripts/requirements.txt
Normal file
1
scripts/requirements.txt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
pyyaml
|
||||||
Loading…
Reference in a new issue