Merge "Add volume backed instance coverage to API tests"

This commit is contained in:
Jenkins 2017-07-21 23:23:19 +00:00 committed by Gerrit Code Review
commit 878845412e

View File

@ -28,6 +28,7 @@ CONF = config.CONF
class ServersTestJSON(base.BaseV2ComputeTest):
disk_config = 'AUTO'
volume_backed = False
@classmethod
def setup_credentials(cls):
@ -57,7 +58,8 @@ class ServersTestJSON(base.BaseV2ComputeTest):
accessIPv4=cls.accessIPv4,
accessIPv6=cls.accessIPv6,
disk_config=disk_config,
adminPass=cls.password)
adminPass=cls.password,
volume_backed=cls.volume_backed)
cls.server = (cls.client.show_server(server_initial['id'])
['server'])
@ -71,6 +73,10 @@ class ServersTestJSON(base.BaseV2ComputeTest):
self.assertEqual(self.server['accessIPv6'],
str(netaddr.IPAddress(self.accessIPv6)))
self.assertEqual(self.name, self.server['name'])
if self.volume_backed:
# Image is an empty string as per documentation
self.assertEqual("", self.server['image'])
else:
self.assertEqual(self.image_ref, self.server['image']['id'])
self.assertEqual(self.flavor_ref, self.server['flavor']['id'])
self.assertEqual(self.meta, self.server['metadata'])
@ -152,3 +158,15 @@ class ServersTestManualDisk(ServersTestJSON):
if not CONF.compute_feature_enabled.disk_config:
msg = "DiskConfig extension not enabled."
raise cls.skipException(msg)
class ServersTestBootFromVolume(ServersTestJSON):
"""Run the `ServersTestJSON` tests with a volume backed VM"""
volume_backed = True
@classmethod
def skip_checks(cls):
super(ServersTestBootFromVolume, cls).skip_checks()
if not test.get_service_list()['volume']:
msg = "Volume service not enabled."
raise cls.skipException(msg)