Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tests/test_install_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,12 @@ def iterdir(path):
return {'PYTHONPATH': str(imports)}

def test_plain_install_updates_and_restarts_the_verified_fleet(self):
cache = ROOT / 'skills/orbi/scripts/__pycache__'

def bytecode_snapshot():
return {p.name: (hashlib.sha256(p.read_bytes()).hexdigest(), p.stat().st_mtime_ns)
for p in cache.glob('*.pyc')}

receipt, state, head = self.orbi_fleet_fixture()
vendor = self.home / '.config/systemd/user/vendor-shell@.service'
vendor.parent.mkdir(parents=True)
Expand All @@ -1991,6 +1997,7 @@ def test_plain_install_updates_and_restarts_the_verified_fleet(self):
state.write_text(json.dumps(states))
worker = Path(states['--system']['working-extra.service']['FragmentPath'])
worker.write_text(worker.read_text().replace(' --config ', ' \\\n --config '))
before_bytecode = bytecode_snapshot()
result = self.install(env={'KIT_INSTALL_REPORT': str(receipt), **self.unreadable_root_fixture()})
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
summary = result.stdout.split('Summary:', 1)[1]
Expand Down Expand Up @@ -2026,7 +2033,7 @@ def test_plain_install_updates_and_restarts_the_verified_fleet(self):
for d in ('paused', 'working')))
self.assertEqual(json.loads(state.read_text())['--user']['paused-worker.timer']['ActiveState'], 'active')
self.assertEqual(self.calls('uv'), [])
self.assertFalse((ROOT / 'skills/orbi/scripts/__pycache__').exists())
self.assertEqual(bytecode_snapshot(), before_bytecode, f'Bytecode changed in {cache}')

def test_fleet_refresh_verifies_a_simple_timer_worker_that_exits_at_once(self):
# Installed workers are Type=simple; a tick with no work ends with exit status 0.
Expand Down
10 changes: 9 additions & 1 deletion tests/test_orbi_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
preserve.
"""
import contextlib
import hashlib
import importlib.util
import io
import json
Expand Down Expand Up @@ -8729,9 +8730,16 @@ def test_help_keeps_python_floor_and_argparse_usage(self):
self.assertRegex(result.stdout, rf'{action} \[(none|staging|scheduler)\]')

def test_default_action_is_status_and_cli_uses_argv(self):
cache = HELPER.parent / '__pycache__'

def bytecode_snapshot():
return {p.name: (hashlib.sha256(p.read_bytes()).hexdigest(), p.stat().st_mtime_ns)
for p in cache.glob('*.pyc')}

with tempfile.TemporaryDirectory() as tmp:
h = Harness(Path(tmp))
before = snapshot(h.home)
before_bytecode = bytecode_snapshot()
result = subprocess.run(
[sys.executable, '-B', str(HELPER), '--repo-dir', str(h.repo), '--json'],
env=dict(h.env), capture_output=True, text=True, timeout=60)
Expand All @@ -8740,7 +8748,7 @@ def test_default_action_is_status_and_cli_uses_argv(self):
self.assertEqual(document['action'], 'status')
self.assertEqual(document['deployment']['state'], 'absent')
self.assertEqual(snapshot(h.home), before)
self.assertFalse((HELPER.parent / '__pycache__').exists())
self.assertEqual(bytecode_snapshot(), before_bytecode, f'Bytecode changed in {cache}')

def test_public_setup_mapping_is_shared_and_recovery_is_explicit(self):
skill = (ROOT / 'skills/orbi/SKILL.md').read_text()
Expand Down
Loading