@@ -3,21 +3,25 @@ VERSION 0.8
3
3
package-schemathesis :
4
4
FROM python:3.12-alpine3.20
5
5
# TODO: https://github.com/input-output-hk/catalyst-voices/issues/465
6
+ ARG openapi_spec
7
+ # optional argument that can be used to pass a --hypothesis-seed to replicate specific test failures
8
+ ARG seed
9
+ ARG version= 3.39.5
10
+
6
11
RUN apk add --no-cache gcc musl-dev
7
- RUN python -m pip install schemathesis== 3.27.1
12
+ RUN python -m pip install schemathesis== $version
8
13
RUN mkdir /results
9
14
COPY ./hooks/hooks.py .
10
15
VOLUME /results
11
- ARG openapi_spec
12
- # optional argument that can be used to pass a --hypothesis-seed to replicate specific test failures
13
- ARG seed
14
- ENTRYPOINT st run --endpoint '^/api/v1/health' $openapi_spec \
16
+ ENTRYPOINT st run --include-path-regex '^/api/v1/health/' \
17
+ --exclude-path '/api/v1/health/inspection' \ #excluding since this is a internal debug endpoint
18
+ --checks = all $openapi_spec \
15
19
--workers = 2 \
16
20
--wait-for-schema = 120 \
17
21
--max-response-time = 5000 \
18
22
--hypothesis-max-examples = 1000 \
19
23
--data-generation-method = all \
20
- --skip -deprecated-operations \
24
+ --exclude -deprecated \
21
25
--force-schema-version = 30 \
22
26
--show-trace \
23
27
--force-color \
@@ -31,7 +35,7 @@ package-schemathesis:
31
35
# test-fuzzer-api - Fuzzy test cat-gateway using openapi specs.
32
36
test-fuzzer-api :
33
37
FROM earthly/dind:alpine-3.19-docker-25.0.5-r0
34
- RUN apk update && apk add iptables-legacy # workaround for https://github.com/earthly/earthly/issues/3784
38
+ RUN apk update && apk add iptables-legacy curl # workaround for https://github.com/earthly/earthly/issues/3784
35
39
COPY schemathesis-docker-compose.yml .
36
40
LET OPENAPI_SPEC= "http://0.0.0.0:3030/docs/cat-gateway.json"
37
41
ARG seed
@@ -45,11 +49,15 @@ test-fuzzer-api:
45
49
--service cat-gateway \
46
50
--allow-privileged
47
51
48
- RUN docker run --net = host --name = st schemathesis:latest && \
52
+ RUN docker run --net = host --name = st schemathesis:latest || echo fail > fail ; \
49
53
docker cp st:/results/junit-report.xml junit-report.xml && \
50
54
docker cp st:/results/cassette.yaml cassette.yaml
51
55
END
52
56
WAIT
53
57
SAVE ARTIFACT junit-report.xml AS LOCAL schemathesis.junit-report.xml
54
58
SAVE ARTIFACT cassette.yaml AS LOCAL cassette.yaml
59
+ END
60
+ IF [ -f fail ]
61
+ RUN --no-cache echo "Schemathesis test failed. Check the logs for more details" && \
62
+ exit 1
55
63
END
0 commit comments