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

pearl11594 pushed a commit to branch fix-unit-tests-8800-regression
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 1b6edf3ac090e7490154dfcffab9bfdce091836f
Author: Pearl Dsilva <[email protected]>
AuthorDate: Mon Mar 17 22:09:02 2025 -0400

    Fix unit tests due to change in behavior of restore VM
---
 test/integration/smoke/test_events_resource.py     | 15 +--------------
 test/integration/smoke/test_network_permissions.py |  5 +++++
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/test/integration/smoke/test_events_resource.py 
b/test/integration/smoke/test_events_resource.py
index 79443110950..6a3d533c007 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
 
@@ -161,21 +157,12 @@ class TestEventsResource(cloudstackTestCase):
         virtual_machine.restore(self.apiclient)
         time.sleep(self.services["sleep"])
         virtual_machine.detach_volume(self.apiclient, volume)
-        volume.delete(self.apiclient)
-        self.cleanup.remove(volume)
         ts = str(time.time())
         virtual_machine.update(self.apiclient, displayname=ts)
-        virtual_machine.delete(self.apiclient)
-        self.cleanup.remove(virtual_machine)
         account_network.update(self.apiclient, name=account_network.name + ts)
-        account_network.delete(self.apiclient)
-        self.cleanup.remove(account_network)
+        virtual_machine.start(self.apiclient)
         account.update(self.apiclient, newname=account.name + ts)
         account.disable(self.apiclient)
-        account.delete(self.apiclient)
-        self.cleanup.remove(account)
-        domain1.delete(self.apiclient)
-        self.cleanup.remove(domain1)
 
         cmd = listEvents.listEventsCmd()
         cmd.startdate = start_time
diff --git a/test/integration/smoke/test_network_permissions.py 
b/test/integration/smoke/test_network_permissions.py
index cd55c5af745..49dd780a5cb 100644
--- a/test/integration/smoke/test_network_permissions.py
+++ b/test/integration/smoke/test_network_permissions.py
@@ -733,6 +733,11 @@ class TestNetworkPermissions(cloudstackTestCase):
         self.exec_command("self.user_apiclient", command, expected=False)
         self.exec_command("self.otheruser_apiclient", command, expected=True)
 
+        #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)
+
         # 22. Destroy vm2, should succeed by vm owner
         command = """self.virtual_machine.delete({apiclient}, expunge=False)"""
         self.exec_command("self.user_apiclient", command, expected=False)

Reply via email to