"""Real CLI output shapes must not become an empty successful depot inventory."""
import importlib.util
from pathlib import Path
import subprocess
import sys
import unittest
from unittest.mock import Mock, patch
class VerificationDepots(unittest.TestCase):
def setUp(self):
path = Path(__file__).resolve().parents[1] / "Server/Unix/p4/common/bin/p4verify.py"
spec = importlib.util.spec_from_file_location("verified_depot_query", path)
self.module = importlib.util.module_from_spec(spec)
sys.modules[spec.name] = self.module
self.addCleanup(sys.modules.pop, spec.name, None)
spec.loader.exec_module(self.module)
self.verify = self.module.P4Verify.__new__(self.module.P4Verify)
self.verify.p4_base, self.verify.L = ["fixture-p4"], Mock()
self.verify.bail = Mock(side_effect=RuntimeError("verification stopped"))
def test_tagged_query_preserves_all_depot_names_and_types(self):
def query(argv, **kwargs):
# Captured shapes from p4 2026.1: untagged -Mj yields text in data.
output = ('{"name":"depot","type":"local"}\n'
'{"name":"a.b-1","type":"stream"}\n'
'{"name":"spec","type":"spec"}\n'
'{"name":"unload","type":"unload"}\n') if "-ztag" in argv else '{"data":"Depot depot 2026/10/17 local depot/..."}\n'
return subprocess.CompletedProcess(argv, 0, output, "")
with patch.object(self.module.subprocess, "run", side_effect=query):
self.assertEqual(self.verify._get_depots_by_type(), {"depot": "local", "a.b-1": "stream", "spec": "spec", "unload": "unload"})
def test_query_failure_stops_verification_instead_of_empty_success(self):
self.verify.run_p4_mj = Mock(return_value=([], None, 1))
with self.assertRaises(RuntimeError):
self.verify._get_depots_by_type()
def test_unrecognized_record_cannot_silently_exclude_a_depot(self):
for record in ({"data": "Depot unknown local unknown/..."}, {"data": "Permission denied", "severity": 3}):
with self.subTest(record=record), self.assertRaises(RuntimeError):
self.verify.run_p4_mj = Mock(return_value=([record], None, 0))
self.verify._get_depots_by_type()
if __name__ == "__main__":
unittest.main()
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #1 | 34004 | Russell C. Jackson (Rusty) |
Improve SDP backup/recovery, Maintenance, logging and cloud operation. Add owned checkpoint locks, recovery-aware retention, preserved database switches, bounded cleanup and coordinated AWS/Azure snapshots. Fix service-user password initialization, edge staging, standby promotion state parsing, proxy cache setup, typed depot verification and historical-server configuration/error handling. Remove unused OTP programs; keep Windows removed, server.locks cleanup and the journal-count condition unchanged. Add no global shell strict modes. Update operational documentation and add reproducible mkdirs.sh/mkdirs.cfg container assurance. Validate Ubuntu 26.04 and UBI 8.10/9.8/10.2 across both Python runtimes: 44 stages; 428 offline tests per runtime/OS, zero offline skips; 19 deployed-archive comparisons per combination. Three six-node topology runs pass all 30 recovery/failure scenarios. P4D 2023.1 through 2026.1 on UBI 8/9 pass all 14 cells and 98 scenarios. Static, documentation and provenance checks pass. Containers do not certify every fleet kernel, patch build or integration. Tested source manifest SHA-256: e1a23e17b8ced8c1148d9a250589977c6f6e98606bf2a81dc3ff5d7c909e3695 Deployed comparison archive SHA-256: 1bd23217356ee3808e040d39aea5be9519bda7c8f2b4924656a70aff8ad7293a |