fix: commit migration role assumption
All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 41s

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a02b22-9638-76d2-bbff-b7ea1770b118
This commit is contained in:
tegwick 2026-08-23 00:16:54 +02:00
parent 9751927d38
commit b1fd3ec131
4 changed files with 32 additions and 3 deletions

View file

@ -5,6 +5,21 @@ from pathlib import Path
from sbom_nexus import database
def test_migration_role_commits_autobegin_before_alembic_transaction() -> None:
events: list[str] = []
class Connection:
def exec_driver_sql(self, statement: str) -> None:
events.append(statement)
def commit(self) -> None:
events.append("COMMIT")
database.assume_migration_role(Connection(), "sbom_nexus_owner")
assert events == ['SET ROLE "sbom_nexus_owner"', "COMMIT"]
def test_dynamic_connection_factory_rereads_mounted_url(monkeypatch, tmp_path: Path) -> None:
secret = tmp_path / "url"
observed: list[str] = []