@@ -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