From 335e26bb1d22f3574cbef36413faa8c2d2ac32a9 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 12 Dec 2022 10:32:29 +0530 Subject: [PATCH] test: fix failure on non-VMware env (#6969) PR #6964 added some changes for VM import test which are causing exceptions on non-VMware environments. This PR fixes those error and correctly skips unmanage and import tests for non-VMware env. Signed-off-by: Abhishek Kumar Signed-off-by: Abhishek Kumar --- .../smoke/test_vm_lifecycle_unmanage_import.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/integration/smoke/test_vm_lifecycle_unmanage_import.py b/test/integration/smoke/test_vm_lifecycle_unmanage_import.py index 26b485f751d..83879471674 100644 --- a/test/integration/smoke/test_vm_lifecycle_unmanage_import.py +++ b/test/integration/smoke/test_vm_lifecycle_unmanage_import.py @@ -60,6 +60,8 @@ class TestUnmanageVM(cloudstackTestCase): assert False, "get_suitable_test_template() failed to return template with description %s" % cls.services["ostype"] cls.hypervisorNotSupported = cls.hypervisor.lower() != "vmware" + if cls.hypervisorNotSupported: + return cls.services["small"]["zoneid"] = cls.zone.id cls.services["small"]["template"] = cls.template.id @@ -97,9 +99,14 @@ class TestUnmanageVM(cloudstackTestCase): def setUp(self): self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() - self.services["network"]["networkoffering"] = self.network_offering.id self.cleanup = [] self.created_networks = [] + self.virtual_machine = None + self.unmanaged_instance = None + self.imported_vm = None + if self.hypervisorNotSupported: + return + self.services["network"]["networkoffering"] = self.network_offering.id network_data = self.services["l2-network"] self.network = Network.create( self.apiclient, @@ -127,8 +134,6 @@ class TestUnmanageVM(cloudstackTestCase): ) self.cleanup.append(self.network2) self.created_networks.append(self.network2) - self.unmanaged_instance = None - self.imported_vm = None ''' Fetch vmware datacenter login details