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.
50 lines
1.9 KiB
Python
50 lines
1.9 KiB
Python
"""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'
|