@@ -41,6 +41,7 @@ def _page_warnings(page, *, prefix: str = "[install]") -> list[str]:
|
|||||||
- Prints found warnings/errors to stderr (stdout stays clean).
|
- Prints found warnings/errors to stderr (stdout stays clean).
|
||||||
- Returns a de-duplicated list of warning/error texts (empty if none found).
|
- Returns a de-duplicated list of warning/error texts (empty if none found).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _safe(s: str | None) -> str:
|
def _safe(s: str | None) -> str:
|
||||||
return (s or "").strip()
|
return (s or "").strip()
|
||||||
|
|
||||||
@@ -116,12 +117,16 @@ def _page_warnings(page, *, prefix: str = "[install]") -> list[str]:
|
|||||||
out.append(t)
|
out.append(t)
|
||||||
|
|
||||||
if out:
|
if out:
|
||||||
print(f"{prefix} page warnings/errors detected @ {url} ({title}):", file=sys.stderr)
|
print(
|
||||||
|
f"{prefix} page warnings/errors detected @ {url} ({title}):",
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
for idx, t in enumerate(out, 1):
|
for idx, t in enumerate(out, 1):
|
||||||
print(f"{prefix} {idx}) {t}", file=sys.stderr)
|
print(f"{prefix} {idx}) {t}", file=sys.stderr)
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
def wait_http(url: str, timeout: int = 180) -> None:
|
def wait_http(url: str, timeout: int = 180) -> None:
|
||||||
"""
|
"""
|
||||||
Consider Matomo 'reachable' as soon as the HTTP server answers - even with 500.
|
Consider Matomo 'reachable' as soon as the HTTP server answers - even with 500.
|
||||||
|
|||||||
@@ -87,7 +87,9 @@ class TestWebInstallerWarningsIntegration(unittest.TestCase):
|
|||||||
Some Matomo versions repeat the same alert in multiple containers.
|
Some Matomo versions repeat the same alert in multiple containers.
|
||||||
We must return/log each unique text only once.
|
We must return/log each unique text only once.
|
||||||
"""
|
"""
|
||||||
repeated = "Please fix the following errors:\nThe email doesn't have a valid format."
|
repeated = (
|
||||||
|
"Please fix the following errors:\nThe email doesn't have a valid format."
|
||||||
|
)
|
||||||
page = _FakePage(
|
page = _FakePage(
|
||||||
url="http://matomo/index.php?action=setupSuperUser&module=Installation",
|
url="http://matomo/index.php?action=setupSuperUser&module=Installation",
|
||||||
title="Superuser",
|
title="Superuser",
|
||||||
|
|||||||
Reference in New Issue
Block a user