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.
33 lines
1,007 B
Python
33 lines
1,007 B
Python
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"),
|
|
)
|
|
)
|