Files
Pulse/scripts/tests/test_unified_resources_stale_help_docs.py
pulse-triage[bot] ba9d8064e5 Document vSphere and Map stale banners in Unified Resources Help
Align docs/UNIFIED_RESOURCES.md and its in-app Help mirror with the
filter-aware stale-reading banners on vSphere Storage, Networks, and
Activity (#5687) and on Infrastructure Map (#5693), including false-green
prevention on stale map tiles and Hide names redaction. Add a
source-bound documentation consistency test.

Contract-Neutral: Documentation and docs-only mirror/consistency test alignment to already-landed UI banners without changing runtime, API, schema, classification, or subsystem contracts.
Change-source: pulse-maintainer
2026-12-02 20:05:47 +00:00

83 lines
3.1 KiB
Python

#!/usr/bin/env python3
"""Bind Unified Resources Help vSphere and Map stale-reading banners to live frontend source.
Documentation consistency checks only, not live vSphere or Infrastructure Map runtime tests.
"""
from pathlib import Path
import unittest
ROOT = Path(__file__).resolve().parents[2]
def doc_text(rel: str) -> str:
return (ROOT / rel).read_text(encoding="utf-8")
def norm(text: str) -> str:
return " ".join(text.split())
class UnifiedResourcesStaleHelpDocsTest(unittest.TestCase):
def test_unified_resources_mirror_matches_canonical_doc(self):
self.assertEqual(
doc_text("docs/UNIFIED_RESOURCES.md"),
doc_text("frontend-modern/public/docs/UNIFIED_RESOURCES.md"),
)
def test_unified_resources_documents_vsphere_tab_stale_banners(self):
doc = norm(doc_text("docs/UNIFIED_RESOURCES.md"))
for phrase in (
"**VMware vSphere Overview, Storage, Networks, and Activity**",
"**Some vSphere health readings are stale**",
"**vSphere → Storage** (`/vmware/storage`, **Some vSphere datastore readings are stale.**)",
"**vSphere → Networks** (`/vmware/networks`, **Some vSphere network readings are stale.**)",
"**vSphere → Activity** (`/vmware/activity`, **Some vSphere activity readings are stale.**)",
"hiding when filters narrow to current-only rows, on agent-only staleness, or when live vCenter polling recovers",
):
with self.subTest(phrase=phrase):
self.assertIn(phrase, doc)
self.assertIn(
"Some vSphere datastore readings are stale.",
doc_text("frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx"),
)
self.assertIn(
"Some vSphere network readings are stale.",
doc_text("frontend-modern/src/features/vmware/VsphereNetworksTable.tsx"),
)
self.assertIn(
"Some vSphere activity readings are stale.",
doc_text("frontend-modern/src/features/vmware/VsphereActivityTable.tsx"),
)
def test_unified_resources_documents_infrastructure_map_stale_banners(self):
doc = norm(doc_text("docs/UNIFIED_RESOURCES.md"))
for phrase in (
"**Infrastructure Map** (`/map`)",
"**Some map readings are stale.**",
"**Map readings are stale.**",
"**By host** and **By role** layouts",
"prevents affected tiles from showing a green **Healthy** dot",
"avoids leaking resource names under **Hide names**",
"clears automatically on live recovery",
):
with self.subTest(phrase=phrase):
self.assertIn(phrase, doc)
map_surface = doc_text(
"frontend-modern/src/features/infrastructureMap/InfrastructureMapSurface.tsx"
)
for marker in (
"headline: 'Map readings are stale.'",
"headline: 'Some map readings are stale.'",
"hasStaleMapResourceTelemetry",
):
with self.subTest(marker=marker):
self.assertIn(marker, map_surface)
if __name__ == "__main__":
unittest.main()