update config & fix test against google
Change-Id: I713724a866a9fc8727bf0ad150c596bc4b4b6d12
This commit is contained in:
parent
3476775694
commit
9d31912f36
@ -36,7 +36,7 @@ class TestAddressesBase(test_base.GCETestCase):
|
||||
cfg = self.cfg
|
||||
project_id = cfg.project_id
|
||||
region = cfg.region
|
||||
self.trace('Crete address with options {}'.format(options))
|
||||
self.trace('Create address with options {}'.format(options))
|
||||
request = self.addresses.insert(
|
||||
project=project_id,
|
||||
region=region,
|
||||
|
@ -180,7 +180,7 @@ class TestDiskBase(TestImagesBase):
|
||||
cfg = self.cfg
|
||||
project_id = cfg.project_id
|
||||
zone = cfg.zone
|
||||
self.trace('Crete disk with options {} source_image={}'.
|
||||
self.trace('Create disk with options {} source_image={}'.
|
||||
format(options, source_image))
|
||||
request = self.disks.insert(
|
||||
project=project_id,
|
||||
@ -269,8 +269,9 @@ class TestDiskBase(TestImagesBase):
|
||||
self._create_disk(options, source_image=image['selfLink'])
|
||||
options['sourceImage'] = image['selfLink']
|
||||
options['sourceImageId'] = image['id']
|
||||
# TODO(alexey-mr): image diskSizeGb is not supported by OS GCE
|
||||
# options['sizeGb'] = image['diskSizeGb']
|
||||
if self.full_compatibility:
|
||||
# TODO(alexey-mr): image diskSizeGb is not supported by OS GCE
|
||||
options['sizeGb'] = image['diskSizeGb']
|
||||
return self._ensure_disk_created(options)
|
||||
|
||||
def _create_snapshot(self, disk_name, options):
|
||||
@ -331,16 +332,12 @@ class TestDisks(TestDiskBase):
|
||||
self._delete_disk(name)
|
||||
|
||||
def test_create_disk_from_image(self):
|
||||
name = self._rand_name('testdisk')
|
||||
image = 'projects/{}'.format(self.cfg.image)
|
||||
options = {
|
||||
'name': name,
|
||||
}
|
||||
self._create_disk(options, source_image=image)
|
||||
image_name, image_project = self._parse_image_url(self.cfg.image)
|
||||
image = self._get_image(image_name, image_project)
|
||||
disk = self._create_disk_from_image(image)
|
||||
# TODO(alexey-mr): image diskSizeGb is not supported by OS GCE
|
||||
# options['sizeGb'] = self._get_image_size(self.cfg.image)
|
||||
self._ensure_disk_created(options, source_image=image)
|
||||
self._delete_disk(name)
|
||||
self._delete_disk(disk['name'])
|
||||
|
||||
def test_create_disk_from_snapshot(self):
|
||||
data = self._create_disk_and_snapshot()
|
||||
|
@ -30,7 +30,7 @@ class TestFirewallBase(test_networks.TestNetworksBase):
|
||||
|
||||
def _create_firewall(self, options):
|
||||
project_id = self.cfg.project_id
|
||||
self.trace('Crete firewall with options {}'.format(options))
|
||||
self.trace('Create firewall with options {}'.format(options))
|
||||
request = self.firewalls.insert(
|
||||
project=project_id,
|
||||
body=options)
|
||||
|
@ -41,7 +41,7 @@ class TestNetworksBase(test_base.GCETestCase):
|
||||
|
||||
def _create_network(self, options):
|
||||
project_id = self.cfg.project_id
|
||||
self.trace('Crete network with options {}'.format(options))
|
||||
self.trace('Create network with options {}'.format(options))
|
||||
request = self.networks.insert(
|
||||
project=project_id,
|
||||
body=options)
|
||||
|
@ -39,7 +39,7 @@ class TestRouteBase(test_base.GCETestCase):
|
||||
|
||||
def _create_route(self, options):
|
||||
project_id = self.cfg.project_id
|
||||
self.trace('Crete route with options {}'.format(options))
|
||||
self.trace('Create route with options {}'.format(options))
|
||||
request = self.routes.insert(
|
||||
project=project_id,
|
||||
body=options)
|
||||
|
@ -22,10 +22,10 @@ OPTIONS = [
|
||||
# Generic options
|
||||
cfg.IntOpt('build_timeout',
|
||||
default=180,
|
||||
help='Timeout'),
|
||||
help='Timeout for build resources'),
|
||||
cfg.IntOpt('build_interval',
|
||||
default=1,
|
||||
help='Interval'),
|
||||
help='Interval between acquiring resource in wait func'),
|
||||
|
||||
# GCE auth options
|
||||
cfg.StrOpt('cred_type',
|
||||
@ -35,14 +35,14 @@ OPTIONS = [
|
||||
'\n\tgcloud_auth - use app credentials that should be'
|
||||
'obtained before via gcloud auth'),
|
||||
cfg.StrOpt('username',
|
||||
default='demo',
|
||||
help='User name'),
|
||||
default=None,
|
||||
help='User name for OpenStack identity'),
|
||||
cfg.StrOpt('password',
|
||||
default='password',
|
||||
help='User password'),
|
||||
default=None,
|
||||
help='User password for user in OpenStack'),
|
||||
cfg.StrOpt('auth_url',
|
||||
default='http://localhost:5000/v2.0/',
|
||||
help='OAuth API relative URL'),
|
||||
help='Auth API relative URL in case of OpenStack identity'),
|
||||
|
||||
# GCE API schema
|
||||
cfg.StrOpt('schema',
|
||||
@ -71,13 +71,13 @@ OPTIONS = [
|
||||
# Name and ID, where Name is corresponds to Project ID in Google, ID is
|
||||
# Openstack ID's and has no relation to Google's ID and Number.
|
||||
cfg.StrOpt('project_id',
|
||||
default='test',
|
||||
default=None,
|
||||
help='GCE Project ID for testing'),
|
||||
cfg.StrOpt('zone',
|
||||
default='nova',
|
||||
help='GCE Zone for testing'),
|
||||
cfg.StrOpt('region',
|
||||
default='us-central1',
|
||||
default='regionone',
|
||||
help='GCE Region for testing'),
|
||||
cfg.StrOpt('networking',
|
||||
default='neutron',
|
||||
@ -87,6 +87,7 @@ OPTIONS = [
|
||||
default='n1-standard-1',
|
||||
help='Machine type - a type of instance ot be created'),
|
||||
cfg.StrOpt('image',
|
||||
default='debian-cloud/global/images/debian-7-wheezy-v20150929',
|
||||
help='Image to create instances'),
|
||||
default=None,
|
||||
help='Image to create instances. For example:'
|
||||
'debian-cloud/global/images/debian-7-wheezy-v20150929'),
|
||||
]
|
||||
|
@ -44,9 +44,9 @@ def trace(msg):
|
||||
|
||||
|
||||
def safe_call(method):
|
||||
def wrapper(self, *args, **kwargs):
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
return method(self, *args, **kwargs)
|
||||
return method(*args, **kwargs)
|
||||
except Exception as err:
|
||||
trace('Exception {}'.format(err))
|
||||
bt = traceback.format_exc()
|
||||
@ -158,7 +158,7 @@ class GCEApi(object):
|
||||
@property
|
||||
def _host_url(self):
|
||||
cfg = CONF.gce
|
||||
if self._is_standard_port(cfg.protocol, cfg.port):
|
||||
if not cfg.port or self._is_standard_port(cfg.protocol, cfg.port):
|
||||
return '{}://{}'.format(cfg.protocol, cfg.host)
|
||||
return '{}://{}:{}'.format(cfg.protocol, cfg.host, cfg.port)
|
||||
|
||||
@ -356,7 +356,8 @@ class GCETestCase(base.BaseTestCase):
|
||||
@safe_call
|
||||
def _remove_cleanup(self, method, *args, **kwargs):
|
||||
v = (method, args, kwargs)
|
||||
self._cleanups.remove(v)
|
||||
if v in self._cleanups:
|
||||
self._cleanups.remove(v)
|
||||
|
||||
def _execute_async_request(self, request, project, zone=None, region=None):
|
||||
self.trace_request(request)
|
||||
|
Loading…
Reference in New Issue
Block a user