more smoketest fixes

This commit is contained in:
Vishvananda Ishaya 2011-01-20 00:14:42 -08:00
parent 9bd72f5622
commit 2f4258d99e
4 changed files with 22 additions and 15 deletions

View File

@ -30,5 +30,3 @@
.. moduleauthor:: Manish Singh <yosh@gimp.org>
.. moduleauthor:: Andy Smith <andy@anarkystic.com>
"""
from exception import *

View File

@ -17,12 +17,10 @@
# under the License.
import boto
import boto_v6
import commands
import httplib
import os
import paramiko
import random
import sys
import unittest
from boto.ec2.regioninfo import RegionInfo
@ -30,6 +28,8 @@ from boto.ec2.regioninfo import RegionInfo
from smoketests import flags
FLAGS = flags.FLAGS
boto_v6 = None
class SmokeTestCase(unittest.TestCase):
@ -146,6 +146,9 @@ class SmokeTestCase(unittest.TestCase):
def run_tests(suites):
argv = FLAGS(sys.argv)
if FLAGS.use_ipv6:
global boto_v6
boto_v6 = __import__('boto_v6')
if not os.getenv('EC2_ACCESS_KEY'):
print >> sys.stderr, 'Missing EC2 environment variables. Please ' \

View File

@ -36,4 +36,4 @@ DEFINE_bool = DEFINE_bool
DEFINE_string('region', 'nova', 'Region to use')
DEFINE_string('test_image', 'ami-tty', 'Image to use for launch tests')
DEFINE_string('use_ipv6', True, 'use the ipv6 or not')
DEFINE_bool('use_ipv6', True, 'use the ipv6 or not')

View File

@ -189,8 +189,8 @@ class InstanceTests(UserSmokeTestCase):
try:
conn = self.connect_ssh(self.data['private_ip'], TEST_KEY)
conn.close()
except Exception:
time.sleep(1)
except Exception, e:
time.sleep(5)
else:
break
else:
@ -224,7 +224,7 @@ class InstanceTests(UserSmokeTestCase):
try:
conn = self.connect_ssh(self.data['public_ip'], TEST_KEY)
conn.close()
except socket.error:
except Exception:
time.sleep(1)
else:
break
@ -256,17 +256,24 @@ class VolumeTests(UserSmokeTestCase):
instance_type='m1.tiny',
key_name=TEST_KEY)
instance = reservation.instances[0]
self.data['instance'] = instance
for x in xrange(120):
time.sleep(1)
instance.update()
#if self.can_ping(instance.private_dns_name):
if instance.state == u'running':
if self.can_ping(instance.private_dns_name):
break
else:
self.fail('unable to start instance')
time.sleep(10)
instance.update()
self.data['instance'] = instance
for x in xrange(30):
try:
conn = self.connect_ssh(instance.private_dns_name, TEST_KEY)
conn.close()
except Exception:
time.sleep(5)
else:
break
else:
self.fail('could not ssh to instance')
def test_001_can_create_volume(self):
volume = self.conn.create_volume(1, 'nova')
@ -279,7 +286,6 @@ class VolumeTests(UserSmokeTestCase):
volume = self.data['volume']
for x in xrange(30):
print volume.status
if volume.status.startswith('available'):
break
time.sleep(1)
@ -438,7 +444,7 @@ class SecurityGroupTests(UserSmokeTestCase):
if __name__ == "__main__":
suites = {'image': unittest.makeSuite(ImageTests),
'instance': unittest.makeSuite(InstanceTests),
'security_group': unittest.makeSuite(SecurityGroupTests),
#'security_group': unittest.makeSuite(SecurityGroupTests),
'volume': unittest.makeSuite(VolumeTests)
}
sys.exit(base.run_tests(suites))