fix: stabilize runtime follow-up regressions
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,37 @@
|
||||
from pathlib import Path
|
||||
|
||||
# The demo pages are not regression suites, but every one of them must at
|
||||
# least compile and render: a preprocessor or runtime change that breaks a
|
||||
# demo page (e.g. literal text that looks like an entry point) should fail CI.
|
||||
|
||||
ERROR_MARKERS = [
|
||||
"uce compile error",
|
||||
"fatal signal during request",
|
||||
"uncaught exception during request",
|
||||
]
|
||||
|
||||
|
||||
def _repo_root():
|
||||
return Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def _make_demo_case(page_path):
|
||||
def run(context):
|
||||
response = context.expect_status(page_path, 200)
|
||||
body_lower = response.text.lower()
|
||||
for marker in ERROR_MARKERS:
|
||||
if marker in body_lower:
|
||||
raise Exception("response body contained error marker %r for %s" % (marker, page_path))
|
||||
return "HTTP 200 without error markers for %s" % page_path
|
||||
|
||||
return run
|
||||
|
||||
|
||||
def register(registry):
|
||||
demo_dir = _repo_root() / "site" / "demo"
|
||||
for path in sorted(demo_dir.glob("*.uce")):
|
||||
registry.case(
|
||||
"demo page " + path.name,
|
||||
_make_demo_case("/demo/" + path.name),
|
||||
tags=["http", "smoke", "uce", "demo", "public"],
|
||||
)
|
||||
@@ -12,7 +12,9 @@ def register(registry):
|
||||
starter_pages = [
|
||||
("starter home", "/examples/uce-starter/", 200, "Stunning Apps"),
|
||||
("starter dashboard", "/examples/uce-starter/?dashboard", 200, "Dashboard"),
|
||||
("starter dashboard ONCE assets reach head", "/examples/uce-starter/?dashboard", 200, "views/dashboard.css"),
|
||||
("starter workspace nested route", "/examples/uce-starter/?workspace/projects", 200, "Workspace"),
|
||||
("starter workspace ONCE assets reach head", "/examples/uce-starter/?workspace/projects", 200, "css/workspace.css"),
|
||||
("starter ajax section", "/examples/uce-starter/?page2-section1", 200, "UCE starter AJAX fragment response"),
|
||||
("starter route traversal blocked", "/examples/uce-starter/?../../../demo/index", 404, "The requested page does not exist."),
|
||||
]
|
||||
|
||||
@@ -14,6 +14,12 @@ from dataclasses import asdict, dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Callable, Dict, Iterable, List, Optional
|
||||
|
||||
# When executed as a script this module is "__main__"; register it under its
|
||||
# real name too, so plugins doing `from run_network_tests import TestFailure`
|
||||
# get this module instance (and the same TestFailure class) instead of a
|
||||
# re-imported copy whose exceptions the runner's except clause cannot catch.
|
||||
sys.modules.setdefault("run_network_tests", sys.modules[__name__])
|
||||
|
||||
|
||||
@dataclass
|
||||
class Target:
|
||||
|
||||
Reference in New Issue
Block a user