Adjusted FMS tests for fringe failures

Adjusted delete tag test to ensure tags
are correct before test begins. Updated
test build flavor with two regions to
account for an unordered list in results.
Adjusted build interval to a longer period
to allow for slow networks.

Change-Id: I188953a0aab18e0cbd797907bc8d98ee6759e142
This commit is contained in:
jh629g 2020-06-30 11:06:08 -05:00 committed by Jeremy Houser
parent fec00c7117
commit 3ad54cf082
2 changed files with 31 additions and 17 deletions

View File

@ -179,15 +179,21 @@ class FmsBaseOrmTest(base.BaseOrmTest):
cls, flavor_id, rname):
cls.client.delete_region_from_flavor(flavor_id, rname)
time.sleep(10)
delete_loop_counter = 0
_, body = cls.client.get_flavor(flavor_id)
for regions_on_flavor in body['flavor']['regions']:
if regions_on_flavor['name'] == rname:
message = \
'Region {} failed to get deleted from flavor {}' \
.format(rname, flavor_id)
raise exceptions.TempestException(message)
while delete_loop_counter <= 5:
delete_loop_counter += 1
for regions_on_flavor in body['flavor']['regions']:
if regions_on_flavor['name'] == rname:
time.sleep(cls.build_interval)
_, body = cls.client.get_flavor(flavor_id)
if delete_loop_counter >= 5:
message = \
'Region {} failed to get deleted from flavor {}' \
.format(rname, flavor_id)
raise exceptions.TempestException(message)
@classmethod
def _wait_for_flavor_deletion_on_dcp(cls, flavor_id):

View File

@ -34,7 +34,7 @@ SYNC = lockutils.synchronized_with_prefix(PREFIX)
class TestTempestFms(fms_base.FmsBaseOrmTest):
region = CONF.identity.region
region_alt = CONF.ranger.alt_region
alt_region = CONF.ranger.alt_region
@classmethod
def setup_clients(cls):
@ -115,7 +115,7 @@ class TestTempestFms(fms_base.FmsBaseOrmTest):
def _create_region_group(self):
_, body = self.rms_client.create_region_group(
**orm_data_utils.rand_region_group([self.region,
self.region_alt])
self.alt_region])
)
group_id = body['group']['id']
self.addCleanup(
@ -339,6 +339,7 @@ class TestTempestFms(fms_base.FmsBaseOrmTest):
# restore deleted tags
self._exec_tags_function(self.flavor['id'], restore_tags, 'add', None)
@SYNC('alt_region')
@testtools.skipUnless(CONF.ranger.alt_region_available,
'Alt region not provided, skipping this test')
@decorators.idempotent_id('ec74d68f-b42a-41a8-9685-ff5eca25ea0c')
@ -538,6 +539,7 @@ class TestTempestFms(fms_base.FmsBaseOrmTest):
self.assertEqual(flavor_details["status"], "Success")
self.assertEqual(flavor_details["disk"], disk)
@SYNC('alt_region')
@testtools.skipUnless(CONF.ranger.alt_region_available,
'Alt region not provided, skipping this test')
@decorators.idempotent_id('997ca03c-4176-4632-a0c9-7e943b03306c')
@ -552,15 +554,19 @@ class TestTempestFms(fms_base.FmsBaseOrmTest):
flavor_details = self._get_flavor_details(test_flavor_id)
self.assertEqual(flavor_details['status'], 'Success')
self.assertEqual(flavor['regions'][0]['name'], CONF.identity.region)
assert self.region or self.alt_region in \
flavor['regions'][0]['name']
assert self.region or self.alt_region in \
flavor['regions'][1]['name']
@SYNC('alt_region')
@testtools.skipUnless(CONF.ranger.alt_region_available,
'Alt region not provided, skipping this test')
@decorators.idempotent_id('ea2a618e-bd53-460b-bde5-01ea20b417c9')
def test_create_flavor_with_two_regions(self):
post_body = self._get_flavor_params()
post_body['regions'].append(
{'name': self.region_alt}
{'name': self.alt_region}
)
flavor = self._data_setup(post_body)
test_flavor_id = flavor['id']
@ -568,6 +574,7 @@ class TestTempestFms(fms_base.FmsBaseOrmTest):
self.assertEqual(flavor_details['status'], 'Success')
self.assertEqual(len(flavor['regions']), 2)
@SYNC('alt_region')
@testtools.skipUnless(CONF.ranger.alt_region_available,
'Alt region not provided, skipping this test')
@decorators.idempotent_id('06c81b29-85b6-4edf-ab89-3877c49e23bc')
@ -583,8 +590,8 @@ class TestTempestFms(fms_base.FmsBaseOrmTest):
flavor = self._data_setup(post_body)
flavor_details = self._get_flavor_details(flavor['id'])
self.assertEqual(flavor_details['status'], 'Success')
assert self.region_alt or self.region in flavor['regions'][0]['name']
assert self.region_alt or self.region in flavor['regions'][1]['name']
assert self.alt_region or self.region in flavor['regions'][0]['name']
assert self.alt_region or self.region in flavor['regions'][1]['name']
@decorators.idempotent_id('997ca03c-4176-4632-a0c9-7e943b03306d')
def test_create_flavor_with_uuid(self):
@ -594,17 +601,18 @@ class TestTempestFms(fms_base.FmsBaseOrmTest):
self.assertEqual(flavor_details['status'], 'Success')
self.assertEqual(flavor['id'], post_body['id'])
@SYNC('alt_region')
@decorators.idempotent_id('37f1909f-3ba2-403c-ba0c-0a11b869d6a1')
def test_flavor_while_region_down(self):
# update region to status down
self._update_region(self.region, status={'status': 'down'})
self._update_region(self.alt_region, status={'status': 'down'})
# create flavor within that newly created region
post_body = self._get_flavor_params(set_region=False)
post_body['regions'] = [{'name': self.region}]
post_body['regions'] = [{'name': self.alt_region}]
self.assertRaises(exceptions.BadRequest,
self.client.create_flavor, **post_body)
self._update_region(self.region)
self._update_region(self.alt_region)
@decorators.idempotent_id('1c6a24d3-345e-46d4-aaa0-127b7fc8a42d')
def test_flavor_while_region_building(self):