Verify packaged terminal UX in installed ISO acceptance

This commit is contained in:
Codex
2026-10-13 15:33:15 +03:00
parent 61a5628f9e
commit 73bcf616ee
3 changed files with 299 additions and 3 deletions
+48
View File
@@ -632,3 +632,51 @@ else: sys.exit(1)
def test_guest_tools_accept_gentoo_remote_viewer_without_virt_viewer(self):
self.assertEqual(self.probe_fixture('clean'), 0)
self.assertEqual(self.probe_fixture('clean', live=True), 0)
def test_terminal_ux_fixture_has_complete_iso_volume_and_nonboot_directory(self):
self.assertTrue(hasattr(self.mod, 'terminal_ux_iso'), 'Installed UX ISO fixture is missing')
from hydra.media import validate_iso, MediaError
iso = self.root / 'ux.iso'
data = self.mod.terminal_ux_iso()
iso.write_bytes(data)
self.assertEqual(validate_iso(iso), iso)
self.assertEqual(len(data), 21 * 2048)
self.assertEqual(data[16 * 2048:16 * 2048 + 7], b'\x01CD001\x01')
self.assertEqual(data[17 * 2048:17 * 2048 + 7], b'\xffCD001\x01')
self.assertEqual(data[20 * 2048 + 25], 2, 'Root directory must be a directory record')
self.assertNotIn(b'EL TORITO SPECIFICATION', data, 'Fixture must not imply an OS boot')
iso.write_bytes(data[:-2048])
with self.assertRaises(MediaError):
validate_iso(iso)
def test_terminal_ux_branding_rejects_wrong_os_missing_logo_and_render_errors(self):
self.assertTrue(hasattr(self.mod, 'verify_terminal_ux_branding'), 'Default Fastfetch verification is missing')
rendered = ' .-(o > .-(o > .-(o >\nH Y D R A O S\nOS: Hydra OS x86_64\n'
self.mod.verify_terminal_ux_branding('\x1b[36m' + rendered + '\x1b[0m', '')
for output, error in ((rendered.replace('OS: Hydra OS', 'OS: Gentoo'), ''),
(rendered.replace('(o >', 'head'), ''),
(rendered, 'Unknown JSON key: invalid'),
(rendered + 'Memory: Error loading module\n', '')):
with self.subTest(output=output, error=error):
with self.assertRaises(self.mod.SmokeError):
self.mod.verify_terminal_ux_branding(output, error)
def test_terminal_ux_snapshot_checks_live_qmp_identity_and_same_process(self):
self.assertTrue(hasattr(self.mod, 'terminal_ux_snapshot'), 'Installed UX identity verification is missing')
context, process, run = self.lifecycle_fixture()
before = self.mod.terminal_ux_snapshot(context)
self.assertEqual(before['pid'], process.pid)
self.assertEqual(before['uuid'], context['uuid'])
self.assertEqual(self.mod.terminal_ux_snapshot(context), before)
context['qmp_name'] = 'foreign-process'
with self.assertRaises(self.mod.SmokeError):
self.mod.terminal_ux_snapshot(context)
context.pop('qmp_name')
process.terminate(); process.wait(timeout=3)
with self.assertRaises(self.mod.SmokeError):
self.mod.terminal_ux_snapshot(context)
def test_installed_terminal_ux_script_compiles_as_standalone_guest_probe(self):
self.assertTrue(hasattr(self.mod, 'terminal_ux_guest_script'), 'Installed terminal UX probe is missing')
compile(self.mod.terminal_ux_guest_script(), '<guest-terminal-ux>', 'exec')