From 30f4de36122577ef9111b8b8153f26ba13a752d5 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 7 Oct 2026 15:08:15 -0400 Subject: [PATCH] fix(docker): drop the unused .w-meter style; the bars test reads the loaded plugin's models (#5214) Co-Authored-By: Claude Opus 5.5 --- steward/static/steward.css | 3 --- tests/integration/test_docker_recent_usage.py | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/steward/static/steward.css b/steward/static/steward.css index 9507383..08f1fe8 100644 --- a/steward/static/steward.css +++ b/steward/static/steward.css @@ -405,9 +405,6 @@ body.dash-editing .widget-drawer { transform:translateY(0); } .w-item .w-label { flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .w-item .w-label a { color:inherit; text-decoration:none; } .w-item .w-meta { flex-shrink:0; font-size:0.72rem; color:var(--text-muted); font-variant-numeric:tabular-nums; } -/* A number with its share drawn behind it (--pct, 0–100), in the number's own - tone: the bar never stands without the figure it measures. */ -.w-meter { background:linear-gradient(90deg, color-mix(in srgb, currentColor 20%, transparent) var(--pct, 0%), transparent var(--pct, 0%)); border-radius:3px; } .w-note { font-size:0.7rem; color:var(--text-dim); margin-top:0.3rem; } .w-table col.w-barcol { width:9.5rem; } /* Bars of a figure's recent past, inline before it (Busiest Containers, #5214): diff --git a/tests/integration/test_docker_recent_usage.py b/tests/integration/test_docker_recent_usage.py index d33e35c..a6b9914 100644 --- a/tests/integration/test_docker_recent_usage.py +++ b/tests/integration/test_docker_recent_usage.py @@ -4,6 +4,7 @@ time bucket in one query (#5214). Two samples share a bucket and must merge from __future__ import annotations import asyncio +import importlib import os import uuid from datetime import datetime, timedelta, timezone @@ -21,10 +22,20 @@ def app(): return create_app(testing=False) +def _docker(sub): + """The app's loaded docker plugin module: importing plugins.docker.models a + second time raises "Table already defined" (see test_mcp_plugin_tools).""" + from steward.core.plugin_manager import get_loaded_plugin_modules + loaded = get_loaded_plugin_modules().get("docker") + base = loaded.__name__ if loaded is not None else "plugins.docker" + return importlib.import_module(f"{base}.{sub}") + + def test_recent_usage_averages_each_containers_bucket(app): - from plugins.docker.models import DockerMetric - from plugins.docker.service import bar_slots, recent_usage from steward.models.hosts import Host + DockerMetric = _docker("models").DockerMetric + service = _docker("service") + bar_slots, recent_usage = service.bar_slots, service.recent_usage tag = uuid.uuid4().hex[:8] hid = str(uuid.uuid4())