fix(smolmachines): raise SmolvmError instead of die() on wait_exec_ready timeout
test / unit (pull_request) Successful in 39s
test / integration (pull_request) Successful in 58s
test / unit (push) Successful in 38s
test / integration (push) Successful in 55s

die() raises Die(SystemExit), which implies a process exit. A timeout in
wait_exec_ready is a bringup failure — raising SmolvmError lets the caller
decide whether it's fatal, consistent with how machine_start failures propagate.
This commit was merged in pull request #123.
This commit is contained in:
2026-06-02 06:29:05 +00:00
parent c39bbe265b
commit a81f0ffa49
2 changed files with 12 additions and 11 deletions
+5 -7
View File
@@ -228,7 +228,7 @@ class TestWaitExecReady(unittest.TestCase):
wait_exec_ready("vm-x")
self.assertEqual(3, m.call_count)
def test_dies_on_timeout(self):
def test_raises_smolvm_error_on_timeout(self):
# machine_exec always returns non-zero; monotonic advances past
# the deadline after the first sleep so the loop exits.
ticks = [0.0, 0.0, 10.0] # third call puts us past deadline
@@ -236,13 +236,11 @@ class TestWaitExecReady(unittest.TestCase):
return_value=SmolvmRunResult(1, "", "")), \
patch.object(smolvm_mod.time, "monotonic",
side_effect=ticks), \
patch.object(smolvm_mod.time, "sleep"), \
patch.object(smolvm_mod, "die",
side_effect=SystemExit("die")) as die_mock:
with self.assertRaises(SystemExit):
patch.object(smolvm_mod.time, "sleep"):
with self.assertRaises(SmolvmError) as cm:
wait_exec_ready("vm-x", timeout=5.0)
die_mock.assert_called_once()
self.assertIn("vm-x", die_mock.call_args.args[0])
self.assertIn("vm-x", str(cm.exception))
self.assertIn("not ready", str(cm.exception))
class TestIsAvailable(unittest.TestCase):