feat(widgets): Routers and Hosts problem rows say since when (#5810)
Routers: a router in trouble reads 'started 2h ago' or 'all of the last 24 h', from problem_since over the day's history, read for the troubled routers only (a certificate's problem carries its own date). Hosts: a down host reads 'a monitor is down for 3h'; host_glance keeps the down_since host_status already had. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -209,6 +209,21 @@ async def test_the_widget_gives_a_verdict_then_routers_under_one_header(app):
|
||||
assert "+4 more healthy" in page
|
||||
|
||||
|
||||
async def test_a_router_in_trouble_says_since_when_on_the_widget(app):
|
||||
"""#5810: the widget's problem rows carry the since the page shows."""
|
||||
slow = _router("api@docker", _latest(p95=450.0))
|
||||
slow.update(since=datetime.now(timezone.utc) - timedelta(hours=2), since_before=False)
|
||||
failing = _router("pay@docker", _latest(e5=4.0))
|
||||
failing.update(since=datetime.now(timezone.utc) - timedelta(days=1), since_before=True)
|
||||
async with app.test_request_context("/plugins/traefik/widget"):
|
||||
page = await render_plugin_template(
|
||||
app, "traefik", "traefik/widget.html", problems=[failing, slow], healthy=[],
|
||||
healthy_more=0, total=2, loose_certs=[], domains_known=True)
|
||||
page = " ".join(page.split())
|
||||
assert "all of the last 24 h" in page
|
||||
assert page.count(", started ") == 1 and page.index("all of the last 24 h") < page.index(", started ")
|
||||
|
||||
|
||||
async def test_without_router_domains_expiring_certs_follow_the_routers(app):
|
||||
fine = _router("web@docker", _latest())
|
||||
async with app.test_request_context("/plugins/traefik/widget"):
|
||||
|
||||
Reference in New Issue
Block a user