This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new c956d329f5d Fix test_vm_schedule's intermittent failures (#7726)
c956d329f5d is described below

commit c956d329f5dfc6cb682b1a91bb9ec8b552512ea5
Author: Vishesh <[email protected]>
AuthorDate: Fri Jul 7 22:51:38 2023 +0530

    Fix test_vm_schedule's intermittent failures (#7726)
    
    * Fix test_vm_schedule's intermittent failures
    
    * Add smoke/test_vm_schedule to CI
---
 .github/workflows/ci.yml                   |  1 +
 test/integration/smoke/test_vm_schedule.py | 13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 731b514a542..d0061cb19af 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -125,6 +125,7 @@ jobs:
                   smoke/test_usage
                   smoke/test_usage_events
                   smoke/test_vm_deployment_planner
+                  smoke/test_vm_schedule
                   smoke/test_vm_life_cycle
                   smoke/test_vm_lifecycle_unmanage_import
                   smoke/test_vm_snapshot_kvm
diff --git a/test/integration/smoke/test_vm_schedule.py 
b/test/integration/smoke/test_vm_schedule.py
index 87a5b0a9907..e66470dff73 100644
--- a/test/integration/smoke/test_vm_schedule.py
+++ b/test/integration/smoke/test_vm_schedule.py
@@ -530,13 +530,13 @@ class TestVMSchedule(cloudstackTestCase):
         )
         self.assertNotEqual(len(vmschedules), 0, "Check VM Schedule is 
created")
 
-        # poll every 20 seconds (max waiting time is 4 minutes ) and check 
VM's state for changes
+        # poll every 10 seconds (max waiting time is 6 minutes) and check VM's 
state for changes
         previous_state = self.virtual_machine.state
         self.debug("VM state: %s" % self.virtual_machine.state)
         is_stop_schedule_working = False
         is_start_schedule_working = False
-        for i in range(0, 12):
-            time.sleep(20)
+        for i in range(0, 36):
+            time.sleep(10)
             current_state = self.virtual_machine.update(self.apiclient).state
             self.debug("Polling VM state: %s" % current_state)
             if previous_state in ("Running", "Starting") and current_state in (
@@ -570,6 +570,9 @@ class TestVMSchedule(cloudstackTestCase):
         start_vmschedule.delete(self.apiclient)
         stop_vmschedule.delete(self.apiclient)
 
+        # To ensure that all vm schedules have been deleted and all of their 
jobs have been completed
+        time.sleep(15)
+
         # Verify VM Schedule is deleted
         self.assertEqual(
             VMSchedule.list(
@@ -586,10 +589,10 @@ class TestVMSchedule(cloudstackTestCase):
             "Check VM Schedule is deleted",
         )
 
-        # Verify VM does not switch states after deleting schedules at least 
for 1.5 minutes
+        # Verify VM does not switch states after deleting schedules at least 
for 2 minutes
         previous_state = self.virtual_machine.update(self.apiclient).state
         state_changed = False
-        for i in range(0, 3):
+        for i in range(0, 4):
             time.sleep(30)
             current_state = self.virtual_machine.update(self.apiclient).state
             if previous_state != current_state:

Reply via email to