Files
Pulse/scripts/tests/test_cloud_migration_docs.py
pulse-triage[bot] 9d40b90fdd Align Cloud availability and Pro runtime switch Help docs
Align eight unclaimed shipped Help guides and their mirrored copies under
frontend-modern/public/docs/ with current Pulse runtime behavior:
- Clarify in docs/CLOUD.md that Pulse Cloud is not generally available
  (matching docs/README.md) and remove the unscheduled custom-domain
  future-release promise.
- Document the shipped Switch this install to Pulse Pro (systemd/Proxmox
  LXC) and Switch this container to Pulse Pro (Docker) cards from
  ProLicensePlanSection.tsx across docs/RBAC.md, docs/UPGRADE_v6.md,
  docs/PRODUCTION_SECURITY.md, and docs/i18n/{de,es,fr}/README.md while
  preserving manual pulserelay.pro/download.html guidance.
- Align SECURITY.md's token management breadcrumb to
  Settings -> Security -> API Access.
- Add source-bound regression tests in scripts/tests/test_cloud_migration_docs.py,
  scripts/tests/test_localized_public_docs.py, and
  scripts/tests/test_upgrade_v6_docs.py.

Contract-Neutral: Aligns shipped Help documentation and doc-verification tests with already-shipped Pro runtime switch UI, Cloud availability posture, and Security navigation without modifying runtime or API contracts.
Change-source: pulse-maintainer
2026-11-28 23:41:33 +00:00

117 lines
6.3 KiB
Python

#!/usr/bin/env python3
"""Keep the hosted migration entry point within the actual export/agent scope.
These check instructions, not installed Cloud recovery or provider access.
The real encrypted-archive control is TestConfigurationMigrationArchiveScope.
"""
from pathlib import Path
import unittest
ROOT = Path(__file__).resolve().parents[2]
def guide():
return (ROOT / "docs/CLOUD.md").read_text(encoding="utf-8")
def section(text, heading, level):
return " ".join(text.split(f"{level} {heading}\n", 1)[1].split(f"\n{level} ", 1)[0].split())
class CloudMigrationDocsTest(unittest.TestCase):
def test_in_app_guide_matches_canonical(self):
self.assertEqual(guide(), (ROOT / "frontend-modern/public/docs/CLOUD.md").read_text())
def test_export_scope_is_not_a_portable_installation_promise(self):
text = section(guide(), "Migrating To/From Cloud", "##")
for boundary in (
"not the full installation", "Metrics and audit history",
"incidents and queued notifications", "agent inventory and enrolment state",
"profiles and assignments", "TrueNAS, vSphere and Machine Availability",
"local login credentials or deployment overrides", "exporting version",
"MIGRATION.md#configuration-transfer", "do not reveal the original tokens",
"Hosted automatic backups and this downloaded export are different things",
"Do not assume access to the hosted filesystem", "MIGRATION.md#full-state-recovery",
"Do not mix encrypted files and keys", "Keep exports, passphrases and credentials private",
):
with self.subTest(boundary=boundary):
self.assertIn(boundary, text)
self.assertNotIn("fully portable", guide())
self.assertIn("not a complete copy of the hosted installation",
section(guide(), "Data & Privacy", "##"))
def test_cloud_guide_aligns_mobile_retirement_and_restore_button_with_source(self):
text = guide()
self.assertNotIn("Mobile ready", text)
self.assertNotIn("Set Up Mobile Access", text)
self.assertNotIn("**Settings → Pulse Mobile**", text)
for phrase in (
"Pulse Mobile is being retired on 31 March 2027",
"Relay is no longer sold",
"**ntfy**, **Gotify**, or **Pushover**",
"**Settings → Security → Pulse Mobile** (`/settings/system-relay`)",
"Restore Backup",
):
with self.subTest(phrase=phrase):
self.assertIn(phrase, text)
catalog = (ROOT / "frontend-modern/src/components/Settings/settingsNavCatalog.ts").read_text(encoding="utf-8")
security_group = catalog.split("id: 'security'", 1)[1]
self.assertIn("id: 'system-relay'", security_group)
self.assertIn("label: 'Pulse Mobile'", security_group)
recovery = (ROOT / "frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx").read_text(encoding="utf-8")
self.assertIn("Restore Configuration", recovery)
self.assertIn("Restore Backup", recovery)
def test_both_directions_preserve_access_source_and_destination(self):
for heading in ("Self-Hosted → Cloud", "Cloud → Self-Hosted"):
text = section(guide(), heading, "###")
with self.subTest(direction=heading):
for boundary in ("destination-local administrator access", "notification destinations",
"API-token records", "not", "merge", "passphrase", "export",
"excluded connections and settings", "before retiring"):
self.assertIn(boundary, text)
hosted_exit = section(guide(), "Cloud → Self-Hosted", "###")
self.assertIn("do not cancel it or discard the source", hosted_exit)
self.assertIn("verify your Pro licence separately", hosted_exit)
def test_retargeting_preserves_identity_and_does_not_inherit_endpoint_trust(self):
text = section(guide(), "Migrating To/From Cloud", "##")
self.assertEqual(text.count("UNIFIED_AGENT.md#moving-pulse-to-a-new-address"), 2)
for boundary in ("saved identity and credential", "host's platform",
"rather than creating a replacement token", "HTTPS verification enabled",
"installer download", "agent connection", "certificate pin",
"not automatically trust for the new endpoint", "fresh ordinary reports",
"agent admission", "before enabling remote actions"):
with self.subTest(boundary=boundary):
self.assertIn(boundary, text)
self.assertNotIn("Update agent `--url` flags", text)
self.assertNotIn("```", text, "No generic credential, reinstall or hosted-filesystem recipe")
def test_cloud_availability_matches_docs_index_without_unscheduled_promises(self):
text = " ".join(guide().split())
docs_index = " ".join((ROOT / "docs/README.md").read_text(encoding="utf-8").split())
self.assertIn("Pulse Cloud is not generally available.", docs_index)
self.assertIn("Pulse Cloud is not generally available.", text)
self.assertIn("Ordinary self-hosted Pulse remains the primary installation path", text)
self.assertIn("Custom domains are not supported.", text)
self.assertNotIn("planned for a future release", text)
def test_import_errors_and_cutover_do_not_trigger_destructive_diagnostics(self):
text = section(guide(), "Migrating To/From Cloud", "##")
for boundary in ("Import can activate monitoring", "single-active cutover before importing",
"retain independent monitoring", "does not grant hosted filesystem",
"stop before importing", "reload/apply failure",
"settings may already have been written", "before repeating it",
"stop the trial destination", "intact source", "avoid two active writers",
"Do not induce alerts, replay a queue or run a workload action",
"not proof of full recovery", "Missing history", "does not prove collection failed"):
with self.subTest(boundary=boundary):
self.assertIn(boundary, text)
if __name__ == "__main__":
unittest.main()