refactor(hosts): organize repository by server profiles (hosts/raspberrypi5, hosts/llm-node) and add host-aware installer
This commit is contained in:
1 parent
c53fc0a939
commit
c2740c9542
44 files changed
+528
-40
No files matched your search
@@ -239,6 +239,35 @@ class RecoveryPointAndManifestTests(unittest.TestCase):
|
||||
self.assertTrue((out_dir / 'shinkan-prod.sql.sha256').is_file())
|
||||
self.assertTrue((out_dir / 'shinkan-prod.sql.media.jsonl').is_file())
|
||||
|
||||
def test_host_profiles_raspberrypi5_and_llm_node(self):
|
||||
repo_root = Path(__file__).resolve().parents[1]
|
||||
for host_name, expected_jobs in (('raspberrypi5', 19), ('llm-node', 1)):
|
||||
host_dir = app.resolve_repo_host_dir(host_name)
|
||||
self.assertIsNotNone(host_dir, f'Missing host dir for {host_name}')
|
||||
host_cfg = app.load_host_config(host_name=host_name)
|
||||
self.assertEqual(host_cfg['hostname'], host_name)
|
||||
jobs = app.load_jobs(host_dir / 'jobs.csv')
|
||||
self.assertEqual(len(jobs), expected_jobs)
|
||||
notify = app.load_notifications(
|
||||
host_dir / 'notifications.json.example',
|
||||
known_ids=[j['id'] for j in jobs],
|
||||
)
|
||||
self.assertIn('kuma', notify)
|
||||
targets = app.load_targets_config(host_name=host_name)
|
||||
self.assertEqual(targets['host'], host_name)
|
||||
self.assertIn('pi-prod', targets['targets'])
|
||||
# Verify every job script exists in either hosts/<host>/scripts/ or scripts/common/
|
||||
for job in jobs:
|
||||
script_name = Path(job['script']).name
|
||||
if job['id'] == 'system-image':
|
||||
continue
|
||||
exists_in_host = (host_dir / 'scripts' / script_name).is_file()
|
||||
exists_in_common = (repo_root / 'scripts' / 'common' / script_name).is_file()
|
||||
self.assertTrue(
|
||||
exists_in_host or exists_in_common,
|
||||
f"Missing script {script_name} for job {job['id']} on host {host_name}",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user