-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (35 loc) · 1.62 KB
/
Makefile
File metadata and controls
45 lines (35 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
COMPOSE := docker compose -f packages/core/src/dynastore/docker/docker-compose.yml -f packages/core/src/dynastore/docker/docker-compose.dev.yml
PYTEST := .venv/bin/pytest
.PHONY: help db-up db-down db-wait test test-unit test-integration test-coverage clean
help:
@echo "DynaStore developer targets:"
@echo " make db-up Start the test database (host-bound 127.0.0.1:54320)"
@echo " make db-down Stop and remove the test database (drops volumes)"
@echo " make test Run unit + integration tests (requires db-up)"
@echo " make test-unit Run unit tests only (no database required for most)"
@echo " make test-integration Run integration tests only (requires db-up)"
@echo " make test-coverage Run full suite with coverage report"
@echo " make clean Remove pytest cache and coverage artefacts"
db-up:
$(COMPOSE) up -d db
@$(MAKE) --no-print-directory db-wait
db-down:
$(COMPOSE) down -v
db-wait:
@echo "Waiting for postgres on 127.0.0.1:54320..."
@for i in $$(seq 1 30); do \
if docker compose -f packages/core/src/dynastore/docker/docker-compose.yml exec -T db pg_isready -U testuser -d gis_dev >/dev/null 2>&1; then \
echo "Database ready."; exit 0; \
fi; sleep 1; \
done; \
echo "Database did not become ready in 30s." >&2; exit 1
test: db-up
$(PYTEST) tests -vv
test-unit:
$(PYTEST) tests --ignore-glob="**/integration/*" -vv
test-integration: db-up
$(PYTEST) tests/dynastore -k integration -vv
test-coverage: db-up
$(PYTEST) tests --cov=packages/core/src/dynastore --cov-report=term --cov-report=html
clean:
rm -rf .pytest_cache htmlcov .coverage