forked from mtusi2026/mtusi2026lab4
57 lines
2.2 KiB
Makefile
57 lines
2.2 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 load test-persistence test-failover \
|
|
test-student test-attachments test-orphans test-s3-outage test-upload-memory check-s3-private evidence
|
|
|
|
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)
|
|
|
|
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)
|
|
|
|
# ---- lab4: собственные проверки (стенд должен быть запущен) ----
|
|
test-student:
|
|
$(PYTHON) student-tests/run.py --base-url "$(BASE_URL)"
|
|
$(PYTHON) student-tests/idempotency.py --base-url "$(BASE_URL)"
|
|
|
|
test-attachments:
|
|
$(PYTHON) student-tests/attachments.py --base-url "$(BASE_URL)"
|
|
|
|
# Нужна реплика с внедрением отказов: docker compose --env-file .env --profile fault up -d api-fault
|
|
test-orphans:
|
|
$(PYTHON) student-tests/orphans.py --base-url "$(BASE_URL)" --fault-url http://localhost:8082
|
|
|
|
test-s3-outage:
|
|
$(PYTHON) student-tests/s3_outage.py --base-url "$(BASE_URL)"
|
|
|
|
test-upload-memory:
|
|
$(PYTHON) student-tests/upload_memory.py --base-url "$(BASE_URL)" --concurrency 10 --output evidence/upload-memory-10.json
|
|
|
|
check-s3-private:
|
|
sh scripts/check-s3-private.sh
|
|
|
|
# Все проверки lab4 подряд с сохранением вывода в evidence/ (кроссплатформенно, Python)
|
|
evidence:
|
|
$(PYTHON) student-tests/collect_evidence.py --base-url "$(BASE_URL)"
|