add test and fix describe regions
This commit is contained in:
parent
f6c360947a
commit
354c16138a
|
@ -252,18 +252,18 @@ class CloudController(object):
|
|||
regions = []
|
||||
for region in FLAGS.region_list:
|
||||
name, _sep, host = region.partition('=')
|
||||
endpoint = '%s://%s:%s%s' % (FLAGS.ec2_prefix,
|
||||
endpoint = '%s://%s:%s%s' % (FLAGS.ec2_scheme,
|
||||
host,
|
||||
FLAGS.ec2_port,
|
||||
FLAGS.ec2_suffix)
|
||||
FLAGS.ec2_path)
|
||||
regions.append({'regionName': name,
|
||||
'regionEndpoint': endpoint})
|
||||
else:
|
||||
regions = [{'regionName': 'nova',
|
||||
'regionEndpoint': '%s://%s:%s%s' % (FLAGS.ec2_prefix,
|
||||
'regionEndpoint': '%s://%s:%s%s' % (FLAGS.ec2_scheme,
|
||||
FLAGS.ec2_host,
|
||||
FLAGS.ec2_port,
|
||||
FLAGS.ec2_suffix)}]
|
||||
FLAGS.ec2_path)}]
|
||||
return {'regionInfo': regions}
|
||||
|
||||
def describe_snapshots(self,
|
||||
|
|
|
@ -218,7 +218,7 @@ def _get_my_ip():
|
|||
DEFINE_string('my_ip', _get_my_ip(), 'host ip address')
|
||||
DEFINE_list('region_list',
|
||||
[],
|
||||
'list of region=url pairs separated by commas')
|
||||
'list of region=fqdn pairs separated by commas')
|
||||
DEFINE_string('connection_type', 'libvirt', 'libvirt, xenapi or fake')
|
||||
DEFINE_string('aws_access_key_id', 'admin', 'AWS Access ID')
|
||||
DEFINE_string('aws_secret_access_key', 'admin', 'AWS Access Key')
|
||||
|
|
|
@ -87,6 +87,17 @@ class CloudTestCase(test.TestCase):
|
|||
# NOTE(vish): create depends on pool, so just call helper directly
|
||||
return cloud._gen_key(self.context, self.context.user.id, name)
|
||||
|
||||
def test_describe_regions(self):
|
||||
"""Makes sure describe regions runs without raising an exception"""
|
||||
result = self.cloud.describe_regions(self.context)
|
||||
self.assertEqual(len(result['regionInfo']), 1)
|
||||
regions = FLAGS.region_list
|
||||
FLAGS.region_list = ["one=test_host1", "two=test_host2"]
|
||||
result = self.cloud.describe_regions(self.context)
|
||||
print result
|
||||
self.assertEqual(len(result['regionInfo']), 2)
|
||||
regions = FLAGS.region_list
|
||||
|
||||
def test_describe_addresses(self):
|
||||
"""Makes sure describe addresses runs without raising an exception"""
|
||||
address = "10.10.10.10"
|
||||
|
|
Loading…
Reference in New Issue