ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Fix CI: test seeds and leaked SQLite FK mode
Juan Denisd692e998b5a7
diff --git a/backend/tests/conftest.py b/backend/tests/conftest.pyindex fd23be8e..1154003b 100644--- a/backend/tests/conftest.py+++ b/backend/tests/conftest.py@@ -97,6 +97,20 @@ try:cur.execute('PRAGMA journal_mode=MEMORY')cur.execute('PRAGMA temp_store=MEMORY')cur.close()++ from sqlalchemy.pool import Pool # noqa: E402++ @event.listens_for(Pool, 'checkout')+ def _foreign_keys_off_per_checkout(dbapi_connection, _record, _proxy):+ """Every checkout starts at SQLite's default: no FK enforcement.++ A test that turns enforcement on does it on the connection it checked+ out, but its cleanup could land on a different pooled connection, so+ an enforcing one leaked into later tests (CI failed+ test_workspace_scope depending only on which shard it landed in).+ """+ if isinstance(dbapi_connection, sqlite3.Connection):+ dbapi_connection.execute('PRAGMA foreign_keys=OFF')except ImportError:passdiff --git a/backend/tests/test_git_compose_deploy.py b/backend/tests/test_git_compose_deploy.pyindex 6dec476f..07644d15 100644--- a/backend/tests/test_git_compose_deploy.py+++ b/backend/tests/test_git_compose_deploy.py@@ -10,6 +10,8 @@ import subprocessimport pytest+from factories import make_application+from app import dbfrom app.models.application import Applicationfrom app.services import deploy_preflight_service as preflight@@ -77,12 +79,9 @@ def test_a_dockerfile_only_repository_is_unchanged(app, client, auth_headers, mo# --- deploy ---------------------------------------------------------------def _app(compose=True, app_type='docker'):- row = Application(name='bench', app_type=app_type, status='running', root_path='/srv/bench', user_id=1,- compose_file='docker-compose.yml' if compose else None,- managed_by='docker_compose' if compose else None)- db.session.add(row)- db.session.commit()- return row+ return make_application(db, name='bench', app_type=app_type, status='running', root_path='/srv/bench',+ docker_image=None, compose_file='docker-compose.yml' if compose else None,+ managed_by='docker_compose' if compose else None)@pytest.fixture