summaryrefslogtreecommitdiff
path: root/functional
diff options
context:
space:
mode:
authorRichard Theis <rtheis@us.ibm.com>2016-06-23 08:27:28 -0500
committerRichard Theis <rtheis@us.ibm.com>2016-06-23 08:30:22 -0500
commitd08cf31dc89a5ed09db491a832c252ac4f71501c (patch)
tree9c8181e2be0a24aa71d5ef5cbaa63d13706849ed /functional
parent51fcd7c30c466b1241b6f148390c83caca578c49 (diff)
downloadpython-openstackclient-d08cf31dc89a5ed09db491a832c252ac4f71501c.tar.gz
Improve server functional tests
Patch set [1] fixed timing issues related to the server functional tests. As part of the review, additional enhancements were suggested. This patch set provides those enhancements. In particular, the functional tests will now check for the cirros256 flavor and the cirros-*-uec image. [1] https://review.openstack.org/#/c/313870/ Change-Id: I7fe18e26b3d09db92bbe669ffafcd16618cae383
Diffstat (limited to 'functional')
-rw-r--r--functional/tests/compute/v2/test_server.py28
1 files changed, 18 insertions, 10 deletions
diff --git a/functional/tests/compute/v2/test_server.py b/functional/tests/compute/v2/test_server.py
index 96c1c1a5..d08b003f 100644
--- a/functional/tests/compute/v2/test_server.py
+++ b/functional/tests/compute/v2/test_server.py
@@ -23,19 +23,27 @@ class ServerTests(test.TestCase):
@classmethod
def get_flavor(cls):
- # NOTE(rtheis): Get m1.tiny flavor since functional tests may
- # create other flavors.
- raw_output = cls.openstack('flavor show m1.tiny -c id -f value')
- return raw_output.strip('\n')
+ # NOTE(rtheis): Get cirros256 or m1.tiny flavors since functional
+ # tests may create other flavors.
+ flavors = cls.openstack('flavor list -c Name -f value').split('\n')
+ server_flavor = None
+ for flavor in flavors:
+ if flavor in ['m1.tiny', 'cirros256']:
+ server_flavor = flavor
+ break
+ return server_flavor
@classmethod
def get_image(cls):
- # NOTE(rtheis): Get public images since functional tests may
- # create private images.
- raw_output = cls.openstack('image list --public -f value -c ID')
- ray = raw_output.split('\n')
- idx = int(len(ray) / 2)
- return ray[idx]
+ # NOTE(rtheis): Get cirros image since functional tests may
+ # create other images.
+ images = cls.openstack('image list -c Name -f value').split('\n')
+ server_image = None
+ for image in images:
+ if image.startswith('cirros-') and image.endswith('-uec'):
+ server_image = image
+ break
+ return server_image
@classmethod
def get_network(cls):