fix: error-pages graded healthy, unwired sensors listed apart, Maintenance failed reads 0 (#5780, #5781, #5782)
- #5780 "The error-pages service is graded on other routers' errors". The Traefik scrape reads which services an errors middleware sends to, and grades them healthy: their 4xx and 5xx are the codes of the errors they cover for, already graded on the routers that failed. - #5781 "The Maintenance failed rules sit at no data until a host has had a maintenance job". Every host with an agent reads 0 until a job fails. - #5782 "VDNT-Util01's host page lists SYSTIN at 115 °C in red". The host page lists sensors that counts_as_hottest leaves out (unwired board inputs, 0 °C or below) on one muted line, not as heat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -156,3 +156,13 @@ def test_the_registration_keeps_the_host_s_updates_and_reboot():
|
||||
"reboot": {"required": False}}, now)
|
||||
assert reg.updates_pending == 4 and reg.updates_error == "apt is locked"
|
||||
assert reg.reboot_required is False and reg.reboot_required_since is None
|
||||
|
||||
|
||||
def test_the_page_lists_unwired_sensors_apart_hottest_first():
|
||||
"""VDNT-Util01's sensor list read SYSTIN 115 °C in red at the top, though
|
||||
the host's temperature already left it out (#5759)."""
|
||||
from plugins.host_agent.routes import split_temps
|
||||
real, unwired = split_temps({"SYSTIN": 115.0, "AUXTIN0": 110.0, "Package id 0": 52.0,
|
||||
"Composite": 48.9, "PCH_CHIP_TEMP": 0.0, "CPUTIN": 47.0, "gone": None})
|
||||
assert list(real) == ["Package id 0", "Composite", "CPUTIN", "gone"]
|
||||
assert list(unwired) == ["SYSTIN", "AUXTIN0", "PCH_CHIP_TEMP"]
|
||||
|
||||
@@ -127,3 +127,24 @@ async def test_a_card_for_an_unknown_service_says_so(app):
|
||||
assert "Status codes not recorded yet" in card
|
||||
assert "The app is answering with server errors" in card
|
||||
assert "Steward can't tell which service serves this router" in card
|
||||
|
||||
|
||||
def test_the_error_pages_service_is_found_from_traefiks_errors_middlewares():
|
||||
from plugins.traefik.scraper import error_page_services
|
||||
got = error_page_services([
|
||||
{"name": "error-pages@swarm", "provider": "swarm", "errors": {"service": "error-pages-service",
|
||||
"status": ["400-599"]}},
|
||||
{"name": "other@file", "errors": {"service": "pages@docker"}}, # already names its provider
|
||||
{"name": "https-redirect@swarm", "redirectScheme": {"scheme": "https"}},
|
||||
])
|
||||
assert got == {"error-pages-service@swarm", "pages@docker"}
|
||||
|
||||
|
||||
def test_the_error_pages_service_is_healthy_whatever_its_codes():
|
||||
"""It answers with the code of the error it covers for (#5780)."""
|
||||
from plugins.traefik.routes import ERROR_PAGES_WHY, grade_routers
|
||||
routers = [{"name": "error-pages-service@swarm", "latest": _latest(e4=90.0, e5=8.0)},
|
||||
{"name": "app@swarm", "latest": _latest(e5=8.0)}]
|
||||
grade_routers(routers, {}, TH, error_pages=frozenset({"error-pages-service@swarm"}))
|
||||
assert (routers[0]["state"], routers[0]["why"], routers[0]["kind"]) == ("ok", ERROR_PAGES_WHY, None)
|
||||
assert routers[1]["state"] == "crit" and routers[1]["kind"] == "5xx"
|
||||
|
||||
Reference in New Issue
Block a user