Implement PostgreSQL production store path
All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 41s
All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 41s
Add the PostgreSQL backend, migration and stopped-write transfer tools, lease-aware deployment manifests, tenancy declarations, and shared conformance coverage. Persist grouping mutations in durable stores and separate process liveness from database readiness.
This commit is contained in:
parent
2063470ac8
commit
749461b97b
30 changed files with 2364 additions and 71 deletions
30
tests/postgres_backend.py
Normal file
30
tests/postgres_backend.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from tenant_engine.postgres_store import PostgresTenantStore
|
||||
|
||||
|
||||
def clean_postgres_store(tmp_path: Path) -> PostgresTenantStore:
|
||||
dsn = os.getenv("TENANT_ENGINE_TEST_DATABASE_URL", "").strip()
|
||||
if not dsn:
|
||||
pytest.skip("set TENANT_ENGINE_TEST_DATABASE_URL to exercise PostgreSQL conformance")
|
||||
try:
|
||||
import psycopg
|
||||
except ImportError:
|
||||
pytest.skip("install tenant-engine[postgres] to exercise PostgreSQL conformance")
|
||||
|
||||
migration = Path(__file__).parents[1] / "migrations/postgres/0001_tenant_store.sql"
|
||||
with psycopg.connect(dsn, autocommit=True) as connection:
|
||||
connection.execute(migration.read_text(encoding="utf-8"))
|
||||
connection.execute(
|
||||
"""TRUNCATE guardrail_changes, guardrail_overrides,
|
||||
idempotency_receipts, events, plans, grants, tenants
|
||||
RESTART IDENTITY CASCADE"""
|
||||
)
|
||||
url_file = tmp_path / "postgres-url"
|
||||
url_file.write_text(dsn, encoding="utf-8")
|
||||
return PostgresTenantStore(str(url_file), min_pool_size=1, max_pool_size=4)
|
||||
Loading…
Add table
Add a link
Reference in a new issue