1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00

test(vrtManager): the NVRAM copy test checks the error it raised, not its message

A libvirtError made in a test takes the message of the thread's last real
libvirt error: in a live run, after another test's closed connection,
"no marker" read "client socket is closed" and the test failed. It now
checks that the move raised that very error, as the test after it does.
This commit is contained in:
catborise 2026-11-01 20:45:41 +03:00
parent eb6e6ca626
commit 9aedb5b4d1

View file

@ -474,9 +474,13 @@ class NvramCopyTestCase(unittest.TestCase):
def test_a_directory_whose_sharing_cannot_be_told_stops_the_move(self):
self.shared.stop()
with mock.patch.object(wvmInstances, "same_directory", side_effect=libvirt.libvirtError("no marker")):
with self.assertRaisesRegex(libvirt.libvirtError, "no marker"):
# the raised error is this one: its message can be another libvirt
# error the thread recorded (a closed connection of an earlier live test)
error = libvirt.libvirtError("no marker")
with mock.patch.object(wvmInstances, "same_directory", side_effect=error):
with self.assertRaises(libvirt.libvirtError) as raised:
self.move()
self.assertIs(raised.exception, error)
self.shared.start()
self.assertEqual(self.host.defined, [])