1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 03:36:48 +00:00

fix(console): a serial console whose VM was deleted meanwhile says so

consolecallback read the VM's record with .get(): one deleted between
socketiod's accept and the worker's start ended with a Python traceback
in the user's terminal, which is the worker's stderr. It now says the VM
is no longer in the panel.
This commit is contained in:
catborise 2026-11-05 18:39:21 +03:00
parent c8fb778d08
commit 51aa712802
2 changed files with 11 additions and 1 deletions

View file

@ -106,3 +106,10 @@ class AccessTests(DjangoTestCase):
ownership.delete()
self.assertFalse(cb.may_still_open(owner.pk, vm))
self.assertFalse(cb.may_still_open(999999, vm))
def test_a_vm_deleted_since_the_connect_is_told_not_a_traceback(self):
cb = load()
with patch.object(cb.sys, "argv", ["consolecallback", "999999", "1"]), patch.object(cb, "say") as say, \
self.assertRaises(SystemExit):
cb.main()
say.assert_called_once_with("The VM is no longer in the panel")