Merge "Add random name in base._create_keypair"
diff --git a/releasenotes/notes/deprecate-allow_port_security_disabled-option-2d3d87f6bd11d03a.yaml b/releasenotes/notes/deprecate-allow_port_security_disabled-option-2d3d87f6bd11d03a.yaml
new file mode 100644
index 0000000..4acdc6d
--- /dev/null
+++ b/releasenotes/notes/deprecate-allow_port_security_disabled-option-2d3d87f6bd11d03a.yaml
@@ -0,0 +1,8 @@
+---
+upgrade:
+ - The default value for the ``allow_port_security_disabled`` option in the
+ ``compute-feature-enabled`` section has been changed from ``False``
+ to ``True``.
+deprecations:
+ - The ``allow_port_security_disabled`` option in the
+ ``compute-feature-enabled`` section is now deprecated.
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index 3923068..6c97072 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -62,7 +62,7 @@
# Create a new image with invalid server id
meta = {'image_type': 'test'}
self.assertRaises(lib_exc.NotFound, self.create_image_from_server,
- '!@$^&*()', meta=meta)
+ data_utils.rand_name('invalid'), meta=meta)
@test.attr(type=['negative'])
@test.idempotent_id('ec176029-73dc-4037-8d72-2e4ff60cf538')
@@ -87,7 +87,7 @@
def test_delete_image_with_invalid_image_id(self):
# An image should not be deleted with invalid image id
self.assertRaises(lib_exc.NotFound, self.client.delete_image,
- '!@$^&*()')
+ data_utils.rand_name('invalid'))
@test.attr(type=['negative'])
@test.idempotent_id('137aef61-39f7-44a1-8ddf-0adf82511701')
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 30549ec..fa465af 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import logging
+from oslo_log import log as logging
import testtools
from tempest.api.compute import base
diff --git a/tempest/api/compute/volumes/test_volumes_negative.py b/tempest/api/compute/volumes/test_volumes_negative.py
index c4041cb..0e1fef2 100644
--- a/tempest/api/compute/volumes/test_volumes_negative.py
+++ b/tempest/api/compute/volumes/test_volumes_negative.py
@@ -95,7 +95,8 @@
# Negative: Should not be able to delete volume when invalid ID is
# passed
self.assertRaises(lib_exc.NotFound,
- self.client.delete_volume, '!@#$%^&*()')
+ self.client.delete_volume,
+ data_utils.rand_name('invalid'))
@test.attr(type=['negative'])
@test.idempotent_id('0d1417c5-4ae8-4c2c-adc5-5f0b864253e5')
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 14bf4f8..9515788 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -105,6 +105,15 @@
credentials = ['primary', 'admin']
+ # NOTE(andreaf) Identity tests work with credentials, so it is safer
+ # for them to always use disposable credentials. Forcing dynamic creds
+ # on regular identity tests would be however to restrictive, since it
+ # would prevent any identity test from being executed against clouds where
+ # admin credentials are not available.
+ # Since All admin tests require admin credentials to be
+ # executed, so this will not impact the ability to execute tests.
+ force_tenant_isolation = True
+
@classmethod
def setup_clients(cls):
super(BaseIdentityV2AdminTest, cls).setup_clients()
@@ -165,6 +174,15 @@
credentials = ['primary', 'admin']
+ # NOTE(andreaf) Identity tests work with credentials, so it is safer
+ # for them to always use disposable credentials. Forcing dynamic creds
+ # on regular identity tests would be however to restrictive, since it
+ # would prevent any identity test from being executed against clouds where
+ # admin credentials are not available.
+ # Since All admin tests require admin credentials to be
+ # executed, so this will not impact the ability to execute tests.
+ force_tenant_isolation = True
+
@classmethod
def setup_clients(cls):
super(BaseIdentityV3AdminTest, cls).setup_clients()
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index c45ace6..bcdbd22 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -133,7 +133,8 @@
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
metadata = {'Type': 'work'}
self.assertRaises(lib_exc.NotFound, self.volumes_client.update_volume,
- volume_id='#$%%&^&^', display_name=v_name,
+ volume_id=data_utils.rand_name('invalid'),
+ display_name=v_name,
metadata=metadata)
@test.attr(type=['negative'])
@@ -150,7 +151,7 @@
def test_get_invalid_volume_id(self):
# Should not be able to get volume with invalid id
self.assertRaises(lib_exc.NotFound, self.volumes_client.show_volume,
- '#$%%&^&^')
+ data_utils.rand_name('invalid'))
@test.attr(type=['negative'])
@test.idempotent_id('c6c3db06-29ad-4e91-beb0-2ab195fe49e3')
@@ -164,7 +165,7 @@
def test_delete_invalid_volume_id(self):
# Should not be able to delete volume when invalid ID is passed
self.assertRaises(lib_exc.NotFound, self.volumes_client.delete_volume,
- '!@#$%^&*()')
+ data_utils.rand_name('invalid'))
@test.attr(type=['negative'])
@test.idempotent_id('441a1550-5d44-4b30-af0f-a6d402f52026')
diff --git a/tempest/clients.py b/tempest/clients.py
index 8093a72..8d30aaa 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -19,7 +19,6 @@
from tempest.lib import auth
from tempest.lib import exceptions as lib_exc
from tempest.lib.services import clients
-from tempest.lib.services import identity
from tempest.services import object_storage
from tempest.services import orchestration
@@ -237,15 +236,15 @@
# API version is marked as enabled
if CONF.identity_feature_enabled.api_v2:
if CONF.identity.uri:
- self.token_client = identity.v2.TokenClient(
- CONF.identity.uri, **self.default_params)
+ self.token_client = self.identity_v2.TokenClient(
+ auth_url=CONF.identity.uri)
else:
msg = 'Identity v2 API enabled, but no identity.uri set'
raise lib_exc.InvalidConfiguration(msg)
if CONF.identity_feature_enabled.api_v3:
if CONF.identity.uri_v3:
- self.token_v3_client = identity.v3.V3TokenClient(
- CONF.identity.uri_v3, **self.default_params)
+ self.token_v3_client = self.identity_v3.V3TokenClient(
+ auth_url=CONF.identity.uri_v3)
else:
msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
raise lib_exc.InvalidConfiguration(msg)
diff --git a/tempest/config.py b/tempest/config.py
index 4162718..fe8c175 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -16,7 +16,6 @@
from __future__ import print_function
import functools
-import logging as std_logging
import os
import tempfile
@@ -332,9 +331,12 @@
# NOTE(mriedem): This is a feature toggle for bug 1175464 which is fixed in
# mitaka and newton. This option can be removed after liberty-eol.
cfg.BoolOpt('allow_port_security_disabled',
- default=False,
+ default=True,
help='Does the test environment support creating ports in a '
- 'network where port security is disabled?'),
+ 'network where port security is disabled?',
+ deprecated_for_removal=True,
+ deprecated_reason='This config switch was added for Liberty '
+ 'which is not supported anymore.'),
cfg.BoolOpt('disk_config',
default=True,
help="If false, skip disk config tests"),
@@ -1196,7 +1198,7 @@
register_opts()
self._set_attrs()
if parse_conf:
- _CONF.log_opt_values(LOG, std_logging.DEBUG)
+ _CONF.log_opt_values(LOG, logging.DEBUG)
class TempestConfigProxy(object):
@@ -1204,14 +1206,14 @@
_path = None
_extra_log_defaults = [
- ('paramiko.transport', std_logging.INFO),
- ('requests.packages.urllib3.connectionpool', std_logging.WARN),
+ ('paramiko.transport', logging.INFO),
+ ('requests.packages.urllib3.connectionpool', logging.WARN),
]
def _fix_log_levels(self):
"""Tweak the oslo log defaults."""
for name, level in self._extra_log_defaults:
- std_logging.getLogger(name).setLevel(level)
+ logging.getLogger(name).logger.setLevel(level)
def __getattr__(self, attr):
if not self._config:
diff --git a/tempest/lib/cli/base.py b/tempest/lib/cli/base.py
index 5d7fbe3..5468a7b 100644
--- a/tempest/lib/cli/base.py
+++ b/tempest/lib/cli/base.py
@@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-import logging
import os
import shlex
import subprocess
+from oslo_log import log as logging
import six
from tempest.lib import base
diff --git a/tempest/lib/cli/output_parser.py b/tempest/lib/cli/output_parser.py
index c71c7a7..716f374 100644
--- a/tempest/lib/cli/output_parser.py
+++ b/tempest/lib/cli/output_parser.py
@@ -15,9 +15,10 @@
"""Collection of utilities for parsing CLI clients output."""
-import logging
import re
+from oslo_log import log as logging
+
from tempest.lib import exceptions
diff --git a/tempest/lib/common/rest_client.py b/tempest/lib/common/rest_client.py
index 31d2ba5..b49f331 100644
--- a/tempest/lib/common/rest_client.py
+++ b/tempest/lib/common/rest_client.py
@@ -16,7 +16,6 @@
import collections
import email.utils
-import logging as real_logging
import re
import time
@@ -455,7 +454,7 @@
# Also look everything at DEBUG if you want to filter this
# out, don't run at debug.
- if self.LOG.isEnabledFor(real_logging.DEBUG):
+ if self.LOG.isEnabledFor(logging.DEBUG):
self._log_request_full(resp, req_headers, req_body,
resp_body, extra)
diff --git a/tempest/lib/services/clients.py b/tempest/lib/services/clients.py
index 262a894..445e8bd 100644
--- a/tempest/lib/services/clients.py
+++ b/tempest/lib/services/clients.py
@@ -17,7 +17,8 @@
import copy
import importlib
import inspect
-import logging
+
+from oslo_log import log as logging
from tempest.lib import auth
from tempest.lib.common.utils import misc
@@ -279,7 +280,7 @@
a dictionary ready to be injected in kwargs.
Exceptions are:
- - Token clients for 'identity' have a very different interface
+ - Token clients for 'identity' must be given an 'auth_url' parameter
- Volume client for 'volume' accepts 'default_volume_size'
- Servers client from 'compute' accepts 'enable_instance_password'
diff --git a/tempest/lib/services/identity/v2/token_client.py b/tempest/lib/services/identity/v2/token_client.py
index c4fd483..458c862 100644
--- a/tempest/lib/services/identity/v2/token_client.py
+++ b/tempest/lib/services/identity/v2/token_client.py
@@ -23,7 +23,22 @@
def __init__(self, auth_url, disable_ssl_certificate_validation=None,
ca_certs=None, trace_requests=None, **kwargs):
+ """Initialises the Token client
+
+ :param auth_url: URL to which the token request is sent
+ :param disable_ssl_certificate_validation: pass-through to rest client
+ :param ca_certs: pass-through to rest client
+ :param trace_requests: pass-through to rest client
+ :param kwargs: any extra parameter to pass through the rest client.
+ region, service and auth_provider will be ignored, if passed,
+ as they are not meaningful for token client
+ """
dscv = disable_ssl_certificate_validation
+ # NOTE(andreaf) region, service and auth_provider are passed
+ # positionally with None. Having them in kwargs would raise a
+ # "multiple values for keyword arguments" error
+ for unwanted_kwargs in ['region', 'service', 'auth_provider']:
+ kwargs.pop(unwanted_kwargs, None)
super(TokenClient, self).__init__(
None, None, None, disable_ssl_certificate_validation=dscv,
ca_certs=ca_certs, trace_requests=trace_requests, **kwargs)
diff --git a/tempest/lib/services/identity/v3/token_client.py b/tempest/lib/services/identity/v3/token_client.py
index 06927f4..33f6f16 100644
--- a/tempest/lib/services/identity/v3/token_client.py
+++ b/tempest/lib/services/identity/v3/token_client.py
@@ -23,7 +23,19 @@
def __init__(self, auth_url, disable_ssl_certificate_validation=None,
ca_certs=None, trace_requests=None, **kwargs):
+ """Initialises the Token client
+
+ :param auth_url: URL to which the token request is sent
+ :param disable_ssl_certificate_validation: pass-through to rest client
+ :param ca_certs: pass-through to rest client
+ :param trace_requests: pass-through to rest client
+ :param kwargs: any extra parameter to pass through the rest client.
+ Three kwargs are forbidden: region, service and auth_provider
+ as they are not meaningful for token client
+ """
dscv = disable_ssl_certificate_validation
+ for unwanted_kwargs in ['region', 'service', 'auth_provider']:
+ kwargs.pop(unwanted_kwargs, None)
super(V3TokenClient, self).__init__(
None, None, None, disable_ssl_certificate_validation=dscv,
ca_certs=ca_certs, trace_requests=trace_requests, **kwargs)
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 2da2f92..a3a0100 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -529,14 +529,14 @@
caller = test_utils.find_test_caller()
LOG.debug('%(caller)s begins to ping %(ip)s in %(timeout)s sec and the'
- ' expected result is %(should_succeed)s', **{
+ ' expected result is %(should_succeed)s', {
'caller': caller, 'ip': ip_address, 'timeout': timeout,
'should_succeed':
'reachable' if should_succeed else 'unreachable'
})
result = test_utils.call_until_true(ping, timeout, 1)
LOG.debug('%(caller)s finishes ping %(ip)s in %(timeout)s sec and the '
- 'ping result is %(result)s', **{
+ 'ping result is %(result)s', {
'caller': caller, 'ip': ip_address, 'timeout': timeout,
'result': 'expected' if result else 'unexpected'
})
diff --git a/tempest/test_discover/plugins.py b/tempest/test_discover/plugins.py
index e9f59af..abe2b73 100644
--- a/tempest/test_discover/plugins.py
+++ b/tempest/test_discover/plugins.py
@@ -13,8 +13,8 @@
# under the License.
import abc
-import logging
+from oslo_log import log as logging
import six
import stevedore