asset_panels() rewrites any group missing from ASSET_PANEL_GROUPS to 'details' before the client sees it, and Phase 3 never added 'serviceprocess' there. Both panels were relabelled on the wire, so the tab could not appear no matter how consistent the frontend was. That is why the tab was still missing after the schema fix - a second, unrelated cause wearing the same symptom. Operator Reports moves out of System Monitors into a tab of its own: that tab is machine-collected health, this is a person reporting something, and the thumbnail grid dwarfed the fact cards it sat between. Full width, since it is alone in the tab. panelGroups.spec.js claimed to cover four files and checked two; it now reads the server tuple as well. The plugin test's hand-copied set was a fifth copy and now derives from the server tuple instead.
75 lines
2.9 KiB
Python
75 lines
2.9 KiB
Python
"""The Monitors tab split: a panel in a group no tab renders disappears.
|
|
|
|
This has silently eaten cards twice - once when tracked services moved out of
|
|
'actions', once on the 'metrics' to 'monitors' rename. Both times the backend
|
|
named a group the frontend did not render, and the panel was not shown, not
|
|
logged, and not missed until someone went looking for it.
|
|
|
|
The split is only correct if four places agree, and only two of them are Python:
|
|
1. the panels' group here
|
|
2. RENDERED_GROUPS in PluginAssetPanels.vue
|
|
3. the tab label map in PCDetail.vue
|
|
4. the v-show block that gives the tab a layout
|
|
|
|
These tests pin the Python half so a later edit cannot quietly move a panel into
|
|
a group nothing renders. The frontend half is pinned by its own spec.
|
|
"""
|
|
|
|
from plugins.endpoints.plugin import EndpointsPlugin
|
|
from shopdb.core.api.pluginui import ASSET_PANEL_GROUPS
|
|
|
|
|
|
# Derived from the server tuple rather than hand-copied. This used to be a
|
|
# literal set duplicating RENDERED_GROUPS, which made it a FIFTH copy of the
|
|
# vocabulary and one more thing to forget: it passed for a group the server
|
|
# would rewrite to 'details' anyway. ASSET_PANEL_GROUPS is the value that
|
|
# actually decides what reaches the client, and panelGroups.spec.js pins it
|
|
# against the frontend copy.
|
|
RENDERED_GROUPS = set(ASSET_PANEL_GROUPS)
|
|
|
|
|
|
def _panels():
|
|
return {panel['id']: panel for panel in EndpointsPlugin().get_asset_panels()}
|
|
|
|
|
|
def test_no_panel_lands_in_a_group_the_frontend_does_not_render():
|
|
"""The failure mode that ate cards twice: a group with no tab."""
|
|
for panel in EndpointsPlugin().get_asset_panels():
|
|
group = panel.get('group', 'details')
|
|
assert group in RENDERED_GROUPS, (
|
|
f"panel {panel['id']} is in group {group!r}, which no tab renders"
|
|
)
|
|
|
|
|
|
def test_tracked_services_and_processes_moved_to_their_own_group():
|
|
panels = _panels()
|
|
|
|
assert panels['endpoints-tracked-services']['group'] == 'serviceprocess'
|
|
assert panels['endpoints-tracked-processes']['group'] == 'serviceprocess'
|
|
|
|
|
|
def test_the_service_process_tab_is_not_left_empty():
|
|
"""A tab whose panels all moved away reads as broken, not as absent."""
|
|
groups = [panel.get('group', 'details')
|
|
for panel in EndpointsPlugin().get_asset_panels()]
|
|
|
|
assert 'serviceprocess' in groups
|
|
|
|
|
|
def test_system_monitors_keeps_panels_of_its_own():
|
|
"""The rename is only safe if Monitors still has content after the move."""
|
|
groups = [panel.get('group', 'details')
|
|
for panel in EndpointsPlugin().get_asset_panels()]
|
|
|
|
assert 'monitors' in groups
|
|
|
|
|
|
def test_disk_health_stayed_with_the_system_health_panels():
|
|
"""Disk health is the box's own health, not something running on it.
|
|
|
|
It is now a section of the Storage card rather than a panel of its own,
|
|
so the group assertion follows it there.
|
|
"""
|
|
assert 'endpoints-diskhealth' not in _panels()
|
|
assert _panels()['endpoints-storage']['group'] == 'monitors'
|