mirror of
https://github.com/razzant/ouroboros.git
synced 2026-10-03 04:07:04 +00:00
Refuse browser fixture success when supervisor failed to initialize
This commit is contained in:
parent
57c3d30aa0
commit
75dcfbf7ea
3 changed files with 15 additions and 1 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Machine extraction of the `docs/ARCHITECTURE.md` "Data layout (`~/Ouroboros/`)" tree — the durable-file orientation carrier (this tree's counterpart of the reference PERSISTENCE_OWNERS derivation checklist) — regenerated by `python scripts/regenerate_inventories.py`. Do not edit. Every entry is probed against reality: repo entries must exist as tracked paths; data-plane entries must appear as a literal in the runtime sources that construct them. A durable file renamed or removed in code while its tree row survives = red (`tests/test_generated_inventories.py`).
|
||||
|
||||
Source: `docs/architecture/01-high-level-architecture.md`, physical LF lines 597-686; UTF-8 SHA-256 `026d6d93423e4fcd321a0ff78e46d779f96f305fa48320152523e1a63e1f90a7`.
|
||||
Source: `docs/architecture/01-high-level-architecture.md`, physical LF lines 597-686; UTF-8 SHA-256 `773a6c53f7985e35274ee4c319b0ff50cfe5478592c79775a05db741e9f42081`.
|
||||
|
||||
- entries: **79** (code-ref: 72, repo-dir: 6, repo-path: 1)
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ def _fetch(url, timeout=5):
|
|||
return response.read()
|
||||
|
||||
|
||||
def require_running_supervisor(state):
|
||||
if state.get("supervisor_error") or not state.get("supervisor_ready") or not state.get("workers_total"):
|
||||
raise CandidateError(f"CANDIDATE_SERVER_UNAVAILABLE: {state.get('supervisor_error') or 'no worker pool'}")
|
||||
|
||||
|
||||
def assert_served_candidate(url, checkout, data_dir, pid, candidate):
|
||||
"""Bind a healthy server to its owned PID, this checkout's bytes and its Python.
|
||||
|
||||
|
|
@ -74,6 +79,7 @@ def assert_served_candidate(url, checkout, data_dir, pid, candidate):
|
|||
from ouroboros.server_process import read_service_bindings
|
||||
|
||||
binding = read_service_bindings(data_dir)["main"]
|
||||
require_running_supervisor(json.loads(_fetch(url + "/api/state")))
|
||||
assert binding["pid"] == pid, "health answered by a different server process"
|
||||
assert url == f"http://127.0.0.1:{binding['port']}"
|
||||
for relative, route in (("web/index.html", "/"),
|
||||
|
|
|
|||
|
|
@ -10,6 +10,14 @@ from tests import candidate_checkout as candidate
|
|||
pytestmark = pytest.mark.serial
|
||||
|
||||
|
||||
def test_ready_flag_does_not_hide_failed_supervisor():
|
||||
candidate.require_running_supervisor({"supervisor_ready": True, "workers_total": 1})
|
||||
for state in ({"supervisor_ready": True, "workers_total": 0},
|
||||
{"supervisor_ready": True, "workers_total": 1, "supervisor_error": "init failed"}):
|
||||
with pytest.raises(candidate.CandidateError, match="CANDIDATE_SERVER_UNAVAILABLE"):
|
||||
candidate.require_running_supervisor(state)
|
||||
|
||||
|
||||
def test_installed_project_cannot_supply_code_missing_from_candidate(monkeypatch):
|
||||
from importlib import metadata
|
||||
from types import SimpleNamespace
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue