diff options
author | Stephen Finucane <sfinucan@redhat.com> | 2019-12-06 14:59:30 +0000 |
---|---|---|
committer | Stephen Finucane <sfinucan@redhat.com> | 2019-12-06 15:36:23 +0000 |
commit | d05fd530c7b060b87a8be30745aa37221c38744e (patch) | |
tree | 8a26fc82f5eed805d5a8449ed5051d86c26d55f2 /nova/tests/functional/integrated_helpers.py | |
parent | 7ae1a1091326292b02d879ae5410d5e7e78d3997 (diff) | |
download | nova-d05fd530c7b060b87a8be30745aa37221c38744e.tar.gz |
functional: Make '_IntegratedTestBase' subclass 'InstanceHelperMixin'
This means we can drop many duplicate implementations of things
- nova.tests.function.integrated_helpers._IntegratedTestBase
- _build_minimal_create_server_request
- nova.tests.functional.test_servers.ServersTestBase
- _wait_for_server_parameter
- _wait_for_state_change
- _wait_until_deleted
Change-Id: I0d21cb94c932e6e556eca964c57868c705b2d120
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'nova/tests/functional/integrated_helpers.py')
-rw-r--r-- | nova/tests/functional/integrated_helpers.py | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/nova/tests/functional/integrated_helpers.py b/nova/tests/functional/integrated_helpers.py index c1e40c7177..832de02968 100644 --- a/nova/tests/functional/integrated_helpers.py +++ b/nova/tests/functional/integrated_helpers.py @@ -244,7 +244,7 @@ class InstanceHelperMixin(object): return api.post_aggregate(body)['id'] -class _IntegratedTestBase(test.TestCase): +class _IntegratedTestBase(test.TestCase, InstanceHelperMixin): REQUIRES_LOCKING = True ADMIN_API = False # This indicates whether to include the project ID in the URL for API @@ -321,37 +321,6 @@ class _IntegratedTestBase(test.TestCase): return (generate_new_element(flavor_names, 'flavor'), int(generate_new_element(flavor_ids, '', True))) - def _build_minimal_create_server_request(self, name=None, image_uuid=None, - flavor_id=None, networks=None, - az=None, host=None): - server = {} - - if not image_uuid: - # NOTE(takashin): In API version 2.36, image APIs were deprecated. - # In API version 2.36 or greater, self.api.get_images() returns - # a 404 error. In that case, 'image_uuid' should be specified. - image_uuid = self.api.get_images()[0]['id'] - server['imageRef'] = image_uuid - - if not name: - name = ''.join( - random.choice(string.ascii_lowercase) for i in range(10)) - server['name'] = name - - if not flavor_id: - # Set a valid flavorId - flavor_id = self.api.get_flavors()[0]['id'] - server['flavorRef'] = 'http://fake.server/%s' % flavor_id - - if networks is not None: - server['networks'] = networks - if az is not None: - server['availability_zone'] = az - # This requires at least microversion 2.74 to work - if host is not None: - server['host'] = host - return server - def _create_flavor_body(self, name, ram, vcpus, disk, ephemeral, id, swap, rxtx_factor, is_public): return { |