fix(dashboard): tolerate missing manifest
This commit is contained in:
@@ -5,6 +5,7 @@ from __future__ import annotations
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
from bot_bottle import supervise
|
||||
from bot_bottle.cli import dashboard
|
||||
@@ -144,6 +145,18 @@ class TestFilterAgents(unittest.TestCase):
|
||||
self.assertEqual(["beta", "echo"], out)
|
||||
|
||||
|
||||
class TestDashboardManifestLoading(unittest.TestCase):
|
||||
def test_new_agent_flow_empty_manifest_has_no_picker_entries(self):
|
||||
manifest = dashboard.Manifest.from_json_obj({"bottles": {}, "agents": {}})
|
||||
with mock.patch("bot_bottle.cli.dashboard._picker_modal", return_value=None) as picker:
|
||||
status = dashboard._new_agent_flow(
|
||||
None, manifest, {}, [], tmux_state=None, # type: ignore[arg-type]
|
||||
)
|
||||
picker.assert_called_once()
|
||||
self.assertEqual([], picker.call_args.args[1])
|
||||
self.assertIn("no agents configured", status)
|
||||
|
||||
|
||||
class TestRunningCounts(unittest.TestCase):
|
||||
"""Per-agent running-count surfaced in the picker so the
|
||||
operator sees `(N running)` before picking. Counts come from
|
||||
|
||||
@@ -280,6 +280,11 @@ class TestNoManifestDies(_ResolveCase):
|
||||
with self.assertRaises(Die):
|
||||
self.resolve()
|
||||
|
||||
def test_missing_ok_returns_empty_manifest(self):
|
||||
m = Manifest.resolve(str(self.cwd_root), missing_ok=True)
|
||||
self.assertEqual({}, dict(m.bottles))
|
||||
self.assertEqual({}, dict(m.agents))
|
||||
|
||||
|
||||
class TestUnknownBottleReferenceDies(_ResolveCase):
|
||||
"""An agent file naming a bottle that doesn't exist on disk
|
||||
|
||||
Reference in New Issue
Block a user