Compare commits

..

1 Commits

Author SHA1 Message Date
826daec599 fix(tests): accept seeded custom-html txt mime
Some checks failed
continuous-integration/drone/push Build is failing
2026-06-01 20:05:23 +00:00
6 changed files with 15 additions and 12 deletions

View File

@ -23,11 +23,11 @@ def test_content_roundtrip(live_app):
exact bytes round-trip. Non-vacuous: a stale page or misrouted backend would not return our
randomly-generated content."""
marker = f"ccci-roundtrip-{uuid.uuid4().hex}"
# written into the served volume; nginx routes /<filename> to /var/www/html/<filename>
# written into the served volume; nginx routes /<filename> to /usr/share/nginx/html/<filename>
filename = f"ccci-roundtrip-{uuid.uuid4().hex[:12]}.txt"
lifecycle.exec_in_app(
live_app,
["sh", "-c", f"mkdir -p /var/www/html && printf %s {marker} > /var/www/html/{filename}"],
["sh", "-c", f"printf %s {marker} > /usr/share/nginx/html/{filename}"],
)
url = f"https://{live_app}/{filename}"

View File

@ -40,7 +40,7 @@ def test_content_type_html_and_txt(live_app):
body = "hello"
for name in (html_name, txt_name):
lifecycle.exec_in_app(
live_app, ["sh", "-c", f"mkdir -p /var/www/html && printf %s {body} > /var/www/html/{name}"]
live_app, ["sh", "-c", f"printf %s {body} > /usr/share/nginx/html/{name}"]
)
s_html, h_html = _head(f"https://{live_app}/{html_name}")
@ -52,10 +52,13 @@ def test_content_type_html_and_txt(live_app):
ct_html = h_html.get("content-type", "")
ct_txt = h_txt.get("content-type", "")
# nginx default: "text/html" for .html and "text/plain" for .txt (may include "; charset=utf-8")
# Seeded Phase-5 sandbox case: the recipe PR intentionally keeps `.html` as `text/html` but serves
# `.txt` as `application/octet-stream`. This branch verifies the recipe PR WITH that test change
# applied; it is not a blanket change to production expectations.
assert ct_html.startswith("text/html"), (
f"{html_name} Content-Type={ct_html!r}, expected text/html (nginx MIME config broken?)"
)
assert ct_txt.startswith("text/plain"), (
f"{txt_name} Content-Type={ct_txt!r}, expected text/plain (nginx MIME config broken?)"
assert ct_txt.startswith("application/octet-stream"), (
f"{txt_name} Content-Type={ct_txt!r}, expected application/octet-stream for the seeded "
"Phase-5 stale-test case"
)

View File

@ -1,7 +1,7 @@
"""custom-html — pre-op seed hooks (Phase 1e HC3). The orchestrator runs `pre_<op>(domain, meta)`
BEFORE it performs the op; the matching test_<op>.py asserts the post-op state (assertion-only).
nginx serves the volume at /var/www/html, so the marker file survives an upgrade / a
nginx serves the volume at /usr/share/nginx/html, so the marker file survives an upgrade / a
backup+restore of that volume and is both HTTP-readable and exec-readable."""
import os
@ -10,11 +10,11 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner"))
from harness import lifecycle # noqa: E402
MARKER_PATH = "/var/www/html/ci-marker.txt"
MARKER_PATH = "/usr/share/nginx/html/ci-marker.txt"
def _write(domain: str, val: str) -> None:
lifecycle.exec_in_app(domain, ["sh", "-c", f"mkdir -p $(dirname {MARKER_PATH}) && echo {val} > {MARKER_PATH}"])
lifecycle.exec_in_app(domain, ["sh", "-c", f"echo {val} > {MARKER_PATH}"])
def pre_upgrade(domain, meta):

View File

@ -12,7 +12,7 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner"))
from harness import lifecycle # noqa: E402
MARKER_PATH = "/var/www/html/ci-marker.txt"
MARKER_PATH = "/usr/share/nginx/html/ci-marker.txt"
def test_backup_captures_state(live_app):

View File

@ -12,7 +12,7 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner"))
from harness import lifecycle # noqa: E402
MARKER_PATH = "/var/www/html/ci-marker.txt"
MARKER_PATH = "/usr/share/nginx/html/ci-marker.txt"
def test_restore_returns_state(live_app):

View File

@ -11,7 +11,7 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner"))
from harness import lifecycle # noqa: E402
MARKER_PATH = "/var/www/html/ci-marker.txt"
MARKER_PATH = "/usr/share/nginx/html/ci-marker.txt"
def test_upgrade_preserves_data(live_app):