Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ ENV FIRSTSYNC_STATE_DIR=/data
ENV FIRSTSYNC_PORTAL_PORT=8000
RUN mkdir -p /data

# The package is installed into site-packages, but the test orgs and the demo proposals
# live at the repo root (copied to /app). Point the lookups at their absolute paths so
# they resolve regardless of where the package itself sits.
ENV FIRSTSYNC_ORGS_DIR=/app/orgs
ENV FIRSTSYNC_DEMO_RESULTS_DIR=/app/results

EXPOSE 8000
CMD ["firstsync", "portal"]
15 changes: 15 additions & 0 deletions tests/test_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,18 @@ def test_unknown_org_is_rejected(client):

def test_healthz(client):
assert client.get("/healthz").json() == {"status": "ok"}


def test_data_dirs_resolve_from_env(monkeypatch):
"""The deploy scenario: the package is installed away from the orgs/ and results/
folders, so they are located via FIRSTSYNC_ORGS_DIR and FIRSTSYNC_DEMO_RESULTS_DIR
(as the Dockerfile sets them). The index must still list every org."""
from pathlib import Path

root = Path(__file__).resolve().parents[1]
monkeypatch.setenv("FIRSTSYNC_ORGS_DIR", str(root / "orgs"))
monkeypatch.setenv("FIRSTSYNC_DEMO_RESULTS_DIR", str(root / "results"))
body = TestClient(app).get("/").text
for org in ("org_a", "org_b", "org_c", "org_d", "org_e", "org_f"):
assert org in body
assert "Claude's mapping ready" in body # demo proposals located too
Loading