functional: Stop setting Flavor.id

In change I475ea0fa5f2d5b197118f0ced5a0ff6907411972, we changed how we
generated flavor names and IDs to stop basing them on existing flavors.
However, the call to 'randint(10000)' that we used instead has proven
problematic since there is a high chance of collisions that will only
increase as the number of tests increase. We could switch back to the
previous scheme but that's unnecessary since there's actually no reason
we need to set 'Flavor.id' in the first place...so don't.

A now-unused remnant of the "old way" is also removed, since it was
spotted while fixing this.

Change-Id: Iab6245bc5ed8f95dae9c384b96e6bef0add7dca6
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Closes-bug: #1860417
This commit is contained in:
Stephen Finucane 2020-01-21 09:44:14 +00:00
parent 824bc358c2
commit 765e4e52bf
1 changed files with 0 additions and 13 deletions

View File

@ -225,9 +225,6 @@ class InstanceHelperMixin(object):
:param is_public: Whether the flavor is public or not.
:returns: The generated request body.
"""
if not id:
id = random.randint(0, 10000)
if not name:
name = ''.join(
random.choice(string.ascii_lowercase) for i in range(20))
@ -985,13 +982,3 @@ class ProviderUsageBaseTestCase(test.TestCase, InstanceHelperMixin):
fake_notifier.wait_for_versioned_notifications(
'instance.resize_revert.end')
return server
def get_unused_flavor_name_id(self):
flavors = self.api.get_flavors()
flavor_names = list()
flavor_ids = list()
[(flavor_names.append(flavor['name']),
flavor_ids.append(flavor['id']))
for flavor in flavors]
return (generate_new_element(flavor_names, 'flavor'),
int(generate_new_element(flavor_ids, '', True)))