videogen/tests/reelforge/test_ops_smoke.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

69 lines
2.5 KiB
Python

"""Coverage for the in-process run harness (``ops/smoke.py``).
The smoke harness boots the real ``app.asgi:app`` behind a Starlette
``TestClient`` and exercises a handful of existing endpoints. This test makes the
harness itself part of the suite so a regression that breaks the operator's
one-command smoke check is caught by CI, not just at run time.
It is fully hermetic: ``ops.smoke`` fills a self-contained test environment
(in-memory SQLite + placeholder ``R2_*`` / ``SOCIAL_TOKEN_KEY``) via
``setdefault``, so these tests need no external services. We still set the same
values defensively so the test is order-independent within the suite.
"""
from __future__ import annotations
import os
import pytest
# Ensure the hermetic env exists before ``ops.smoke`` imports the app (harmless
# if the harness or a sibling test already set them — ``setdefault`` semantics).
for _key, _value in {
"NEON_DATABASE_URL": "sqlite:///:memory:",
"R2_ACCOUNT_ID": "test",
"R2_BUCKET": "test",
"R2_ACCESS_KEY_ID": "test",
"R2_SECRET_ACCESS_KEY": "test",
"SOCIAL_TOKEN_KEY": "test",
}.items():
os.environ.setdefault(_key, _value)
from apps.api.tools.ops import smoke # noqa: E402 - imported after env is prepared
@pytest.fixture(scope="module")
def results() -> list[smoke.Result]:
"""Run the smoke checks once and share the results across assertions."""
return smoke.run_checks()
def test_all_checks_pass(results: list[smoke.Result]) -> None:
"""Every in-process smoke check must pass under the hermetic test env."""
failed = [r for r in results if not r.ok]
assert not failed, "failed smoke checks: " + ", ".join(
f"{r.name} ({r.detail})" for r in failed
)
def test_expected_checks_present(results: list[smoke.Result]) -> None:
"""The harness must run the full, named set of checks (no silent drops)."""
names = {r.name for r in results}
assert names == {"openapi", "docs", "envelope", "auth", "authed"}
def test_auth_gate_is_exercised(results: list[smoke.Result]) -> None:
"""The 401 auth-gate check specifically must be present and passing.
This is the load-bearing proof that the auth wiring fires, so pin it
explicitly rather than relying only on the aggregate pass.
"""
by_name = {r.name: r for r in results}
assert by_name["auth"].ok
assert by_name["authed"].ok
def test_main_returns_zero() -> None:
"""``ops.smoke.main`` returns exit code 0 when every check passes."""
assert smoke.main() == 0