72 lines
2.6 KiB
Makefile
72 lines
2.6 KiB
Makefile
PYTHON ?= python3
|
|
BASE_URL ?= https://localhost:8443
|
|
CA_FILE ?= secrets/ca.crt
|
|
COMPOSE_ENV_FILE ?= .env
|
|
export COMPOSE_ENV_FILE
|
|
COMPOSE = docker compose --env-file "$(COMPOSE_ENV_FILE)"
|
|
ACTION_SCRIPT ?=
|
|
TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
|
|
|
|
.PHONY: help bootstrap bao-setup up down check validate test test-observability load test-persistence test-failover test-failover-both test-security test-security-api test-security-internal test-expiry benchmark-argon2
|
|
|
|
help:
|
|
@echo "up: bootstrap and start; down: stop while keeping data; test: HTTPS API; test-observability: Grafana signals"
|
|
|
|
bootstrap:
|
|
$(PYTHON) scripts/bootstrap.py --env-file "$(COMPOSE_ENV_FILE)"
|
|
|
|
bao-setup: bootstrap
|
|
$(COMPOSE) up -d openbao
|
|
$(PYTHON) -m scripts.provision_openbao --env-file "$(COMPOSE_ENV_FILE)"
|
|
|
|
up: bao-setup
|
|
$(COMPOSE) up -d --build --wait
|
|
$(COMPOSE) exec -T broker sh -ec 'users=$$(rabbitmqctl -q list_users); for user in guest messenger; do if printf "%s\n" "$$users" | grep -q "^$$user[[:space:]]"; then rabbitmqctl -q delete_user "$$user"; fi; done'
|
|
|
|
down:
|
|
$(COMPOSE) down
|
|
|
|
check:
|
|
$(PYTHON) scripts/check_contract.py
|
|
|
|
validate:
|
|
$(PYTHON) scripts/validate_openapi.py
|
|
|
|
test:
|
|
$(PYTHON) tests/smoke.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-observability:
|
|
$(COMPOSE) -f compose.yaml -f compose.observability-tests.yaml run --rm observability-test
|
|
|
|
load:
|
|
$(PYTHON) tests/load.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-persistence: ACTION_SCRIPT := $(or $(ACTION_SCRIPT),scripts/restart.sh)
|
|
test-persistence:
|
|
$(PYTHON) tests/resilience.py --mode persistence --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-failover: ACTION_SCRIPT := $(or $(ACTION_SCRIPT),scripts/stop-one.sh)
|
|
test-failover:
|
|
$(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-security:
|
|
$(PYTHON) tests/security.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-security-api:
|
|
$(PYTHON) tests/security_grade3.py --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
test-expiry:
|
|
$(PYTHON) tests/security_grade3.py --expiry --base-url "$(BASE_URL)" $(TLS_ARGS)
|
|
|
|
benchmark-argon2:
|
|
$(COMPOSE) exec -T api python -m app.tools.benchmark_argon2
|
|
|
|
test-security-internal:
|
|
$(PYTHON) scripts/bootstrap.py --test-fixtures --env-file "$(COMPOSE_ENV_FILE)"
|
|
$(COMPOSE) -f compose.yaml -f compose.security-tests.yaml build security-test
|
|
$(COMPOSE) -f compose.yaml -f compose.security-tests.yaml run --rm --no-deps security-test
|
|
|
|
test-failover-both: ACTION_SCRIPT := $(or $(ACTION_SCRIPT),scripts/stop-one.sh)
|
|
test-failover-both:
|
|
$(PYTHON) tests/failover_both.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
|