feat: package dark deployment runtime
All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 54s
All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 54s
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a028f0-a42f-7582-89a8-ebaad7343834
This commit is contained in:
parent
e408651545
commit
0941a2e5f4
9 changed files with 134 additions and 15 deletions
25
tests/test_config.py
Normal file
25
tests/test_config.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from sbom_nexus.config import database_target
|
||||
|
||||
|
||||
def test_database_target_prefers_secret_file(monkeypatch, tmp_path: Path) -> None:
|
||||
secret = tmp_path / "url"
|
||||
secret.write_text("postgresql://mounted-secret\n", encoding="utf-8")
|
||||
monkeypatch.setenv("SBOM_NEXUS_DATABASE_URL_FILE", str(secret))
|
||||
monkeypatch.setenv("SBOM_NEXUS_DATABASE_URL", "postgresql://environment")
|
||||
|
||||
assert database_target() == "postgresql://mounted-secret"
|
||||
|
||||
|
||||
def test_database_target_rejects_empty_secret_file(monkeypatch, tmp_path: Path) -> None:
|
||||
secret = tmp_path / "url"
|
||||
secret.write_text("\n", encoding="utf-8")
|
||||
monkeypatch.setenv("SBOM_NEXUS_DATABASE_URL_FILE", str(secret))
|
||||
|
||||
with pytest.raises(RuntimeError, match="is empty"):
|
||||
database_target()
|
||||
Loading…
Add table
Add a link
Reference in a new issue