#1017 Unit tests outside tests/unit/db write to highway_db_v2; root conftest runs UPDATEs via psql
Description
EditEARS: When any pytest run collects tests/unit/api or tests/, no test or hook shall write to highway_db_v2 unless HIGHWAY_DB_TESTS=1 and the target DB is a scratch database. Found during #1012: tests/unit/api/test_rate_limit_api.py (inserts/deletes highway.tool_rate_limits via db.get_db_manager().create_direct_connection) and tests/unit/api/test_gateway.py (psycopg.connect to DB_NAME default highway_db_v2, creates approval tokens) are not under tests/unit/db and are not guarded. tests/conftest.py pytest_sessionfinish runs 'UPDATE jumper.t_highway_internal ... cancelled' and 'UPDATE jumper.r_highway_internal ...' through psql against DB_NAME (default highway_db_v2); psql exists in highway-api (/usr/bin/psql), so any pytest run under tests/ inside highway-api performs these writes. Recommend: move both test modules under tests/unit/db (guarded) and gate the conftest cleanup on the same HIGHWAY_DB_TESTS + non-highway_db_v2 check.
Comments
Loading comments...
Context
Loading context...
Audit History
View AllLoading audit history...