Merge "Improve server functional tests"

This commit is contained in:
Jenkins 2016-06-23 20:56:06 +00:00 committed by Gerrit Code Review
commit a7aa9e8ca0

@ -23,19 +23,27 @@ class ServerTests(test.TestCase):
@classmethod @classmethod
def get_flavor(cls): def get_flavor(cls):
# NOTE(rtheis): Get m1.tiny flavor since functional tests may # NOTE(rtheis): Get cirros256 or m1.tiny flavors since functional
# create other flavors. # tests may create other flavors.
raw_output = cls.openstack('flavor show m1.tiny -c id -f value') flavors = cls.openstack('flavor list -c Name -f value').split('\n')
return raw_output.strip('\n') server_flavor = None
for flavor in flavors:
if flavor in ['m1.tiny', 'cirros256']:
server_flavor = flavor
break
return server_flavor
@classmethod @classmethod
def get_image(cls): def get_image(cls):
# NOTE(rtheis): Get public images since functional tests may # NOTE(rtheis): Get cirros image since functional tests may
# create private images. # create other images.
raw_output = cls.openstack('image list --public -f value -c ID') images = cls.openstack('image list -c Name -f value').split('\n')
ray = raw_output.split('\n') server_image = None
idx = int(len(ray) / 2) for image in images:
return ray[idx] if image.startswith('cirros-') and image.endswith('-uec'):
server_image = image
break
return server_image
@classmethod @classmethod
def get_network(cls): def get_network(cls):