Skip to content

Commit c1dba6a

Browse files
committed
Fix functional test failures
There have been a lot of functional test failures for compute and network. I believe they are timing related in that the test_server is sometimes booting a server with a flavor, image and/or network created by another functional test. Such resources are then deleted by the owning functional tests causing various types of failures Change-Id: Ib82edd487da46610374fb0eb5796cb98f2d3aa2c
1 parent 5df1884 commit c1dba6a

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

functional/tests/compute/v2/test_server.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,29 @@ class ServerTests(test.TestCase):
2424

2525
@classmethod
2626
def get_flavor(cls):
27-
raw_output = cls.openstack('flavor list -f value -c ID')
28-
ray = raw_output.split('\n')
29-
idx = int(len(ray) / 2)
30-
return ray[idx]
27+
# NOTE(rtheis): Get m1.tiny flavor since functional tests may
28+
# create other flavors.
29+
raw_output = cls.openstack('flavor show m1.tiny -c id -f value')
30+
return raw_output.strip('\n')
3131

3232
@classmethod
3333
def get_image(cls):
34-
raw_output = cls.openstack('image list -f value -c ID')
34+
# NOTE(rtheis): Get public images since functional tests may
35+
# create private images.
36+
raw_output = cls.openstack('image list --public -f value -c ID')
3537
ray = raw_output.split('\n')
3638
idx = int(len(ray) / 2)
3739
return ray[idx]
3840

3941
@classmethod
4042
def get_network(cls):
4143
try:
42-
raw_output = cls.openstack('network list -f value -c ID')
44+
# NOTE(rtheis): Get private network since functional tests may
45+
# create other networks.
46+
raw_output = cls.openstack('network show private -c id -f value')
4347
except exceptions.CommandFailed:
4448
return ''
45-
ray = raw_output.split('\n')
46-
idx = int(len(ray) / 2)
47-
return ' --nic net-id=' + ray[idx]
49+
return ' --nic net-id=' + raw_output.strip('\n')
4850

4951
def server_create(self, name=None):
5052
"""Create server. Add cleanup."""

0 commit comments

Comments
 (0)