more smoketest fixes
This commit is contained in:
parent
9bd72f5622
commit
2f4258d99e
@ -30,5 +30,3 @@
|
|||||||
.. moduleauthor:: Manish Singh <yosh@gimp.org>
|
.. moduleauthor:: Manish Singh <yosh@gimp.org>
|
||||||
.. moduleauthor:: Andy Smith <andy@anarkystic.com>
|
.. moduleauthor:: Andy Smith <andy@anarkystic.com>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from exception import *
|
|
||||||
|
@ -17,12 +17,10 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import boto
|
import boto
|
||||||
import boto_v6
|
|
||||||
import commands
|
import commands
|
||||||
import httplib
|
import httplib
|
||||||
import os
|
import os
|
||||||
import paramiko
|
import paramiko
|
||||||
import random
|
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from boto.ec2.regioninfo import RegionInfo
|
from boto.ec2.regioninfo import RegionInfo
|
||||||
@ -30,6 +28,8 @@ from boto.ec2.regioninfo import RegionInfo
|
|||||||
from smoketests import flags
|
from smoketests import flags
|
||||||
|
|
||||||
FLAGS = flags.FLAGS
|
FLAGS = flags.FLAGS
|
||||||
|
boto_v6 = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SmokeTestCase(unittest.TestCase):
|
class SmokeTestCase(unittest.TestCase):
|
||||||
@ -146,6 +146,9 @@ class SmokeTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
def run_tests(suites):
|
def run_tests(suites):
|
||||||
argv = FLAGS(sys.argv)
|
argv = FLAGS(sys.argv)
|
||||||
|
if FLAGS.use_ipv6:
|
||||||
|
global boto_v6
|
||||||
|
boto_v6 = __import__('boto_v6')
|
||||||
|
|
||||||
if not os.getenv('EC2_ACCESS_KEY'):
|
if not os.getenv('EC2_ACCESS_KEY'):
|
||||||
print >> sys.stderr, 'Missing EC2 environment variables. Please ' \
|
print >> sys.stderr, 'Missing EC2 environment variables. Please ' \
|
||||||
|
@ -36,4 +36,4 @@ DEFINE_bool = DEFINE_bool
|
|||||||
|
|
||||||
DEFINE_string('region', 'nova', 'Region to use')
|
DEFINE_string('region', 'nova', 'Region to use')
|
||||||
DEFINE_string('test_image', 'ami-tty', 'Image to use for launch tests')
|
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')
|
||||||
|
@ -189,8 +189,8 @@ class InstanceTests(UserSmokeTestCase):
|
|||||||
try:
|
try:
|
||||||
conn = self.connect_ssh(self.data['private_ip'], TEST_KEY)
|
conn = self.connect_ssh(self.data['private_ip'], TEST_KEY)
|
||||||
conn.close()
|
conn.close()
|
||||||
except Exception:
|
except Exception, e:
|
||||||
time.sleep(1)
|
time.sleep(5)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
@ -224,7 +224,7 @@ class InstanceTests(UserSmokeTestCase):
|
|||||||
try:
|
try:
|
||||||
conn = self.connect_ssh(self.data['public_ip'], TEST_KEY)
|
conn = self.connect_ssh(self.data['public_ip'], TEST_KEY)
|
||||||
conn.close()
|
conn.close()
|
||||||
except socket.error:
|
except Exception:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
@ -256,17 +256,24 @@ class VolumeTests(UserSmokeTestCase):
|
|||||||
instance_type='m1.tiny',
|
instance_type='m1.tiny',
|
||||||
key_name=TEST_KEY)
|
key_name=TEST_KEY)
|
||||||
instance = reservation.instances[0]
|
instance = reservation.instances[0]
|
||||||
self.data['instance'] = instance
|
|
||||||
for x in xrange(120):
|
for x in xrange(120):
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
instance.update()
|
instance.update()
|
||||||
#if self.can_ping(instance.private_dns_name):
|
if self.can_ping(instance.private_dns_name):
|
||||||
if instance.state == u'running':
|
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.fail('unable to start instance')
|
self.fail('unable to start instance')
|
||||||
time.sleep(10)
|
self.data['instance'] = instance
|
||||||
instance.update()
|
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):
|
def test_001_can_create_volume(self):
|
||||||
volume = self.conn.create_volume(1, 'nova')
|
volume = self.conn.create_volume(1, 'nova')
|
||||||
@ -279,7 +286,6 @@ class VolumeTests(UserSmokeTestCase):
|
|||||||
volume = self.data['volume']
|
volume = self.data['volume']
|
||||||
|
|
||||||
for x in xrange(30):
|
for x in xrange(30):
|
||||||
print volume.status
|
|
||||||
if volume.status.startswith('available'):
|
if volume.status.startswith('available'):
|
||||||
break
|
break
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@ -438,7 +444,7 @@ class SecurityGroupTests(UserSmokeTestCase):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
suites = {'image': unittest.makeSuite(ImageTests),
|
suites = {'image': unittest.makeSuite(ImageTests),
|
||||||
'instance': unittest.makeSuite(InstanceTests),
|
'instance': unittest.makeSuite(InstanceTests),
|
||||||
'security_group': unittest.makeSuite(SecurityGroupTests),
|
#'security_group': unittest.makeSuite(SecurityGroupTests),
|
||||||
'volume': unittest.makeSuite(VolumeTests)
|
'volume': unittest.makeSuite(VolumeTests)
|
||||||
}
|
}
|
||||||
sys.exit(base.run_tests(suites))
|
sys.exit(base.run_tests(suites))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user