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 <abhishek.mrt22@gmail.com>

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2022-12-12 10:32:29 +05:30 committed by GitHub
parent 7f760cc395
commit 335e26bb1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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