feat(vesc): extend motor diagnostics, configuration and transport recovery
Add firmware and extension catalogues, configuration transactions, sample review and QML diagnostics. Preserve explicit authority, bounded retries and stop recovery in motor transport.
This commit is contained in:
@@ -107,6 +107,21 @@ class ServiceTests(unittest.TestCase):
|
||||
"requested_at": now.isoformat(), "deadline_at": (now + timedelta(seconds=60)).isoformat(),
|
||||
"action_id": action, "parameters": {}}
|
||||
|
||||
def test_configuration_snapshot_is_bounded_and_retry_never_reexecutes(self):
|
||||
from unittest.mock import patch
|
||||
command = self.command(action="vesc.configuration.read")
|
||||
with patch.object(FakeLink, "configuration", create=True, return_value={"motor": {"xml": "synthetic"}}) as read:
|
||||
result = self.service.execute(command)
|
||||
self.assertEqual(result["state"], "complete")
|
||||
self.assertEqual(self.service.execute(command), result)
|
||||
self.assertEqual(read.call_count, 1)
|
||||
journal = json.loads((self.service.root / (command["operation_id"] + ".json")).read_text())
|
||||
self.assertTrue(journal["snapshot_only"])
|
||||
self.assertNotIn("synthetic", json.dumps(journal))
|
||||
self.service.read_cache.items.clear()
|
||||
self.assertEqual(self.service.execute(command)["state"], "error")
|
||||
self.assertEqual(read.call_count, 1)
|
||||
|
||||
def test_two_attachments_promote_independently(self):
|
||||
items = self.service.inventory("node_synthetic")["items"]
|
||||
self.assertEqual(len({i["id"] for i in items}), 2)
|
||||
@@ -149,6 +164,10 @@ class ServiceTests(unittest.TestCase):
|
||||
process = FakeLink.instances[0]
|
||||
process.alive = False
|
||||
self.service.scan()
|
||||
self.assertTrue(process.closed)
|
||||
self.assertFalse(self.service.inventory("node_synthetic")["items"][0]["verified"])
|
||||
next(iter(self.service.devices.values())).retry_at = 0
|
||||
self.service.scan()
|
||||
current = next(i for i in self.service.inventory("node_synthetic")["items"] if i["id"] == old["id"])
|
||||
self.assertTrue(process.closed)
|
||||
self.assertNotEqual(current["snapshot"]["context"]["session_id"], old["snapshot"]["context"]["session_id"])
|
||||
|
||||
Reference in New Issue
Block a user