Skip to content

Commit a7aa9e8

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Improve server functional tests"
2 parents 13e27c3 + d08cf31 commit a7aa9e8

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

functional/tests/compute/v2/test_server.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,27 @@ class ServerTests(test.TestCase):
2323

2424
@classmethod
2525
def get_flavor(cls):
26-
# NOTE(rtheis): Get m1.tiny flavor since functional tests may
27-
# create other flavors.
28-
raw_output = cls.openstack('flavor show m1.tiny -c id -f value')
29-
return raw_output.strip('\n')
26+
# NOTE(rtheis): Get cirros256 or m1.tiny flavors since functional
27+
# tests may create other flavors.
28+
flavors = cls.openstack('flavor list -c Name -f value').split('\n')
29+
server_flavor = None
30+
for flavor in flavors:
31+
if flavor in ['m1.tiny', 'cirros256']:
32+
server_flavor = flavor
33+
break
34+
return server_flavor
3035

3136
@classmethod
3237
def get_image(cls):
33-
# NOTE(rtheis): Get public images since functional tests may
34-
# create private images.
35-
raw_output = cls.openstack('image list --public -f value -c ID')
36-
ray = raw_output.split('\n')
37-
idx = int(len(ray) / 2)
38-
return ray[idx]
38+
# NOTE(rtheis): Get cirros image since functional tests may
39+
# create other images.
40+
images = cls.openstack('image list -c Name -f value').split('\n')
41+
server_image = None
42+
for image in images:
43+
if image.startswith('cirros-') and image.endswith('-uec'):
44+
server_image = image
45+
break
46+
return server_image
3947

4048
@classmethod
4149
def get_network(cls):

0 commit comments

Comments
 (0)