fix: e2e/integration test infrastructure and Makefile test targets
- Fix make test: was pointing to non-existent api/tests/, now runs unit tests correctly with --ignore=e2e --ignore=integration - Remove dead phase test targets (test-phase1..4, test-all-phases) that all referenced cd api && pytest tests/ (non-existent path) - Add .test_admin_pass file: reset_admin_password.py now writes a persistent test password file alongside .admin_initial_password; the API never deletes it (unlike .admin_initial_password which is consumed on first startup) - Update both integration/conftest.py and e2e/helpers/admin_password.py to read .test_admin_pass before .admin_initial_password — so tests work after make restart without needing PIC_ADMIN_PASS env var - Add AI collaboration rules to CLAUDE.md (auto-loaded every session) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -223,17 +223,18 @@ restore:
|
||||
# ── Tests ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
test:
|
||||
@echo "Running all tests..."
|
||||
pytest tests/ api/tests/
|
||||
@echo "Running unit tests..."
|
||||
python3 -m pytest tests/ --ignore=tests/e2e --ignore=tests/integration -q
|
||||
|
||||
test-all:
|
||||
python3 api/tests/run_tests.py
|
||||
test-all: test test-integration test-e2e-api test-e2e-ui
|
||||
@echo "All test suites complete."
|
||||
|
||||
test-unit:
|
||||
pytest tests/
|
||||
python3 -m pytest tests/ --ignore=tests/e2e --ignore=tests/integration -q
|
||||
|
||||
test-coverage:
|
||||
pytest tests/ api/tests/ --cov=api --cov-report=html --cov-report=term-missing --cov-fail-under=70 -v
|
||||
python3 -m pytest tests/ --ignore=tests/e2e --ignore=tests/integration \
|
||||
--cov=api --cov-report=html --cov-report=term-missing --cov-fail-under=70 -v
|
||||
|
||||
test-integration:
|
||||
@echo "Running full integration tests (requires running PIC stack)..."
|
||||
@@ -244,14 +245,15 @@ test-integration-readonly:
|
||||
PIC_HOST=$${PIC_HOST:-localhost} python3 -m pytest tests/integration/test_live_api.py tests/integration/test_webui.py -v
|
||||
|
||||
test-api:
|
||||
cd api && python3 -m pytest tests/test_api_endpoints.py -v
|
||||
python3 -m pytest tests/test_api_endpoints.py -v
|
||||
|
||||
test-cli:
|
||||
cd api && python3 -m pytest tests/test_cli_tool.py -v
|
||||
python3 -m pytest tests/test_cli_tool.py -v
|
||||
|
||||
# ── E2E tests ─────────────────────────────────────────────────────────────────
|
||||
# Run `make test-e2e-deps` once to install dependencies, then use the other targets.
|
||||
# WG tests require wg-quick and run under sudo (passwordless sudo assumed on this host).
|
||||
# Admin password is read from data/api/.test_admin_pass (written by reset-test-admin-pass).
|
||||
# Override: make test-e2e-api PIC_ADMIN_PASS=mypassword
|
||||
|
||||
test-e2e-deps:
|
||||
sudo pip3 install --break-system-packages -r tests/e2e/requirements.txt
|
||||
@@ -282,20 +284,6 @@ show-admin-password:
|
||||
reset-admin-password:
|
||||
@sudo python3 scripts/reset_admin_password.py --generate
|
||||
|
||||
test-phase1:
|
||||
cd api && python3 -m pytest tests/test_network_manager.py tests/test_phase1_endpoints.py -v
|
||||
|
||||
test-phase2:
|
||||
cd api && python3 -m pytest tests/test_wireguard_manager.py tests/test_phase2_endpoints.py -v
|
||||
|
||||
test-phase3:
|
||||
cd api && python3 -m pytest tests/test_phase3_managers.py tests/test_phase3_endpoints.py -v
|
||||
|
||||
test-phase4:
|
||||
cd api && python3 -m pytest tests/test_phase4_routing.py tests/test_phase4_endpoints.py -v
|
||||
|
||||
test-all-phases:
|
||||
cd api && python3 -m pytest tests/ -v
|
||||
|
||||
# ── Network / peers ───────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user