tests: Speed up 'servers' API tests

This file is a bit of a mess and currently takes a long time to run.
Resolve a number of issues, significantly speeding up run time.

- Inherit from base classes without tests. This reduces our test
  coverage somewhat but that seems reasonable compared to running the
  same test sometimes 5 or 6 times.

- Remove duplicated tests and helpers

- Move some tests around, so that e.g. a 'ServersControllerTest'
  subclass, which is supposed to handle show/list tests doesn't include
  tests for rebuilding a server.

The end result in a test run that drops from ~308.5 sec to ~81.5 sec on
my localhost, or a nearly 4x decrease in test time execution with
clearer tests and similar meaningful test coverage.

Change-Id: Ie09969a26ad03cb29ed717ea86bd5ae7ec761586
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2021-03-29 12:00:40 +01:00
parent cfa33d3b06
commit 48429cc461
2 changed files with 460 additions and 552 deletions

View File

@ -39,16 +39,6 @@ CONF = nova.conf.CONF
FAKE_UUID = fakes.FAKE_UUID
class MockSetAdminPassword(object):
def __init__(self):
self.instance_id = None
self.password = None
def __call__(self, context, instance, password):
self.instance_id = instance['uuid']
self.password = password
@ddt.ddt
class ServerActionsControllerTestV21(test.TestCase):
image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'

File diff suppressed because it is too large Load Diff