test(docker): a plugin template can take its own name; the overview's assertions follow its new tables (#5299, #5302)

render_plugin_template's first three arguments are positional-only, so the
service page's own `name` reaches the template. The overview names a service
rather than its replica containers, and a stack chip keeps the search it was
clicked under.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 20:11:46 -04:00
co-authored by Claude Opus 5.5
parent 2093f399e6
commit a775882bd4
3 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ def template_files() -> list[pathlib.Path]:
return sorted(p for root in roots for p in root.rglob("*.html"))
async def render_plugin_template(app, plugin: str, name: str, **ctx) -> str:
async def render_plugin_template(app, plugin: str, name: str, /, **ctx) -> str:
"""Render plugins/<plugin>/templates/<name> with quart.render_template,
whether or not the plugin is enabled in this app: the plugin's template
folder goes ahead of the app's loader for the one render. Call inside
@@ -136,6 +136,7 @@ def test_a_service_page_reads_every_task(app):
rows = got["rows"][1]
assert f'href="/plugins/docker/service/{name}"' in rows
assert f'<a class="chip" href="/plugins/docker/?stack=it{tag}"' in rows
# A stack chip keeps the search it was clicked under.
assert f'<a class="chip" href="/plugins/docker/?q=it{tag}&amp;stack=it{tag}"' in rows
assert f'/plugins/docker/service/{name}?task={dead_task}#logs' in rows # the failure's logs
assert f'href="/plugins/docker/service/{name}"' not in got["other"][1]
+5 -2
View File
@@ -265,11 +265,14 @@ def test_docker_and_agent_tools_over_seeded_rows(app):
sess["user_id"], sess["user_role"], sess["username"] = viewer_id, "viewer", "viewer"
sess["login_at"] = time.time()
topo = await (await client.get("/plugins/docker/swarm")).get_data(as_text=True)
assert svc in topo and "1 task failed in the last 24h" in topo
assert f'href="/plugins/docker/service/{svc}"' in topo # short of replicas: named first
assert "task: non-zero exit (1)" in topo
cards = await (await client.get("/plugins/docker/rows")).get_data(as_text=True)
assert f"{svc}.1.abc" in cards and replaced not in cards
assert f'href="/plugins/docker/service/{svc}"' in cards and replaced not in cards
assert "task: non-zero exit (1)" in cards
# The overview names the service; its own page names its live replica.
page = await (await client.get(f"/plugins/docker/service/{svc}")).get_data(as_text=True)
assert f"{svc}.1.abc" in page and replaced not in page
assert (await client.get("/plugins/docker/widget")).status_code == 200
# ── host agents ────────────────────────────────────────────────────