Merge "Add SSL parameters to negative tests"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 02609ae..3ade411 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -467,6 +467,16 @@
#endpoint_type = publicURL
+[data_processing-feature-enabled]
+
+#
+# From tempest.config
+#
+
+# List of enabled data processing plugins (list value)
+#plugins = vanilla,hdp
+
+
[database]
#
diff --git a/requirements.txt b/requirements.txt
index 2af8586..1ce2fc5 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,7 +11,7 @@
netaddr>=0.7.12
python-ceilometerclient>=1.0.6
python-glanceclient>=0.15.0
-python-keystoneclient>=0.11.1
+python-keystoneclient>=1.0.0
python-novaclient>=2.18.0
python-neutronclient>=2.3.6,<3
python-cinderclient>=1.1.0
@@ -25,4 +25,4 @@
iso8601>=0.1.9
fixtures>=0.3.14
testscenarios>=0.4
-tempest-lib
+tempest-lib>=0.1.0
diff --git a/tempest/api/baremetal/admin/test_ports.py b/tempest/api/baremetal/admin/test_ports.py
index 3392ab9..4aedaa4 100644
--- a/tempest/api/baremetal/admin/test_ports.py
+++ b/tempest/api/baremetal/admin/test_ports.py
@@ -87,6 +87,11 @@
self._assertExpected(self.port, port)
@test.attr(type='smoke')
+ def test_show_port_by_address(self):
+ _, port = self.client.show_port_by_address(self.port['address'])
+ self._assertExpected(self.port, port['ports'][0])
+
+ @test.attr(type='smoke')
def test_show_port_with_links(self):
_, port = self.client.show_port(self.port['uuid'])
self.assertIn('links', port.keys())
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 6b6c8e7..c245eb4 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -174,7 +174,7 @@
LOG.debug('Clearing server groups: %s', ','.join(cls.server_groups))
for server_group_id in cls.server_groups:
try:
- cls.client.delete_server_group(server_group_id)
+ cls.servers_client.delete_server_group(server_group_id)
except exceptions.NotFound:
# The server-group may have already been deleted which is OK.
pass
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
index 2b0f268..b08df97 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
@@ -89,7 +89,7 @@
@test.services('network')
def test_associate_ip_to_server_without_passing_floating_ip(self):
# Negative test:Association of empty floating IP to specific server
- # should raise NotFound exception
- self.assertRaises(exceptions.NotFound,
+ # should raise NotFound or BadRequest(In case of Nova V2.1) exception.
+ self.assertRaises((exceptions.NotFound, exceptions.BadRequest),
self.client.associate_floating_ip_to_server,
'', self.server_id)
diff --git a/tempest/api/data_processing/test_plugins.py b/tempest/api/data_processing/test_plugins.py
index 9fd7a17..4b4ec48 100644
--- a/tempest/api/data_processing/test_plugins.py
+++ b/tempest/api/data_processing/test_plugins.py
@@ -13,8 +13,11 @@
# under the License.
from tempest.api.data_processing import base as dp_base
+from tempest import config
from tempest import test
+CONF = config.CONF
+
class PluginsTest(dp_base.BaseDataProcessingTest):
def _list_all_plugin_names(self):
@@ -24,8 +27,8 @@
"""
_, plugins = self.client.list_plugins()
plugins_names = [plugin['name'] for plugin in plugins]
- self.assertIn('vanilla', plugins_names)
- self.assertIn('hdp', plugins_names)
+ for enabled_plugin in CONF.data_processing_feature_enabled.plugins:
+ self.assertIn(enabled_plugin, plugins_names)
return plugins_names
diff --git a/tempest/cli/simple_read_only/compute/test_nova_manage.py b/tempest/cli/simple_read_only/compute/test_nova_manage.py
deleted file mode 100644
index 34ec671..0000000
--- a/tempest/cli/simple_read_only/compute/test_nova_manage.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright 2013 OpenStack Foundation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest_lib import exceptions
-
-from tempest import cli
-from tempest import config
-from tempest.openstack.common import log as logging
-
-
-CONF = config.CONF
-LOG = logging.getLogger(__name__)
-
-
-class SimpleReadOnlyNovaManageTest(cli.ClientTestBase):
-
- """
- This is a first pass at a simple read only nova-manage test. This
- only exercises client commands that are read only.
-
- This should test commands:
- * with and without optional parameters
- * initially just check return codes, and later test command outputs
-
- """
-
- @classmethod
- def resource_setup(cls):
- if not CONF.service_available.nova:
- msg = ("%s skipped as Nova is not available" % cls.__name__)
- raise cls.skipException(msg)
- if not CONF.cli.has_manage:
- msg = ("%s skipped as *-manage commands not available"
- % cls.__name__)
- raise cls.skipException(msg)
- super(SimpleReadOnlyNovaManageTest, cls).resource_setup()
-
- def nova_manage(self, *args, **kwargs):
- return self.clients.nova_manage(*args, **kwargs)
-
- def test_admin_fake_action(self):
- self.assertRaises(exceptions.CommandFailed,
- self.nova_manage,
- 'this-does-nova-exist')
-
- # NOTE(jogo): Commands in order listed in 'nova-manage -h'
-
- # test flags
- def test_help_flag(self):
- self.nova_manage('', '-h')
-
- def test_version_flag(self):
- # Bug 1159957: nova-manage --version writes to stderr
- self.assertNotEqual("", self.nova_manage('', '--version',
- merge_stderr=True))
- self.assertEqual(self.nova_manage('version'),
- self.nova_manage('', '--version', merge_stderr=True))
-
- def test_debug_flag(self):
- self.assertNotEqual("", self.nova_manage('service list',
- '--debug'))
-
- def test_verbose_flag(self):
- self.assertNotEqual("", self.nova_manage('service list',
- '--verbose'))
-
- # test actions
- def test_version(self):
- self.assertNotEqual("", self.nova_manage('version'))
-
- def test_db_sync(self):
- # make sure command doesn't error out
- self.nova_manage('db sync')
-
- def test_db_version(self):
- self.assertNotEqual("", self.nova_manage('db version'))
-
- def test_cell_list(self):
- # make sure command doesn't error out
- self.nova_manage('cell list')
-
- def test_host_list(self):
- # make sure command doesn't error out
- self.nova_manage('host list')
diff --git a/tempest/cli/simple_read_only/data_processing/test_sahara.py b/tempest/cli/simple_read_only/data_processing/test_sahara.py
index 1f2403c..c06c2c9 100644
--- a/tempest/cli/simple_read_only/data_processing/test_sahara.py
+++ b/tempest/cli/simple_read_only/data_processing/test_sahara.py
@@ -16,6 +16,7 @@
import re
from tempest_lib import exceptions
+import testtools
from tempest import cli
from tempest import config
@@ -59,8 +60,12 @@
'title'
])
+ @testtools.skipUnless(CONF.data_processing_feature_enabled.plugins,
+ 'No plugins defined')
def test_sahara_plugins_show(self):
- result = self.sahara('plugin-show', params='--name vanilla')
+ name_param = '--name %s' % \
+ (CONF.data_processing_feature_enabled.plugins[0])
+ result = self.sahara('plugin-show', params=name_param)
plugin = self.parser.listing(result)
self.assertTableStruct(plugin, [
'Property',
diff --git a/tempest/clients.py b/tempest/clients.py
index 7679b4b..f484d70 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -142,6 +142,14 @@
'trace_requests': CONF.debug.trace_requests
}
+ # NOTE: Tempest uses timeout values of compute API if project specific
+ # timeout values don't exist.
+ default_params_with_timeout_values = {
+ 'build_interval': CONF.compute.build_interval,
+ 'build_timeout': CONF.compute.build_timeout
+ }
+ default_params_with_timeout_values.update(default_params)
+
def __init__(self, credentials=None, interface='json', service=None):
# Set interface and client type first
self.interface = interface
@@ -151,6 +159,7 @@
self._set_compute_clients()
self._set_identity_clients()
self._set_volume_clients()
+ self._set_object_storage_clients()
self.baremetal_client = BaremetalClientJSON(self.auth_provider)
self.network_client = NetworkClientJSON(
@@ -162,10 +171,20 @@
build_timeout=CONF.network.build_timeout,
**self.default_params)
self.database_flavors_client = DatabaseFlavorsClientJSON(
- self.auth_provider)
+ self.auth_provider,
+ CONF.database.catalog_type,
+ CONF.identity.region,
+ **self.default_params_with_timeout_values)
self.database_versions_client = DatabaseVersionsClientJSON(
- self.auth_provider)
- self.messaging_client = MessagingClientJSON(self.auth_provider)
+ self.auth_provider,
+ CONF.database.catalog_type,
+ CONF.identity.region,
+ **self.default_params_with_timeout_values)
+ self.messaging_client = MessagingClientJSON(
+ self.auth_provider,
+ CONF.messaging.catalog_type,
+ CONF.identity.region,
+ **self.default_params_with_timeout_values)
if CONF.service_available.ceilometer:
self.telemetry_client = TelemetryClientJSON(
self.auth_provider)
@@ -179,12 +198,9 @@
self.credentials.tenant_name)
# common clients
- self.account_client = AccountClient(self.auth_provider)
if CONF.service_available.glance:
self.image_client = ImageClientJSON(self.auth_provider)
self.image_client_v2 = ImageClientV2JSON(self.auth_provider)
- self.container_client = ContainerClient(self.auth_provider)
- self.object_client = ObjectClient(self.auth_provider)
self.orchestration_client = OrchestrationClient(
self.auth_provider,
CONF.orchestration.catalog_type,
@@ -301,6 +317,18 @@
self.volume_types_v2_client = VolumeTypesV2ClientJSON(
self.auth_provider)
+ def _set_object_storage_clients(self):
+ params = {
+ 'service': CONF.object_storage.catalog_type,
+ 'region': CONF.object_storage.region or CONF.identity.region,
+ 'endpoint_type': CONF.object_storage.endpoint_type
+ }
+ params.update(self.default_params_with_timeout_values)
+
+ self.account_client = AccountClient(self.auth_provider, **params)
+ self.container_client = ContainerClient(self.auth_provider, **params)
+ self.object_client = ObjectClient(self.auth_provider, **params)
+
class AdminManager(Manager):
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index e5ffb1b..6c72ca9 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -159,6 +159,13 @@
}
compute_params.update(default_params)
+ object_storage_params = {
+ 'service': CONF.object_storage.catalog_type,
+ 'region': CONF.object_storage.region or CONF.identity.region,
+ 'endpoint_type': CONF.object_storage.endpoint_type
+ }
+ object_storage_params.update(default_params)
+
_creds = tempest.auth.KeystoneV2Credentials(
username=user,
password=pw,
@@ -171,8 +178,10 @@
**compute_params)
self.secgroups = security_groups_client.SecurityGroupsClientJSON(
_auth, **compute_params)
- self.objects = object_client.ObjectClient(_auth)
- self.containers = container_client.ContainerClient(_auth)
+ self.objects = object_client.ObjectClient(_auth,
+ **object_storage_params)
+ self.containers = container_client.ContainerClient(
+ _auth, **object_storage_params)
self.images = image_client.ImageClientV2JSON(_auth)
self.telemetry = telemetry_client.TelemetryClientJSON(_auth)
self.volumes = volumes_client.VolumesClientJSON(_auth)
@@ -187,7 +196,7 @@
def load_resources(fname):
- """Load the expected resources from a yaml flie."""
+ """Load the expected resources from a yaml file."""
return yaml.load(open(fname, 'r'))
@@ -423,7 +432,7 @@
self._ping_ip(addr, 60)
def check_secgroups(self):
- """Check that the security groups are still existing."""
+ """Check that the security groups still exist."""
LOG.info("Checking security groups")
for secgroup in self.res['secgroups']:
client = client_for_user(secgroup['owner'])
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index a7e0ee3..65a3a95 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -335,7 +335,7 @@
continue
results = verify_extensions(os, service, results)
- # Verify API verisons of all services in the keystone catalog and keystone
+ # Verify API versions of all services in the keystone catalog and keystone
# itself.
services.append('keystone')
for service in services:
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
index 45a07f1..d2f67e3 100644
--- a/tempest/common/service_client.py
+++ b/tempest/common/service_client.py
@@ -83,6 +83,12 @@
raise exceptions.ServerFault(ex)
except lib_exceptions.UnexpectedResponseCode as ex:
raise exceptions.UnexpectedResponseCode(ex)
+ # TODO(oomichi): This is just a workaround for failing gate tests
+ # when separating Forbidden from Unauthorized in tempest-lib.
+ # We will need to remove this translation and replace negative tests
+ # with lib_exceptions.Forbidden in the future.
+ except lib_exceptions.Forbidden as ex:
+ raise exceptions.Unauthorized(ex)
class ResponseBody(dict):
diff --git a/tempest/config.py b/tempest/config.py
index dd693e5..1b6ec62 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -743,6 +743,17 @@
]
+data_processing_feature_group = cfg.OptGroup(
+ name="data_processing-feature-enabled",
+ title="Enabled Data Processing features")
+
+DataProcessingFeaturesGroup = [
+ cfg.ListOpt('plugins',
+ default=["vanilla", "hdp"],
+ help="List of enabled data processing plugins")
+]
+
+
boto_group = cfg.OptGroup(name='boto',
title='EC2/S3 options')
BotoGroup = [
@@ -1050,6 +1061,7 @@
(telemetry_group, TelemetryGroup),
(dashboard_group, DashboardGroup),
(data_processing_group, DataProcessingGroup),
+ (data_processing_feature_group, DataProcessingFeaturesGroup),
(boto_group, BotoGroup),
(stress_group, StressGroup),
(scenario_group, ScenarioGroup),
@@ -1120,6 +1132,8 @@
self.telemetry = cfg.CONF.telemetry
self.dashboard = cfg.CONF.dashboard
self.data_processing = cfg.CONF.data_processing
+ self.data_processing_feature_enabled = cfg.CONF[
+ 'data_processing-feature-enabled']
self.boto = cfg.CONF.boto
self.stress = cfg.CONF.stress
self.scenario = cfg.CONF.scenario
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 1c53f45..5b092c3 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -789,7 +789,8 @@
tenant_id=tenant_id)
# Add rules to the security group
- rules = self._create_loginable_secgroup_rule(secgroup=secgroup)
+ rules = self._create_loginable_secgroup_rule(client=client,
+ secgroup=secgroup)
for rule in rules:
self.assertEqual(tenant_id, rule.tenant_id)
self.assertEqual(secgroup.id, rule.security_group_id)
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index 1a82e78..dc82217 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -60,7 +60,7 @@
self.sec_grp = self._create_security_group(tenant_id=self.tenant_id)
self.srv_kwargs = {
'key_name': self.keypair['name'],
- 'security_groups': [self.sec_grp]}
+ 'security_groups': [{'name': self.sec_grp['name']}]}
def prepare_network(self, address6_mode):
"""Creates network with
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index de6b0f9..83739fd 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -70,7 +70,7 @@
* test that cross-tenant traffic is enabled once an appropriate
rule has been created on destination tenant.
* test that reverse traffic is still blocked
- * test than revesre traffic is enabled once an appropriate rule has
+ * test than reverse traffic is enabled once an appropriate rule has
been created on source tenant
7._test_port_update_new_security_group:
* test that traffic is blocked with default security group
@@ -85,7 +85,7 @@
to it, and cross tenant check will be done on the private IP of the
destination tenant
or
- * not defined (empty string), in which case each tanant will have
+ * not defined (empty string), in which case each tenant will have
its own router connected to the public network
"""
@@ -466,7 +466,7 @@
def test_port_update_new_security_group(self):
"""
This test verifies the traffic after updating the vm port with new
- security group having appropiate rule.
+ security group having appropriate rule.
"""
new_tenant = self.primary_tenant
diff --git a/tempest/services/baremetal/v1/base_v1.py b/tempest/services/baremetal/v1/base_v1.py
index 9359808..9435dbf 100644
--- a/tempest/services/baremetal/v1/base_v1.py
+++ b/tempest/services/baremetal/v1/base_v1.py
@@ -114,6 +114,19 @@
"""
return self._show_request('ports', uuid)
+ @base.handle_errors
+ def show_port_by_address(self, address):
+ """
+ Gets a specific port by address.
+
+ :param address: MAC address of the port.
+ :return: Serialized port as a dictionary.
+
+ """
+ uri = '/ports/detail?address=%s' % address
+
+ return self._show_request('ports', uuid=None, uri=uri)
+
def show_driver(self, driver_name):
"""
Gets a specific driver.
diff --git a/tempest/services/database/json/flavors_client.py b/tempest/services/database/json/flavors_client.py
index 9a27443..dfb2eb3 100644
--- a/tempest/services/database/json/flavors_client.py
+++ b/tempest/services/database/json/flavors_client.py
@@ -16,19 +16,10 @@
import urllib
from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
class DatabaseFlavorsClientJSON(service_client.ServiceClient):
- def __init__(self, auth_provider):
- super(DatabaseFlavorsClientJSON, self).__init__(
- auth_provider,
- CONF.database.catalog_type,
- CONF.identity.region)
-
def list_db_flavors(self, params=None):
url = 'flavors'
if params:
diff --git a/tempest/services/database/json/versions_client.py b/tempest/services/database/json/versions_client.py
index f5c5217..c3388bb 100644
--- a/tempest/services/database/json/versions_client.py
+++ b/tempest/services/database/json/versions_client.py
@@ -16,18 +16,23 @@
import urllib
from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
class DatabaseVersionsClientJSON(service_client.ServiceClient):
- def __init__(self, auth_provider):
+ def __init__(self, auth_provider, service, region,
+ endpoint_type=None, build_interval=None, build_timeout=None,
+ disable_ssl_certificate_validation=None, ca_certs=None,
+ trace_requests=None):
+ dscv = disable_ssl_certificate_validation
super(DatabaseVersionsClientJSON, self).__init__(
- auth_provider,
- CONF.database.catalog_type,
- CONF.identity.region)
+ auth_provider, service, region,
+ endpoint_type=endpoint_type,
+ build_interval=build_interval,
+ build_timeout=build_timeout,
+ disable_ssl_certificate_validation=dscv,
+ ca_certs=ca_certs,
+ trace_requests=trace_requests)
self.skip_path()
def list_db_versions(self, params=None):
diff --git a/tempest/services/messaging/json/messaging_client.py b/tempest/services/messaging/json/messaging_client.py
index c4c9f09..36444a9 100644
--- a/tempest/services/messaging/json/messaging_client.py
+++ b/tempest/services/messaging/json/messaging_client.py
@@ -15,27 +15,32 @@
import json
import urllib
+import uuid
from tempest.api_schema.response.messaging.v1 import queues as queues_schema
from tempest.common import service_client
-from tempest.common.utils import data_utils
-from tempest import config
-
-
-CONF = config.CONF
class MessagingClientJSON(service_client.ServiceClient):
- def __init__(self, auth_provider):
+ def __init__(self, auth_provider, service, region,
+ endpoint_type=None, build_interval=None, build_timeout=None,
+ disable_ssl_certificate_validation=None, ca_certs=None,
+ trace_requests=None):
+ dscv = disable_ssl_certificate_validation
super(MessagingClientJSON, self).__init__(
- auth_provider,
- CONF.messaging.catalog_type,
- CONF.identity.region)
+ auth_provider, service, region,
+ endpoint_type=endpoint_type,
+ build_interval=build_interval,
+ build_timeout=build_timeout,
+ disable_ssl_certificate_validation=dscv,
+ ca_certs=ca_certs,
+ trace_requests=trace_requests)
+
self.version = '1'
self.uri_prefix = 'v{0}'.format(self.version)
- client_id = data_utils.rand_uuid_hex()
+ client_id = uuid.uuid4().hex
self.headers = {'Client-ID': client_id}
def list_queues(self):
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index c7ee5f7..e92708c 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -57,7 +57,7 @@
'ipsecpolicies': 'vpn',
'vpnservices': 'vpn',
'ikepolicies': 'vpn',
- 'ipsecpolicies': 'vpn',
+ 'ipsec-site-connections': 'vpn',
'metering_labels': 'metering',
'metering_label_rules': 'metering',
'firewall_rules': 'fw',
@@ -85,7 +85,7 @@
'security_group_rules': 'security_group_rules',
'ipsecpolicy': 'ipsecpolicies',
'ikepolicy': 'ikepolicies',
- 'ipsecpolicy': 'ipsecpolicies',
+ 'ipsec_site_connection': 'ipsec-site-connections',
'quotas': 'quotas',
'firewall_policy': 'firewall_policies'
}
diff --git a/tempest/services/object_storage/account_client.py b/tempest/services/object_storage/account_client.py
index c24bbba..af00eff 100644
--- a/tempest/services/object_storage/account_client.py
+++ b/tempest/services/object_storage/account_client.py
@@ -17,13 +17,10 @@
import urllib
from xml.etree import ElementTree as etree
-from tempest import config
-from tempest.services.object_storage import base
-
-CONF = config.CONF
+from tempest.common import service_client
-class AccountClient(base.ObjectStorageClient):
+class AccountClient(service_client.ServiceClient):
def create_account(self, data=None,
params=None,
diff --git a/tempest/services/object_storage/base.py b/tempest/services/object_storage/base.py
deleted file mode 100644
index 1e7355e..0000000
--- a/tempest/services/object_storage/base.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class ObjectStorageClient(service_client.ServiceClient):
- """
- Base object storage client class
- """
-
- def __init__(self, auth_provider):
- super(ObjectStorageClient, self).__init__(
- auth_provider,
- CONF.object_storage.catalog_type,
- CONF.object_storage.region or CONF.identity.region,
- endpoint_type=CONF.object_storage.endpoint_type)
- self.format = 'json'
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index c55826b..ed74de4 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -17,10 +17,10 @@
import urllib
from xml.etree import ElementTree as etree
-from tempest.services.object_storage import base
+from tempest.common import service_client
-class ContainerClient(base.ObjectStorageClient):
+class ContainerClient(service_client.ServiceClient):
def create_container(
self, container_name,
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index bb74fd7..eaa894d 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -17,13 +17,10 @@
import urllib
import urlparse
-from tempest import config
-from tempest.services.object_storage import base
-
-CONF = config.CONF
+from tempest.common import service_client
-class ObjectClient(base.ObjectStorageClient):
+class ObjectClient(service_client.ServiceClient):
def create_object(self, container, object_name, data,
params=None, metadata=None, headers=None):
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
new file mode 100644
index 0000000..d8a5ec5
--- /dev/null
+++ b/tempest/tests/common/test_service_clients.py
@@ -0,0 +1,110 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import mock
+import random
+import six
+
+from tempest.services.compute.json import agents_client
+from tempest.services.compute.json import aggregates_client
+from tempest.services.compute.json import availability_zone_client
+from tempest.services.compute.json import certificates_client
+from tempest.services.compute.json import extensions_client
+from tempest.services.compute.json import fixed_ips_client
+from tempest.services.compute.json import flavors_client
+from tempest.services.compute.json import floating_ips_client
+from tempest.services.compute.json import hosts_client
+from tempest.services.compute.json import hypervisor_client
+from tempest.services.compute.json import images_client
+from tempest.services.compute.json import instance_usage_audit_log_client
+from tempest.services.compute.json import interfaces_client
+from tempest.services.compute.json import keypairs_client
+from tempest.services.compute.json import limits_client
+from tempest.services.compute.json import migrations_client
+from tempest.services.compute.json import networks_client as nova_net_client
+from tempest.services.compute.json import quotas_client
+from tempest.services.compute.json import security_group_default_rules_client \
+ as nova_secgrop_default_client
+from tempest.services.compute.json import security_groups_client
+from tempest.services.compute.json import servers_client
+from tempest.services.compute.json import services_client
+from tempest.services.compute.json import tenant_usages_client
+from tempest.services.compute.json import volumes_extensions_client
+from tempest.services.database.json import flavors_client as db_flavor_client
+from tempest.services.database.json import versions_client as db_version_client
+from tempest.services.messaging.json import messaging_client
+from tempest.services.network.json import network_client
+from tempest.services.object_storage import account_client
+from tempest.services.object_storage import container_client
+from tempest.services.object_storage import object_client
+from tempest.services.orchestration.json import orchestration_client
+from tempest.tests import base
+
+
+class TestServiceClient(base.TestCase):
+
+ @mock.patch('tempest_lib.common.rest_client.RestClient.__init__')
+ def test_service_client_creations_with_specified_args(self, mock_init):
+ test_clients = [
+ agents_client.AgentsClientJSON,
+ aggregates_client.AggregatesClientJSON,
+ availability_zone_client.AvailabilityZoneClientJSON,
+ certificates_client.CertificatesClientJSON,
+ extensions_client.ExtensionsClientJSON,
+ fixed_ips_client.FixedIPsClientJSON,
+ flavors_client.FlavorsClientJSON,
+ floating_ips_client.FloatingIPsClientJSON,
+ hosts_client.HostsClientJSON,
+ hypervisor_client.HypervisorClientJSON,
+ images_client.ImagesClientJSON,
+ instance_usage_audit_log_client.InstanceUsagesAuditLogClientJSON,
+ interfaces_client.InterfacesClientJSON,
+ keypairs_client.KeyPairsClientJSON,
+ limits_client.LimitsClientJSON,
+ migrations_client.MigrationsClientJSON,
+ nova_net_client.NetworksClientJSON,
+ quotas_client.QuotasClientJSON,
+ quotas_client.QuotaClassesClientJSON,
+ nova_secgrop_default_client.SecurityGroupDefaultRulesClientJSON,
+ security_groups_client.SecurityGroupsClientJSON,
+ servers_client.ServersClientJSON,
+ services_client.ServicesClientJSON,
+ tenant_usages_client.TenantUsagesClientJSON,
+ volumes_extensions_client.VolumesExtensionsClientJSON,
+ db_flavor_client.DatabaseFlavorsClientJSON,
+ db_version_client.DatabaseVersionsClientJSON,
+ messaging_client.MessagingClientJSON,
+ network_client.NetworkClientJSON,
+ account_client.AccountClient,
+ container_client.ContainerClient,
+ object_client.ObjectClient,
+ orchestration_client.OrchestrationClient]
+
+ for client in test_clients:
+ fake_string = six.text_type(random.randint(1, 0x7fffffff))
+ auth = 'auth' + fake_string
+ service = 'service' + fake_string
+ region = 'region' + fake_string
+ params = {
+ 'endpoint_type': 'URL' + fake_string,
+ 'build_interval': random.randint(1, 100),
+ 'build_timeout': random.randint(1, 100),
+ 'disable_ssl_certificate_validation':
+ True if random.randint(0, 1) else False,
+ 'ca_certs': None,
+ 'trace_requests': 'foo' + fake_string
+ }
+ client(auth, service, region, **params)
+ mock_init.assert_called_once_with(auth, service, region, **params)
+ mock_init.reset_mock()
diff --git a/tempest/thirdparty/boto/test_ec2_keys.py b/tempest/thirdparty/boto/test_ec2_keys.py
index c3e1e2a..be5db55 100644
--- a/tempest/thirdparty/boto/test_ec2_keys.py
+++ b/tempest/thirdparty/boto/test_ec2_keys.py
@@ -14,7 +14,6 @@
# under the License.
from tempest.common.utils import data_utils
-from tempest import test
from tempest.thirdparty.boto import test as boto_test
@@ -40,7 +39,6 @@
self.assertTrue(compare_key_pairs(keypair,
self.client.get_key_pair(key_name)))
- @test.skip_because(bug="1072318")
def test_delete_ec2_keypair(self):
# EC2 delete KeyPair
key_name = data_utils.rand_name("keypair-")
diff --git a/tox.ini b/tox.ini
index fe2f79e..2e8b509 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
skipsdist = True
[tempestenv]
-sitepackages = True
+sitepackages = False
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=./tempest/test_discover
deps = setuptools