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
33
tests/test_backend_selection.py
Normal file
33
tests/test_backend_selection.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
from dataclasses import replace
|
||||
|
||||
import pytest
|
||||
|
||||
from tenant_engine.config import Settings
|
||||
from tenant_engine.main import _build_store
|
||||
from tenant_engine.sqlite_store import SQLiteTenantStore
|
||||
|
||||
|
||||
def _settings() -> Settings:
|
||||
return Settings(
|
||||
flex_auth_base_url=None,
|
||||
flex_auth_timeout_seconds=1,
|
||||
host="127.0.0.1",
|
||||
port=8090,
|
||||
)
|
||||
|
||||
|
||||
def test_store_selection_defaults_to_memory_and_selects_sqlite(tmp_path) -> None:
|
||||
assert _build_store(_settings()) is None
|
||||
store = _build_store(replace(_settings(), database_path=str(tmp_path / "tenant.db")))
|
||||
assert isinstance(store, SQLiteTenantStore)
|
||||
|
||||
|
||||
def test_store_selection_refuses_ambiguous_configuration(tmp_path) -> None:
|
||||
with pytest.raises(RuntimeError, match="ambiguous store configuration"):
|
||||
_build_store(
|
||||
replace(
|
||||
_settings(),
|
||||
database_path=str(tmp_path / "tenant.db"),
|
||||
database_url_file=str(tmp_path / "database-url"),
|
||||
)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue