Skip to content

Commit 4fabbdb

Browse files
nvazquezyadvr
authored andcommitted
test: Skip network migration tests for not supported hypervisors (#3021)
Skip network migration tests for not supported hypervisors instead of failing.
1 parent 4d8e75c commit 4fabbdb

File tree

1 file changed

+69
-62
lines changed

1 file changed

+69
-62
lines changed

test/integration/smoke/test_migration.py

Lines changed: 69 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
# Import System Modules
4141
from nose.plugins.attrib import attr
42+
from marvin.lib.decoratorGenerators import skipTestIf
4243

4344

4445
class Services:
@@ -76,83 +77,87 @@ def setUpClass(cls):
7677
cls.test_data = cls.testClient.getParsedTestDataConfig()
7778
cls.services = Services().services
7879

80+
cls.hypervisorNotSupported = False
7981
hypervisor = get_hypervisor_type(cls.api_client)
8082
if hypervisor.lower() not in ["vmware", "kvm"]:
81-
raise unittest.SkipTest("This feature is supported "
82-
"only on Vmware and KVM")
83-
84-
# Get Domain, Zone, Template
85-
cls.domain = get_domain(cls.api_client)
86-
cls.zone = get_zone(
87-
cls.api_client,
88-
cls.testClient.getZoneForTests())
89-
cls.template = get_template(
90-
cls.api_client,
91-
cls.zone.id,
92-
cls.test_data["ostype"]
93-
)
94-
cls.services["virtual_machine"]["template"] = cls.template.id
95-
if cls.zone.localstorageenabled:
96-
cls.storagetype = 'local'
97-
cls.test_data["service_offerings"][
98-
"tiny"]["storagetype"] = 'local'
99-
else:
100-
cls.storagetype = 'shared'
101-
cls.test_data["service_offerings"][
102-
"tiny"]["storagetype"] = 'shared'
103-
104-
cls.service_offering = ServiceOffering.create(
105-
cls.api_client,
106-
cls.test_data["service_offerings"]["tiny"]
107-
)
83+
cls.hypervisorNotSupported = True
10884

109-
# Create Network offering without userdata
110-
cls.network_offering_nouserdata = NetworkOffering.create(
111-
cls.api_client,
112-
cls.test_data["network_offering"]
113-
)
114-
# Enable Network offering
115-
cls.network_offering_nouserdata.update(cls.api_client,
116-
state='Enabled')
117-
118-
# Create Network Offering with all the serices
119-
cls.network_offering_all = NetworkOffering.create(
120-
cls.api_client,
121-
cls.test_data["isolated_network_offering"]
122-
)
123-
# Enable Network offering
124-
cls.network_offering_all.update(cls.api_client, state='Enabled')
85+
cls._cleanup = []
86+
if not cls.hypervisorNotSupported:
87+
# Get Domain, Zone, Template
88+
cls.domain = get_domain(cls.api_client)
89+
cls.zone = get_zone(
90+
cls.api_client,
91+
cls.testClient.getZoneForTests())
92+
cls.template = get_template(
93+
cls.api_client,
94+
cls.zone.id,
95+
cls.test_data["ostype"]
96+
)
97+
cls.services["virtual_machine"]["template"] = cls.template.id
98+
if cls.zone.localstorageenabled:
99+
cls.storagetype = 'local'
100+
cls.test_data["service_offerings"][
101+
"tiny"]["storagetype"] = 'local'
102+
else:
103+
cls.storagetype = 'shared'
104+
cls.test_data["service_offerings"][
105+
"tiny"]["storagetype"] = 'shared'
106+
107+
cls.service_offering = ServiceOffering.create(
108+
cls.api_client,
109+
cls.test_data["service_offerings"]["tiny"]
110+
)
125111

126-
cls.native_vpc_network_offering = NetworkOffering.create(
112+
# Create Network offering without userdata
113+
cls.network_offering_nouserdata = NetworkOffering.create(
114+
cls.api_client,
115+
cls.test_data["network_offering"]
116+
)
117+
# Enable Network offering
118+
cls.network_offering_nouserdata.update(cls.api_client,
119+
state='Enabled')
120+
121+
# Create Network Offering with all the serices
122+
cls.network_offering_all = NetworkOffering.create(
127123
cls.api_client,
128-
cls.test_data["nw_offering_isolated_vpc"],
129-
conservemode=False)
130-
cls.native_vpc_network_offering.update(cls.api_client,
131-
state='Enabled')
132-
133-
cls._cleanup = [
134-
cls.service_offering,
135-
cls.network_offering_nouserdata,
136-
cls.network_offering_all,
137-
cls.native_vpc_network_offering
138-
]
124+
cls.test_data["isolated_network_offering"]
125+
)
126+
# Enable Network offering
127+
cls.network_offering_all.update(cls.api_client, state='Enabled')
128+
129+
cls.native_vpc_network_offering = NetworkOffering.create(
130+
cls.api_client,
131+
cls.test_data["nw_offering_isolated_vpc"],
132+
conservemode=False)
133+
cls.native_vpc_network_offering.update(cls.api_client,
134+
state='Enabled')
135+
136+
cls._cleanup = [
137+
cls.service_offering,
138+
cls.network_offering_nouserdata,
139+
cls.network_offering_all,
140+
cls.native_vpc_network_offering
141+
]
139142

140143
def setUp(self):
141144
self.apiclient = self.testClient.getApiClient()
142145
self.hypervisor = self.testClient.getHypervisorInfo()
143146
self.dbclient = self.testClient.getDbConnection()
144-
self.account = Account.create(
145-
self.apiclient,
146-
self.test_data["account"],
147-
admin=True,
148-
domainid=self.domain.id
149-
)
147+
if not self.hypervisorNotSupported:
148+
self.account = Account.create(
149+
self.apiclient,
150+
self.test_data["account"],
151+
admin=True,
152+
domainid=self.domain.id
153+
)
150154
self.cleanup = []
151155
return
152156

153157
def tearDown(self):
154158
try:
155-
self.account.delete(self.apiclient)
159+
if not self.hypervisorNotSupported:
160+
self.account.delete(self.apiclient)
156161
cleanup_resources(self.apiclient, self.cleanup)
157162
except Exception as e:
158163
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -176,6 +181,7 @@ def migrate_vpc(self, vpc, vpc_offering,
176181
vpc_offering.id,
177182
network_offering_map, resume)
178183

184+
@skipTestIf("hypervisorNotSupported")
179185
@attr(tags=["advanced", "smoke", "nativeisoonly"],
180186
required_hardware="false")
181187
def test_01_native_to_native_network_migration(self):
@@ -237,6 +243,7 @@ def test_01_native_to_native_network_migration(self):
237243
self.network_offering_all,
238244
isolated_network, resume=False)
239245

246+
@skipTestIf("hypervisorNotSupported")
240247
@attr(tags=["advanced", "smoke", "nativevpconly"],
241248
required_hardware="false")
242249
def test_02_native_to_native_vpc_migration(self):

0 commit comments

Comments
 (0)