chore: switch to all-SQLite stack (drop Postgres service)

This commit is contained in:
Jonas Miederer 2026-09-07 08:39:06 +00:00
parent 74831483eb
commit 7d5ade6b6a
12 changed files with 104 additions and 62 deletions

View file

@ -1,7 +1,8 @@
"""Manual end-to-end smoke: real LFX + real API, frontend-shaped calls.
Usage (from backend/):
TEST_DATABASE_URL=postgresql+psycopg://... uv run python scripts/smoke_e2e.py
uv run python scripts/smoke_e2e.py
Runs the API against a throwaway SQLite file and an ephemeral LFX pass.
Exits non-zero on any unexpected status/body.
"""
@ -11,7 +12,7 @@ import json
import os
import subprocess
import sys
import time
import tempfile
import urllib.request
from pathlib import Path
@ -54,17 +55,31 @@ def check(name: str, cond: bool, detail: str = "") -> None:
def main() -> None:
tmp = Path(tempfile.mkdtemp(prefix="kirche-smoke-"))
flow_dir = Path("/tmp/smoke-e2e-flows")
flow_dir.mkdir(exist_ok=True)
(flow_dir / "seed.json").write_text(
(FIXTURES / "simple_rule.json").read_text()
)
# Migrate a throwaway SQLite schema to head before starting the API.
from alembic import command as alembic_command
from alembic.config import Config
db_url = f"sqlite:///{tmp / 'smoke.db'}"
cfg = Config()
cfg.set_main_option("script_location", str(BACKEND / "migrations"))
cfg.set_main_option("sqlalchemy.url", db_url)
alembic_command.upgrade(cfg, "head")
env = {
**os.environ,
# lfx prefers LANGFLOW_API_KEY over LFX_API_KEY; the repo .env may set
# it. Clear it so the serve key below is the one we send.
"LANGFLOW_API_KEY": "",
"LFX_API_KEY": LFX_KEY,
"DATABASE_URL": os.environ["TEST_DATABASE_URL"],
"DATABASE_URL": db_url,
"FLOWS_WATCH_ENABLED": "false",
"LFX_URL": f"http://127.0.0.1:{LFX_PORT}",
"LFX_API_KEY": LFX_KEY,
"CALLBACK_BASE_URL": f"http://127.0.0.1:{API_PORT}",
}
lfx = subprocess.Popen(