Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(cat-gateway): schemathesis for health endpoints #1485

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
49005c0
wip
kukkok3 Nov 14, 2024
2d6f9a7
wip
kukkok3 Dec 18, 2024
1b162b5
wip
kukkok3 Dec 19, 2024
2eb01a3
Merge branch 'main' into feat/cat-gateway-test-pacckage
kukkok3 Dec 19, 2024
e25e84c
wip
kukkok3 Dec 20, 2024
cc8f968
wip
kukkok3 Dec 23, 2024
c62c9c3
Merge branch 'main' into feat/cat-gateway-test-pacckage
kukkok3 Dec 23, 2024
4870e10
wip
kukkok3 Dec 24, 2024
e44abaf
fix: remove scylla earthfile
kukkok3 Dec 24, 2024
32204d5
feat: runs schemathesis only on api/started endpoint
kukkok3 Dec 27, 2024
c269877
Merge branch 'main' into feat/cat-gateway-test-pacckage
kukkok3 Jan 2, 2025
8eafea3
clean up
kukkok3 Jan 2, 2025
8fc85c4
fix: blueprint
kukkok3 Jan 2, 2025
6f2152d
fix: blueprint
kukkok3 Jan 2, 2025
ea35972
fix: blueprint
kukkok3 Jan 2, 2025
e5030ff
fix: blueprint
kukkok3 Jan 2, 2025
9e9488f
fix: remove hooks
kukkok3 Jan 2, 2025
fd7f30a
Merge branch 'main' into feat/cat-gateway-test-pacckage
stevenj Jan 3, 2025
d124756
fix: remove some checks
kukkok3 Jan 3, 2025
82ac16b
Merge branch 'main' into feat/cat-gateway-test-pacckage
kukkok3 Jan 3, 2025
f50abf1
Merge branch 'main' into feat/cat-gateway-test-pacckage
kukkok3 Jan 3, 2025
bf6a866
Merge branch 'main' into feat/cat-gateway-test-pacckage
minikin Jan 6, 2025
956182d
Merge branch 'main' into feat/cat-gateway-test-pacckage
kukkok3 Jan 7, 2025
a30a4d2
feat: adds seed param to chemathesis package
kukkok3 Jan 7, 2025
9f2632e
fix: poetry
kukkok3 Jan 7, 2025
d353827
Merge branch 'main' into feat/cat-gateway-test-pacckage
kukkok3 Jan 7, 2025
f79cdec
fix: earthly dockerd bug
kukkok3 Jan 7, 2025
50137c7
fix: remove checks all param
kukkok3 Jan 7, 2025
29252d4
merge main
kukkok3 Jan 8, 2025
f6366f8
fix: remove duplicated function
kukkok3 Jan 8, 2025
20051b3
fix: regex
kukkok3 Jan 8, 2025
fff0fd7
Merge branch 'main' into feat/cat-gateway-test-pacckage
kukkok3 Jan 8, 2025
177aec0
Merge branch 'main' into feat/cat-gateway-test-pacckage
kukkok3 Jan 8, 2025
34eb89f
Merge branch 'main' into test/schemathesis-for-health-endpoints
kukkok3 Jan 8, 2025
63da9aa
adds all check
kukkok3 Jan 8, 2025
a4adf4d
Merge branch 'test/schemathesis-for-health-endpoints' of https://gith…
kukkok3 Jan 8, 2025
fd9b9f2
chore: clean up
kukkok3 Jan 9, 2025
ebd5d40
clean up
kukkok3 Jan 9, 2025
185c602
chore: update schemathesis version
kukkok3 Jan 9, 2025
813827a
fix: update schemathesis option to latest version
kukkok3 Jan 9, 2025
20e5fbd
fixes
kukkok3 Jan 9, 2025
7558708
fix: st target failing statment
kukkok3 Jan 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,8 @@ test-results/
/playwright/.cache/
extensions/
browser_extensions/
!catalyst_voices/packages/internal/catalyst_voices_driver/lib/src/extensions/
!catalyst_voices/packages/internal/catalyst_voices_driver/lib/src/extensions/

