1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

test(vmbackups): the late-host test no longer leaves the clock frozen

test_the_window_is_checked_again_after_the_host_answered started a
second timezone.now patch inside started()'s and stopped it last, so it
put started()'s frozen clock back for the tests after it: the worker's
heartbeat test then saw no time pass. The host's answer now moves the
clock started() set.
This commit is contained in:
catborise 2026-11-25 10:30:30 +03:00
parent de9f37a20d
commit d6cee18434

View file

@ -156,11 +156,11 @@ class ScheduleTests(TransactionTestCase):
def test_the_window_is_checked_again_after_the_host_answered(self):
self.pass_at(at(2026, 11, 17, 7, 59))
# the host answers the checks only after the window ended
self.proxy.backup_plan.side_effect = lambda: patch_now.start() or {
"definition": "<domain/>", "disks": [], "nvram": None, "left_out": []}
patch_now = patch("django.utils.timezone.now", return_value=at(2026, 11, 17, 8, 30))
self.addCleanup(patch.stopall)
def answer_late(): # the host answers the checks only after the window ended
timezone.now.return_value = at(2026, 11, 17, 8, 30) # the clock started() set
return {"definition": "<domain/>", "disks": [], "nvram": None, "left_out": []}
self.proxy.backup_plan.side_effect = answer_late
with self.assertRaisesMessage(OperationError, "window ended"):
self.started(at(2026, 11, 17, 7, 59, 30), self.creates()[0])
self.assertFalse(Backup.objects.exists())