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

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


The following commit(s) were added to refs/heads/4.19 by this push:
     new 07f4fc2e51d Fix smoke tests due to change in behavior of restore VM 
(#10583)
07f4fc2e51d is described below

commit 07f4fc2e51df07eba8c16964bc5b1f9adcec4056
Author: Pearl Dsilva <pearl1...@gmail.com>
AuthorDate: Sat Apr 26 10:11:27 2025 +0530

    Fix smoke tests due to change in behavior of restore VM (#10583)
    
    * Fix unit tests due to change in behavior of restore VM
    
    * update numbering in comments
    
    * revert delete operations
    
    * fix placement of start vm after refactoring
---
 test/integration/smoke/test_events_resource.py     |  5 +----
 test/integration/smoke/test_network_permissions.py | 15 ++++++++++-----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/test/integration/smoke/test_events_resource.py 
b/test/integration/smoke/test_events_resource.py
index 79443110950..dac95f8c090 100644
--- a/test/integration/smoke/test_events_resource.py
+++ b/test/integration/smoke/test_events_resource.py
@@ -20,10 +20,6 @@ import json
 import os
 import tempfile
 import time
-import unittest
-import urllib.error
-import urllib.parse
-import urllib.request
 
 from datetime import datetime
 
@@ -165,6 +161,7 @@ class TestEventsResource(cloudstackTestCase):
         self.cleanup.remove(volume)
         ts = str(time.time())
         virtual_machine.update(self.apiclient, displayname=ts)
+        virtual_machine.start(self.apiclient)
         virtual_machine.delete(self.apiclient)
         self.cleanup.remove(virtual_machine)
         account_network.update(self.apiclient, name=account_network.name + ts)
diff --git a/test/integration/smoke/test_network_permissions.py 
b/test/integration/smoke/test_network_permissions.py
index cd55c5af745..94ee05d7baf 100644
--- a/test/integration/smoke/test_network_permissions.py
+++ b/test/integration/smoke/test_network_permissions.py
@@ -733,12 +733,17 @@ class TestNetworkPermissions(cloudstackTestCase):
         self.exec_command("self.user_apiclient", command, expected=False)
         self.exec_command("self.otheruser_apiclient", command, expected=True)
 
-        # 22. Destroy vm2, should succeed by vm owner
+        # 22. Start VM before destroying, to recreate ROOT volume that was 
deleted as part of restore operation
+        command = """self.virtual_machine.start({apiclient})"""
+        self.exec_command("self.user_apiclient", command, expected=False)
+        self.exec_command("self.otheruser_apiclient", command, expected=True)
+
+        # 23. Destroy vm2, should succeed by vm owner
         command = """self.virtual_machine.delete({apiclient}, expunge=False)"""
         self.exec_command("self.user_apiclient", command, expected=False)
         self.exec_command("self.otheruser_apiclient", command, expected=True)
 
-        # 23. Recover vm2, should succeed by vm owner
+        # 24. Recover vm2, should succeed by vm owner
         allow_expunge_recover_vm = Configurations.list(self.apiclient, 
name="allow.user.expunge.recover.vm")[0].value
         self.logger.debug("Global configuration allow.user.expunge.recover.vm 
= %s", allow_expunge_recover_vm)
         if allow_expunge_recover_vm == "true":
@@ -746,12 +751,12 @@ class TestNetworkPermissions(cloudstackTestCase):
             self.exec_command("self.user_apiclient", command, expected=False)
             self.exec_command("self.otheruser_apiclient", command, 
expected=True)
 
-        # 24. Destroy vm2, should succeed by vm owner
+        # 25. Destroy vm2, should succeed by vm owner
         command = """self.virtual_machine.delete({apiclient}, expunge=False)"""
         self.exec_command("self.user_apiclient", command, expected=False)
         self.exec_command("self.otheruser_apiclient", command, expected=True)
 
-        # 25. Expunge vm2, should succeed by vm owner
+        # 26. Expunge vm2, should succeed by vm owner
         if allow_expunge_recover_vm == "true":
             command = """self.virtual_machine.expunge({apiclient})"""
             self.exec_command("self.user_apiclient", command, expected=False)
@@ -759,7 +764,7 @@ class TestNetworkPermissions(cloudstackTestCase):
         else:
             self.virtual_machine.expunge(self.apiclient)
 
-        # 26. Reset network permissions, should succeed by network owner
+        # 27. Reset network permissions, should succeed by network owner
         command = """self.reset_network_permission({apiclient}, 
self.user_network, expected=True)"""
         self.exec_command("self.otheruser_apiclient", command, expected=False)
         self.exec_command("self.user_apiclient", command, expected=True)

Reply via email to