forked from mtusi2026/mtusi2026lab5
86 lines
3.3 KiB
Makefile
86 lines
3.3 KiB
Makefile
PYTHON ?= python3
|
|
BASE_URL ?= http://localhost:8080
|
|
CA_FILE ?=
|
|
ACTION_SCRIPT ?=
|
|
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
|
|
|
.PHONY: help check validate test test-attachments test-pipeline test-pipeline-smoke test-outbox test-publisher-confirm-crash test-worker-crash test-failed-replay test-worker-outage test-broker-persistence test-docker load test-persistence test-failover replay-failed cleanup-staging
|
|
|
|
help:
|
|
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
|
|
|
|
check:
|
|
$(PYTHON) scripts/check_contract.py
|
|
|
|
validate:
|
|
$(PYTHON) scripts/validate_openapi.py
|
|
|
|
test:
|
|
$(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-attachments:
|
|
$(PYTHON) -m pytest -q tests/test_attachments.py
|
|
|
|
test-pipeline:
|
|
$(PYTHON) -m pytest -q tests/test_pipeline.py
|
|
|
|
test-pipeline-smoke:
|
|
$(PYTHON) tests/pipeline_smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-outbox:
|
|
$(PYTHON) tests/outbox_recovery.py --base-url "$(BASE_URL)" \
|
|
--stop-publisher-script scripts/stop-publisher.sh \
|
|
--start-publisher-script scripts/start-publisher.sh $(TLS_ARGS)
|
|
|
|
test-publisher-confirm-crash:
|
|
$(PYTHON) tests/publisher_confirm_crash.py --base-url "$(BASE_URL)" \
|
|
--stop-publisher-script scripts/stop-publisher.sh \
|
|
--crash-publisher-script scripts/crash-publisher-after-confirm.sh $(TLS_ARGS)
|
|
|
|
test-worker-crash:
|
|
$(PYTHON) tests/worker_crash.py --base-url "$(BASE_URL)" \
|
|
--stop-worker-script scripts/stop-worker.sh \
|
|
--crash-worker-script scripts/crash-worker.sh --mode objects $(TLS_ARGS)
|
|
$(PYTHON) tests/worker_crash.py --base-url "$(BASE_URL)" \
|
|
--stop-worker-script scripts/stop-worker.sh \
|
|
--crash-worker-script scripts/crash-worker.sh --mode commit $(TLS_ARGS)
|
|
|
|
test-failed-replay:
|
|
$(PYTHON) tests/failed_replay.py --base-url "$(BASE_URL)" \
|
|
--stop-worker-script scripts/stop-worker.sh \
|
|
--crash-worker-script scripts/crash-worker.sh \
|
|
--replay-script scripts/replay-attachment.sh $(TLS_ARGS)
|
|
|
|
test-worker-outage:
|
|
$(PYTHON) tests/worker_outage.py --base-url "$(BASE_URL)" \
|
|
--stop-worker-script scripts/stop-worker.sh \
|
|
--restart-api-script scripts/restart-api.sh \
|
|
--start-worker-script scripts/start-worker.sh $(TLS_ARGS)
|
|
|
|
test-broker-persistence:
|
|
$(PYTHON) tests/broker_persistence.py --base-url "$(BASE_URL)" \
|
|
--stop-worker-script scripts/stop-worker.sh \
|
|
--restart-broker-script scripts/restart-broker.sh \
|
|
--start-worker-script scripts/start-worker.sh $(TLS_ARGS)
|
|
|
|
test-docker:
|
|
docker compose -f compose.tests.yaml run --rm tests
|
|
|
|
load:
|
|
$(PYTHON) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-persistence:
|
|
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable restart hook"; exit 2)
|
|
$(PYTHON) tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-failover:
|
|
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2)
|
|
$(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
replay-failed:
|
|
@test -n "$(JOB_ID)" || (echo "Set JOB_ID"; exit 2)
|
|
docker compose --env-file .env run --rm publisher python -m app.tools.replay_failed --job-id "$(JOB_ID)"
|
|
|
|
cleanup-staging:
|
|
docker compose --env-file .env run --rm worker python -m app.tools.cleanup_staging --dry-run
|