From b9e423b7a9e9d585b0e2607f7205b8c6c40508c9 Mon Sep 17 00:00:00 2001 From: Vishesh Date: Thu, 5 Oct 2023 11:48:37 +0530 Subject: [PATCH] Add extra checks for test_vm_schedule to avoid intermittent failures (#8036) This PR adds additional checks in test_vm_schedule to avoid intermittent failures --- test/integration/smoke/test_vm_schedule.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/integration/smoke/test_vm_schedule.py b/test/integration/smoke/test_vm_schedule.py index bd699cf4d2b..ee1354ff80e 100644 --- a/test/integration/smoke/test_vm_schedule.py +++ b/test/integration/smoke/test_vm_schedule.py @@ -596,6 +596,10 @@ class TestVMSchedule(cloudstackTestCase): time.sleep(30) current_state = self.virtual_machine.update(self.apiclient).state if previous_state != current_state: + # Add these checks because VMs can take some time to start or stop + if (previous_state == 'Starting' and current_state in ('Starting', 'Running')) or ( + previous_state == 'Stopping' and current_state in ('Stopping', 'Stopped')): + continue self.debug( "VM changed state from %s to %s" % (previous_state, current_state) )