111 lines
3.8 KiB
Makefile
111 lines
3.8 KiB
Makefile
PYTHON ?= python3
|
|
GO ?= go
|
|
BASE_URL ?= http://127.0.0.1:8084
|
|
CA_FILE ?=
|
|
ACTION_SCRIPT ?=
|
|
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
|
COMPOSE ?= ./scripts/compose.sh
|
|
COMPOSE_ARGS = --env-file .env
|
|
IMAGE ?= mtusi-messenger-lab4-melnikov:local
|
|
GIT_REVISION ?= $(shell git rev-parse HEAD 2>/dev/null || echo unknown)
|
|
export GIT_REVISION
|
|
export API_IMAGE ?= $(IMAGE)
|
|
|
|
.PHONY: help check validate env up wait build-image docker-config stop down purge logs ps \
|
|
test load test-persistence test-failover test-student test-student-race \
|
|
test-attachment test-container test-consistency experiment clean-clone py39 collect-evidence
|
|
|
|
help:
|
|
@echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API"
|
|
@echo "env: create ignored .env and infra/seaweedfs-s3.json; up: build+start stack; wait: wait for /health/ready"
|
|
@echo "stop: stop containers (data kept); down: remove containers (volumes kept); purge: DELETE volumes and data"
|
|
@echo "test-student: Go tests + black-box lab4 suite; test-student-race: Go race detector"
|
|
@echo "test-persistence: ACTION_SCRIPT=scripts/restart.sh; test-failover: ACTION_SCRIPT=scripts/stop-one.sh"
|
|
@echo "test-attachment: upload limits/ACL/consistency negatives; test-container: infra/S3 privacy checks"
|
|
@echo "test-consistency: reconciler dry-run/apply/grace scenario (track 2)"
|
|
@echo "experiment: >=10 concurrent uploads with API RSS sampling"
|
|
@echo "clean-clone: build and smoke a fresh clone with empty volumes; py39: run suites on Python 3.9"
|
|
@echo "collect-evidence: rerun all mandatory/own checks and keep raw stdout in evidence/commands"
|
|
|
|
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)
|
|
|
|
env:
|
|
./scripts/init-env.sh
|
|
|
|
up:
|
|
@test -f .env || (echo "Run make env first" >&2; exit 2)
|
|
GIT_REVISION="$(GIT_REVISION)" API_IMAGE="$(IMAGE)" $(COMPOSE) $(COMPOSE_ARGS) up -d --build
|
|
./scripts/wait-ready.sh
|
|
|
|
wait:
|
|
./scripts/wait-ready.sh
|
|
|
|
build-image:
|
|
@test -f .env || (echo "Run make env first" >&2; exit 2)
|
|
GIT_REVISION="$(GIT_REVISION)" API_IMAGE="$(IMAGE)" $(COMPOSE) $(COMPOSE_ARGS) build api
|
|
|
|
docker-config:
|
|
GIT_REVISION="$(GIT_REVISION)" API_IMAGE="$(IMAGE)" $(COMPOSE) $(COMPOSE_ARGS) config --quiet
|
|
|
|
stop:
|
|
$(COMPOSE) $(COMPOSE_ARGS) stop
|
|
|
|
down:
|
|
$(COMPOSE) $(COMPOSE_ARGS) down
|
|
|
|
purge:
|
|
@echo "PURGE removes containers AND named volumes mtusi-lab4-melnikov-*: all synthetic data is lost."
|
|
$(COMPOSE) $(COMPOSE_ARGS) down -v
|
|
|
|
logs:
|
|
$(COMPOSE) $(COMPOSE_ARGS) logs --tail=100 api
|
|
|
|
ps:
|
|
$(COMPOSE) $(COMPOSE_ARGS) ps
|
|
|
|
test-persistence:
|
|
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable restart hook" >&2; 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" >&2; exit 2)
|
|
$(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-student:
|
|
$(GO) test -count=1 ./...
|
|
$(PYTHON) student-tests/blackbox.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-student-race:
|
|
$(GO) test -race -count=1 ./...
|
|
|
|
test-attachment:
|
|
$(PYTHON) student-tests/attachment-checks.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-container:
|
|
$(PYTHON) scripts/container-checks.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-consistency:
|
|
$(PYTHON) scripts/track2.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
experiment:
|
|
$(PYTHON) scripts/upload-experiment.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
clean-clone:
|
|
./scripts/clean-clone-check.sh
|
|
|
|
py39:
|
|
./scripts/py39-tests.sh
|
|
|
|
collect-evidence:
|
|
./scripts/collect-evidence.sh
|