videogen/tests/reelforge/test_cloud_runtime_env.py
caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

95 lines
2.5 KiB
Python

"""Secret-boundary tests for the shared cloud runtime launcher."""
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
SCRIPT = ROOT / "scripts" / "cloud-runtime-env.py"
def _minimal_env() -> dict[str, str]:
return {
"PATH": os.environ.get("PATH", ""),
"SYSTEMROOT": os.environ.get("SYSTEMROOT", ""),
}
def test_non_storage_profile_does_not_import_r2_secret(tmp_path: Path) -> None:
dotenv = tmp_path / ".env"
dotenv.write_text(
"DATABASE_URL=postgresql://user:pass@db.example.test/mint\n"
"R2_SECRET_ACCESS_KEY=must-not-cross-profile-boundary\n",
encoding="utf-8",
)
child = (
"import os,sys; "
"sys.exit(0 if 'R2_SECRET_ACCESS_KEY' not in os.environ else 9)"
)
result = subprocess.run(
[
sys.executable,
str(SCRIPT),
"mint",
"--env-file",
str(dotenv),
"--",
sys.executable,
"-c",
child,
],
env=_minimal_env(),
capture_output=True,
text=True,
check=False,
)
assert result.returncode == 0, result.stderr
def test_psql_command_is_rejected_as_database_url(tmp_path: Path) -> None:
dotenv = tmp_path / ".env"
dotenv.write_text(
"DATABASE_URL=psql postgresql://user:pass@db.example.test/mint\n",
encoding="utf-8",
)
result = subprocess.run(
[sys.executable, str(SCRIPT), "mint", "--env-file", str(dotenv), "--check"],
env=_minimal_env(),
capture_output=True,
text=True,
check=False,
)
assert result.returncode == 2
assert "not a psql command" in result.stderr
assert "user:pass" not in result.stderr
def test_reelforge_bucket_precedence_prefers_product_specific_name() -> None:
env = _minimal_env()
env.update(
{
"PYTHONPATH": f"{ROOT / 'apps' / 'api'}:{ROOT}",
"REELFORGE_R2_BUCKET_NAME": "reelforge-private",
"R2_BUCKET_NAME": "shared-development",
"R2_BUCKET": "legacy",
}
)
result = subprocess.run(
[
sys.executable,
"-c",
"from app.config import config; "
"assert config.r2['bucket'] == 'reelforge-private'",
],
cwd=ROOT,
env=env,
capture_output=True,
text=True,
check=False,
)
assert result.returncode == 0, result.stderr