split monitors tab and surface boot type and nic link state
Tracked Services and Tracked Processes were sharing a tab with system health cards, so what is running on the box and how the box itself is doing read as one list. They now sit in a Service/Process Monitors tab and the old tab is System Monitors. The group vocabulary is duplicated across the renderer, the tab map and the panel declarations with nothing checking they agree, and a group named in one but not the others is dropped in silence - that has eaten cards twice. Tests now pin the vocabulary on both sides. Boot type and NIC link state were collected in Phase 2 but shown nowhere. Boot type only renders when fast startup applies, because uptime measured from a resume understates how long the kernel has been up and that is the case worth naming. Link state leaves a disconnected NIC unknown rather than half duplex: live hardware returns empty speed and duplex when unplugged, and half duplex is the cable fault signature this column exists to catch.
This commit is contained in:
49
tests/test_plugins/test_endpoints_link_label.py
Normal file
49
tests/test_plugins/test_endpoints_link_label.py
Normal file
@@ -0,0 +1,49 @@
|
||||
"""NIC link label: an unknown link must never read as a working one.
|
||||
|
||||
Link speed and duplex are paired onto the interface rows from a second WMI
|
||||
class, so three states are possible: read successfully, unreadable, and
|
||||
disconnected. Verified on a live box that a DISCONNECTED adapter returns empty
|
||||
Speed and FullDuplex - two of four NICs on the test machine were in that state.
|
||||
|
||||
That is the trap these tests pin. Defaulting an absent speed to 0 or an absent
|
||||
duplex to False would report every unplugged NIC as half duplex, which is the
|
||||
exact signature of the cable/port fault this field exists to catch. A column
|
||||
that cries fault on every disconnected NIC is a column nobody reads.
|
||||
"""
|
||||
|
||||
from plugins.endpoints.api.routes import _link_label
|
||||
|
||||
|
||||
def test_a_gigabit_full_duplex_link_is_not_annotated():
|
||||
"""The normal case should be quiet so the abnormal case stands out."""
|
||||
assert _link_label(1000000000, True) == '1 Gb'
|
||||
|
||||
|
||||
def test_half_duplex_is_called_out_because_it_is_the_actionable_case():
|
||||
assert _link_label(100000000, False) == '100 Mb half duplex'
|
||||
|
||||
|
||||
def test_a_disconnected_adapter_reads_as_unknown_not_half_duplex():
|
||||
"""The live-box case: disconnected NICs return empty speed and duplex.
|
||||
|
||||
Reading this as half duplex would flag every unplugged NIC as a fault.
|
||||
"""
|
||||
assert _link_label(None, None) == '-'
|
||||
|
||||
|
||||
def test_an_unreadable_duplex_on_a_live_link_is_not_assumed_half():
|
||||
"""Speed known, duplex not. Unknown duplex must not render as a fault."""
|
||||
assert _link_label(10000000000, None) == '10 Gb'
|
||||
|
||||
|
||||
def test_zero_speed_is_unknown_rather_than_a_zero_speed_link():
|
||||
assert _link_label(0, True) == '-'
|
||||
|
||||
|
||||
def test_sub_gigabit_speeds_stay_in_megabits():
|
||||
assert _link_label(10000000, True) == '10 Mb'
|
||||
|
||||
|
||||
def test_speeds_do_not_render_trailing_zeros():
|
||||
"""2.5Gb NICs are common now; the label should not read '2.5000 Gb'."""
|
||||
assert _link_label(2500000000, True) == '2.5 Gb'
|
||||
65
tests/test_plugins/test_endpoints_panel_groups.py
Normal file
65
tests/test_plugins/test_endpoints_panel_groups.py
Normal file
@@ -0,0 +1,65 @@
|
||||
"""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
|
||||
|
||||
|
||||
# Must match RENDERED_GROUPS in frontend/src/components/PluginAssetPanels.vue.
|
||||
# A panel in any group not listed here is fetched, held, and shown nowhere.
|
||||
RENDERED_GROUPS = {'details', 'monitors', 'serviceprocess', 'software',
|
||||
'activity'}
|
||||
|
||||
|
||||
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."""
|
||||
assert _panels()['endpoints-diskhealth']['group'] == 'monitors'
|
||||
Reference in New Issue
Block a user