#Test report and coverage
*.junit-report.xml
*.coverage.info
Empty file removed Overall,
Empty file.
4 changes: 2 additions & 2 deletions catalyst-gateway/tests/schemathesis_tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__pycache__
junit-report.xml
.hypothesis/
.hypothesis/
cassette.yaml
24 changes: 16 additions & 8 deletions catalyst-gateway/tests/schemathesis_tests/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@
package-schemathesis:
FROM python:3.12-alpine3.20
# TODO: https://github.com/input-output-hk/catalyst-voices/issues/465
ARG openapi_spec
# optional argument that can be used to pass a --hypothesis-seed to replicate specific test failures
ARG seed
ARG version=3.39.5

RUN apk add --no-cache gcc musl-dev
RUN python -m pip install schemathesis==3.27.1
RUN python -m pip install schemathesis==$version
RUN mkdir /results
COPY ./hooks/hooks.py .
VOLUME /results
ARG openapi_spec
# optional argument that can be used to pass a --hypothesis-seed to replicate specific test failures
ARG seed
ENTRYPOINT st run --endpoint '^/api/v1/health' $openapi_spec \
ENTRYPOINT st run --include-path-regex '^/api/v1/health/' \
--exclude-path '/api/v1/health/inspection' \ #excluding since this is a internal debug endpoint
--checks=all $openapi_spec \
--workers=2 \
--wait-for-schema=120 \
--max-response-time=5000 \
--hypothesis-max-examples=1000 \
--data-generation-method=all \
--skip-deprecated-operations \
--exclude-deprecated \
--force-schema-version=30 \
--show-trace \
--force-color \
Expand All @@ -31,7 +35,7 @@
# test-fuzzer-api - Fuzzy test cat-gateway using openapi specs.
test-fuzzer-api:
FROM earthly/dind:alpine-3.19-docker-25.0.5-r0
RUN apk update && apk add iptables-legacy # workaround for https://github.com/earthly/earthly/issues/3784
RUN apk update && apk add iptables-legacy curl # workaround for https://github.com/earthly/earthly/issues/3784
COPY schemathesis-docker-compose.yml .
LET OPENAPI_SPEC="http://0.0.0.0:3030/docs/cat-gateway.json"
ARG seed
Expand All @@ -45,11 +49,15 @@
--service cat-gateway \
--allow-privileged

RUN docker run --net=host --name=st schemathesis:latest && \
RUN docker run --net=host --name=st schemathesis:latest || echo fail > fail; \
docker cp st:/results/junit-report.xml junit-report.xml && \
docker cp st:/results/cassette.yaml cassette.yaml
END
WAIT
SAVE ARTIFACT junit-report.xml AS LOCAL schemathesis.junit-report.xml
SAVE ARTIFACT cassette.yaml AS LOCAL cassette.yaml
END
IF [ -f fail ]
RUN --no-cache echo "Schemathesis test failed. Check the logs for more details" && \

Check failure on line 61 in catalyst-gateway/tests/schemathesis_tests/Earthfile

View workflow job for this annotation

GitHub Actions / ci / test / ./catalyst-gateway/tests/schemathesis_tests+test-fuzzer-api

Error

The command RUN --no-cache echo "Schemathesis test failed. Check the logs for more details" && exit 1 did not complete successfully. Exit code 1

Check failure on line 61 in catalyst-gateway/tests/schemathesis_tests/Earthfile

View workflow job for this annotation

GitHub Actions / test_reporting / Generate test reports

Error

The command RUN --no-cache echo "Schemathesis test failed. Check the logs for more details" && exit 1 did not complete successfully. Exit code 1

Check failure on line 61 in catalyst-gateway/tests/schemathesis_tests/Earthfile

View workflow job for this annotation

GitHub Actions / ci / test / ./catalyst-gateway/tests/schemathesis_tests+test-fuzzer-api

Error

The command RUN --no-cache echo "Schemathesis test failed. Check the logs for more details" && exit 1 did not complete successfully. Exit code 1

Check failure on line 61 in catalyst-gateway/tests/schemathesis_tests/Earthfile

View workflow job for this annotation

GitHub Actions / test_reporting / Generate test reports

Error

The command RUN --no-cache echo "Schemathesis test failed. Check the logs for more details" && exit 1 did not complete successfully. Exit code 1
exit 1
END
Loading