Merge "Make _create_network() non-private"
diff --git a/releasenotes/notes/remove-deprecated-volume-config-options-4b7ea93b88e5b982.yaml b/releasenotes/notes/remove-deprecated-volume-config-options-4b7ea93b88e5b982.yaml
new file mode 100644
index 0000000..f3002f9
--- /dev/null
+++ b/releasenotes/notes/remove-deprecated-volume-config-options-4b7ea93b88e5b982.yaml
@@ -0,0 +1,9 @@
+---
+upgrade:
+ - |
+ Deprecated config options to select the Volume API version have been
+ removed. Use ``CONF.volume.catalog_type`` to run volume tests under v3
+ or v2 APIs.
+
+ * ``CONF.volume-feature-enabled.api_v2``
+ * ``CONF.volume-feature-enabled.api_v3``
\ No newline at end of file
diff --git a/releasenotes/notes/support-for-rbac-new-scope-6ec8164ce1e7288c.yaml b/releasenotes/notes/support-for-rbac-new-scope-6ec8164ce1e7288c.yaml
new file mode 100644
index 0000000..af7df93
--- /dev/null
+++ b/releasenotes/notes/support-for-rbac-new-scope-6ec8164ce1e7288c.yaml
@@ -0,0 +1,13 @@
+---
+prelude: >
+ Support for RBAC new system scope is added in Tempest.
+features:
+ - |
+ Keystone provides the new scoped token called ``system`` which
+ can be used to query the system scoped API operation. Projects
+ are moving towards the policy with new scope types, Keystone, Nova
+ already provide the new policy for RBAC checks. Tempest has added
+ the support to query the system scoped token from keystone to test
+ the new policy.
+ As next step, we will be moving all the Tempest tests on the project's
+ new policy.
diff --git a/roles/run-tempest/README.rst b/roles/run-tempest/README.rst
index f9fcf28..0c72b69 100644
--- a/roles/run-tempest/README.rst
+++ b/roles/run-tempest/README.rst
@@ -81,7 +81,7 @@
.. zuul:rolevar:: stable_constraints_file
:default: ''
- Upper constraints file to be used for stable branch till stable/rocky.
+ Upper constraints file to be used for stable branch till stable/stein.
.. zuul:rolevar:: tempest_tox_environment
:default: ''
diff --git a/roles/run-tempest/tasks/main.yaml b/roles/run-tempest/tasks/main.yaml
index 999e256..5b00de3 100644
--- a/roles/run-tempest/tasks/main.yaml
+++ b/roles/run-tempest/tasks/main.yaml
@@ -25,11 +25,11 @@
target_branch: "{{ zuul.override_checkout }}"
when: zuul.override_checkout is defined
-- name: Use stable branch upper-constraints till stable/rocky
+- name: Use stable branch upper-constraints till stable/stein
set_fact:
# TOX_CONSTRAINTS_FILE is new name, UPPER_CONSTRAINTS_FILE is old one, best to set both
tempest_tox_environment: "{{ tempest_tox_environment | combine({'UPPER_CONSTRAINTS_FILE': stable_constraints_file}) | combine({'TOX_CONSTRAINTS_FILE': stable_constraints_file}) }}"
- when: target_branch in ["stable/ocata", "stable/pike", "stable/queens", "stable/rocky"]
+ when: target_branch in ["stable/ocata", "stable/pike", "stable/queens", "stable/rocky", "stable/stein"]
- name: Set OS_TEST_TIMEOUT if requested
set_fact:
diff --git a/tempest/api/compute/admin/test_instance_usage_audit_log.py b/tempest/api/compute/admin/test_instance_usage_audit_log.py
index 4dcbb3b..c4c0542 100644
--- a/tempest/api/compute/admin/test_instance_usage_audit_log.py
+++ b/tempest/api/compute/admin/test_instance_usage_audit_log.py
@@ -14,8 +14,7 @@
# under the License.
import datetime
-
-from six.moves.urllib import parse as urllib
+from urllib import parse as urllib
from tempest.api.compute import base
from tempest.lib import decorators
diff --git a/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py b/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
index 84d18c4..c115451 100644
--- a/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
+++ b/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
@@ -14,8 +14,7 @@
# under the License.
import datetime
-
-from six.moves.urllib import parse as urllib
+from urllib import parse as urllib
from tempest.api.compute import base
from tempest.lib import decorators
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index 941315e..52ccea7 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -169,8 +169,13 @@
block_migrate_cinder_iscsi,
'Block Live migration not configured for iSCSI')
@utils.services('volume')
- def test_iscsi_volume(self):
- """Test live migrating a server with volume attached"""
+ def test_live_block_migration_with_attached_volume(self):
+ """Test the live-migration of an instance with an attached volume.
+
+ This tests the live-migration of an instance with both a local disk and
+ attach volume. This differs from test_volume_backed_live_migration
+ above that tests live-migration with only an attached volume.
+ """
server = self.create_test_server(wait_until="ACTIVE")
server_id = server['id']
if not CONF.compute_feature_enabled.can_migrate_between_any_hosts:
diff --git a/tempest/api/compute/admin/test_volume.py b/tempest/api/compute/admin/test_volume.py
index 342380e..cf8c560 100644
--- a/tempest/api/compute/admin/test_volume.py
+++ b/tempest/api/compute/admin/test_volume.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
+import io
from tempest.api.compute import base
from tempest.common import waiters
@@ -51,7 +51,7 @@
image = self.image_client.show_image(CONF.compute.image_ref)
image_data = self.image_client.show_image_file(
CONF.compute.image_ref).data
- image_file = six.BytesIO(image_data)
+ image_file = io.BytesIO(image_data)
create_dict = {
'container_format': image['container_format'],
'disk_format': image['disk_format'],
diff --git a/tempest/api/compute/flavors/test_flavors_negative.py b/tempest/api/compute/flavors/test_flavors_negative.py
index 235049a..5d6a7d7 100644
--- a/tempest/api/compute/flavors/test_flavors_negative.py
+++ b/tempest/api/compute/flavors/test_flavors_negative.py
@@ -13,10 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+import io
import random
-import six
-
from tempest.api.compute import base
from tempest.common import image as common_image
from tempest.common import utils
@@ -44,7 +43,7 @@
CONF.compute.flavor_ref)['flavor']
min_img_ram = flavor['ram'] + 1
size = random.randint(1024, 4096)
- image_file = six.BytesIO(data_utils.random_bytes(size))
+ image_file = io.BytesIO(data_utils.random_bytes(size))
params = {
'name': data_utils.rand_name('image'),
'container_format': CONF.image.container_formats[0],
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index 561265f..ece983d 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
+import io
from tempest.api.compute import base
from tempest.common import image as common_image
@@ -77,7 +77,7 @@
cls.addClassResourceCleanup(test_utils.call_and_ignore_notfound_exc,
cls.glance_client.delete_image,
cls.image_id)
- image_file = six.BytesIO((b'*' * 1024))
+ image_file = io.BytesIO((b'*' * 1024))
if CONF.image_feature_enabled.api_v1:
cls.glance_client.update_image(cls.image_id, data=image_file)
else:
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index 7930c67..15b8a00 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -15,7 +15,7 @@
import time
-import six
+import io
import testtools
from tempest.api.compute import base
@@ -85,7 +85,7 @@
# Wait 1 second between creation and upload to ensure a delta
# between created_at and updated_at.
time.sleep(1)
- image_file = six.BytesIO((b'*' * 1024))
+ image_file = io.BytesIO((b'*' * 1024))
if CONF.image_feature_enabled.api_v1:
cls.glance_client.update_image(image_id, data=image_file)
else:
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index 102792e..ac18442 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -16,7 +16,6 @@
import time
from oslo_log import log
-import six
from tempest.api.compute import base
from tempest.common import compute
@@ -241,7 +240,7 @@
except lib_exc.BadRequest as e:
msg = ('Multiple possible networks found, use a Network ID to be '
'more specific.')
- if not CONF.compute.fixed_network_name and six.text_type(e) == msg:
+ if not CONF.compute.fixed_network_name and str(e) == msg:
raise
else:
ifs.append(iface)
@@ -450,7 +449,7 @@
except lib_exc.BadRequest as e:
msg = ('Multiple possible networks found, use a Network ID to be '
'more specific.')
- if not CONF.compute.fixed_network_name and six.text_type(e) == msg:
+ if not CONF.compute.fixed_network_name and str(e) == msg:
raise
else:
# just to check the response schema
diff --git a/tempest/api/compute/servers/test_novnc.py b/tempest/api/compute/servers/test_novnc.py
index 6ebdbdb..a9c0e56 100644
--- a/tempest/api/compute/servers/test_novnc.py
+++ b/tempest/api/compute/servers/test_novnc.py
@@ -14,9 +14,9 @@
# under the License.
import struct
+import urllib.parse as urlparse
import six
-import six.moves.urllib.parse as urlparse
import urllib3
from tempest.api.compute import base
@@ -69,7 +69,7 @@
resp = urllib3.PoolManager().request('GET', vnc_url)
# Make sure that the GET request was accepted by the novncproxy
self.assertEqual(resp.status, 200, 'Got a Bad HTTP Response on the '
- 'initial call: ' + six.text_type(resp.status))
+ 'initial call: ' + str(resp.status))
# Do some basic validation to make sure it is an expected HTML document
resp_data = resp.data.decode()
# This is needed in the case of example: <html lang="en">
@@ -165,11 +165,11 @@
self._websocket.response.startswith(b'HTTP/1.1 101 Switching '
b'Protocols'),
'Incorrect HTTP return status code: {}'.format(
- six.text_type(self._websocket.response)
+ str(self._websocket.response)
)
)
_required_header = 'upgrade: websocket'
- _response = six.text_type(self._websocket.response).lower()
+ _response = str(self._websocket.response).lower()
self.assertIn(
_required_header,
_response,
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 4527aa9..deb21c7 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urlparse
+
from oslo_log import log as logging
-from six.moves.urllib import parse as urlparse
import testtools
from tempest.api.compute import base
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index f3a7471..5bbd65c 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
-
from tempest.api.identity import base
from tempest import config
from tempest.lib.common.utils import data_utils
@@ -70,8 +68,8 @@
orig_expires_at = token_auth['token']['expires_at']
orig_user = token_auth['token']['user']
- self.assertIsInstance(token_auth['token']['expires_at'], six.text_type)
- self.assertIsInstance(token_auth['token']['issued_at'], six.text_type)
+ self.assertIsInstance(token_auth['token']['expires_at'], str)
+ self.assertIsInstance(token_auth['token']['issued_at'], str)
self.assertEqual(['password'], token_auth['token']['methods'])
self.assertEqual(user['id'], token_auth['token']['user']['id'])
self.assertEqual(user['name'], token_auth['token']['user']['name'])
@@ -91,7 +89,7 @@
self.assertEqual(orig_expires_at, token_auth['token']['expires_at'],
'Expiration time should match original token')
- self.assertIsInstance(token_auth['token']['issued_at'], six.text_type)
+ self.assertIsInstance(token_auth['token']['issued_at'], str)
self.assertEqual(set(['password', 'token']),
set(token_auth['token']['methods']))
self.assertEqual(orig_user, token_auth['token']['user'],
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index d3dc19a..d0d64a5 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
+import io
from tempest.common import image as common_image
from tempest import config
@@ -113,7 +113,7 @@
cls.alt_tenant_id = cls.alt_image_member_client.tenant_id
def _create_image(self):
- image_file = six.BytesIO(data_utils.random_bytes())
+ image_file = io.BytesIO(data_utils.random_bytes())
image = self.create_image(container_format='bare',
disk_format='raw',
is_public=False,
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index 595717e..6fd6c4e 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
+import io
from tempest.api.image import base
from tempest.common import image as common_image
@@ -72,7 +72,7 @@
self.assertEqual(val, image.get('properties')[key])
# Now try uploading an image file
- image_file = six.BytesIO(data_utils.random_bytes())
+ image_file = io.BytesIO(data_utils.random_bytes())
body = self.client.update_image(image['id'], data=image_file)['image']
self.assertIn('size', body)
self.assertEqual(1024, body.get('size'))
@@ -204,7 +204,7 @@
Note that the size of the new image is a random number between
1024 and 4096
"""
- image_file = six.BytesIO(data_utils.random_bytes(size))
+ image_file = io.BytesIO(data_utils.random_bytes(size))
name = 'New Standard Image %s' % name
image = cls.create_image(name=name,
container_format=container_format,
@@ -306,7 +306,7 @@
disk_format, size):
"""Create a new standard image and return newly-registered image-id"""
- image_file = six.BytesIO(data_utils.random_bytes(size))
+ image_file = io.BytesIO(data_utils.random_bytes(size))
name = 'New Standard Image %s' % name
image = cls.create_image(name=name,
container_format=container_format,
diff --git a/tempest/api/image/v2/admin/test_images.py b/tempest/api/image/v2/admin/test_images.py
index ad68d82..733c778 100644
--- a/tempest/api/image/v2/admin/test_images.py
+++ b/tempest/api/image/v2/admin/test_images.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
+import io
from tempest.api.image import base
from tempest.common import waiters
@@ -99,7 +99,7 @@
self.assertEqual('queued', image['status'])
file_content = data_utils.random_bytes()
- image_file = six.BytesIO(file_content)
+ image_file = io.BytesIO(file_content)
self.client.store_image_file(image['id'], image_file)
body = self.client.show_image(image['id'])
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index ca72388..59067d1 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -14,10 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+import io
import random
-import six
-
from oslo_log import log as logging
from tempest.api.image import base
from tempest.common import waiters
@@ -82,7 +81,7 @@
image = self._create_image()
# Stage image data
file_content = data_utils.random_bytes()
- image_file = six.BytesIO(file_content)
+ image_file = io.BytesIO(file_content)
self.client.stage_image_file(image['id'], image_file)
# Check image status is 'uploading'
body = self.client.show_image(image['id'])
@@ -158,7 +157,7 @@
self.client.stage_image_file(
image['id'],
- six.BytesIO(data_utils.random_bytes()))
+ io.BytesIO(data_utils.random_bytes()))
# Check image status is 'uploading'
body = self.client.show_image(image['id'])
self.assertEqual(image['id'], body['id'])
@@ -240,7 +239,7 @@
# Now try uploading an image file
file_content = data_utils.random_bytes()
- image_file = six.BytesIO(file_content)
+ image_file = io.BytesIO(file_content)
self.client.store_image_file(image['id'], image_file)
# Now try to get image details
@@ -317,7 +316,7 @@
# Upload an image file
content = data_utils.random_bytes()
- image_file = six.BytesIO(content)
+ image_file = io.BytesIO(content)
self.client.store_image_file(image['id'], image_file)
# Deactivate image
@@ -367,7 +366,7 @@
1024 and 4096
"""
size = random.randint(1024, 4096)
- image_file = six.BytesIO(data_utils.random_bytes(size))
+ image_file = io.BytesIO(data_utils.random_bytes(size))
tags = [data_utils.rand_name('tag'), data_utils.rand_name('tag')]
image = cls.create_image(container_format=container_format,
disk_format=disk_format,
@@ -550,7 +549,7 @@
def test_list_images_param_member_status(self):
"""Test listing images by member_status and visibility"""
# Create an image to be shared using default visibility
- image_file = six.BytesIO(data_utils.random_bytes(2048))
+ image_file = io.BytesIO(data_utils.random_bytes(2048))
container_format = CONF.image.container_formats[0]
disk_format = CONF.image.disk_formats[0]
image = self.create_image(container_format=container_format,
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 479578d..63078cd 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -16,7 +16,6 @@
import ipaddress
import netaddr
-import six
import testtools
from tempest.api.network import base_security_groups as sec_base
@@ -234,15 +233,15 @@
# Get two IP addresses
ip_address_1 = None
ip_address_2 = None
- ip_network = ipaddress.ip_network(six.text_type(subnet['cidr']))
+ ip_network = ipaddress.ip_network(str(subnet['cidr']))
for ip in ip_network:
if ip == ip_network.network_address:
continue
if ip_address_1 is None:
- ip_address_1 = six.text_type(ip)
+ ip_address_1 = str(ip)
else:
ip_address_2 = ip_address_1
- ip_address_1 = six.text_type(ip)
+ ip_address_1 = str(ip)
# Make sure these two IP addresses have different substring
if ip_address_1[:-1] != ip_address_2[:-1]:
break
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index e8f3f8b..478a834 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -13,12 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-import time
-
from tempest.common import custom_matchers
from tempest import config
from tempest.lib.common.utils import data_utils
-from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions as lib_exc
import tempest.test
@@ -50,12 +47,11 @@
_, objlist = container_client.list_container_objects(cont, params)
# delete every object in the container
for obj in objlist:
- test_utils.call_and_ignore_notfound_exc(
- object_client.delete_object, cont, obj['name'])
- # sleep 2 seconds to sync the deletion of the objects
- # in HA deployment
- time.sleep(2)
+ object_client.delete_object(cont, obj['name'])
+ object_client.wait_for_resource_deletion(obj['name'], cont)
+ # Verify resource deletion
container_client.delete_container(cont)
+ container_client.wait_for_resource_deletion(cont)
except lib_exc.NotFound:
pass
diff --git a/tempest/api/object_storage/test_account_services.py b/tempest/api/object_storage/test_account_services.py
index da8ad66..ffea6f6 100644
--- a/tempest/api/object_storage/test_account_services.py
+++ b/tempest/api/object_storage/test_account_services.py
@@ -62,7 +62,7 @@
self.assertIsNotNone(container_list)
for container_name in self.containers:
- self.assertIn(six.text_type(container_name).encode('utf-8'),
+ self.assertIn(str(container_name).encode('utf-8'),
container_list)
@decorators.idempotent_id('884ec421-fbad-4fcc-916b-0580f2699565')
diff --git a/tempest/api/object_storage/test_container_sync.py b/tempest/api/object_storage/test_container_sync.py
index eb2ef7f..276b826 100644
--- a/tempest/api/object_storage/test_container_sync.py
+++ b/tempest/api/object_storage/test_container_sync.py
@@ -14,8 +14,8 @@
# under the License.
import time
+from urllib import parse as urlparse
-from six.moves.urllib import parse as urlparse
import testtools
from tempest.api.object_storage import base
diff --git a/tempest/api/object_storage/test_object_formpost.py b/tempest/api/object_storage/test_object_formpost.py
index d857d3b..39e895e 100644
--- a/tempest/api/object_storage/test_object_formpost.py
+++ b/tempest/api/object_storage/test_object_formpost.py
@@ -15,8 +15,7 @@
import hashlib
import hmac
import time
-
-from six.moves.urllib import parse as urlparse
+from urllib import parse as urlparse
from tempest.api.object_storage import base
from tempest.common import utils
diff --git a/tempest/api/object_storage/test_object_formpost_negative.py b/tempest/api/object_storage/test_object_formpost_negative.py
index 0499eef..971a223 100644
--- a/tempest/api/object_storage/test_object_formpost_negative.py
+++ b/tempest/api/object_storage/test_object_formpost_negative.py
@@ -15,8 +15,7 @@
import hashlib
import hmac
import time
-
-from six.moves.urllib import parse as urlparse
+from urllib import parse as urlparse
from tempest.api.object_storage import base
from tempest.common import utils
diff --git a/tempest/api/object_storage/test_object_temp_url.py b/tempest/api/object_storage/test_object_temp_url.py
index 29354b6..e75e22a 100644
--- a/tempest/api/object_storage/test_object_temp_url.py
+++ b/tempest/api/object_storage/test_object_temp_url.py
@@ -15,8 +15,7 @@
import hashlib
import hmac
import time
-
-from six.moves.urllib import parse as urlparse
+from urllib import parse as urlparse
from tempest.api.object_storage import base
from tempest.common import utils
diff --git a/tempest/api/object_storage/test_object_temp_url_negative.py b/tempest/api/object_storage/test_object_temp_url_negative.py
index bbb4827..4ad8428 100644
--- a/tempest/api/object_storage/test_object_temp_url_negative.py
+++ b/tempest/api/object_storage/test_object_temp_url_negative.py
@@ -15,8 +15,7 @@
import hashlib
import hmac
import time
-
-from six.moves.urllib import parse as urlparse
+from urllib import parse as urlparse
from tempest.api.object_storage import base
from tempest.common import utils
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index c538e60..f6559f8 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -20,7 +20,6 @@
from tempest.lib.common import api_version_utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
-from tempest.lib import exceptions
import tempest.test
CONF = config.CONF
@@ -34,11 +33,6 @@
# https://bugs.launchpad.net/tempest/+bug/1844568
create_default_network = False
_api_version = 2
- # if api_v2 is not enabled while api_v3 is enabled, the volume v2 classes
- # should be transferred to volume v3 classes.
- if (not CONF.volume_feature_enabled.api_v2 and
- CONF.volume_feature_enabled.api_v3):
- _api_version = 3
credentials = ['primary']
@classmethod
@@ -48,17 +42,6 @@
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
- if cls._api_version == 2:
- if not CONF.volume_feature_enabled.api_v2:
- msg = "Volume API v2 is disabled"
- raise cls.skipException(msg)
- elif cls._api_version == 3:
- if not CONF.volume_feature_enabled.api_v3:
- msg = "Volume API v3 is disabled"
- raise cls.skipException(msg)
- else:
- msg = ("Invalid Cinder API version (%s)" % cls._api_version)
- raise exceptions.InvalidConfiguration(msg)
api_version_utils.check_skip_with_microversion(
cls.min_microversion, cls.max_microversion,
@@ -129,6 +112,13 @@
name = data_utils.rand_name(cls.__name__ + '-Volume')
kwargs['name'] = name
+ if CONF.volume.volume_type and 'volume_type' not in kwargs:
+ # If volume_type is not provided in config then no need to
+ # add a volume type and
+ # if volume_type has already been added by child class then
+ # no need to override.
+ kwargs['volume_type'] = CONF.volume.volume_type
+
if CONF.compute.compute_volume_common_az:
kwargs.setdefault('availability_zone',
CONF.compute.compute_volume_common_az)
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index 60f85a4..1d1981c 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -16,8 +16,8 @@
import operator
import random
+from urllib.parse import urlparse
-from six.moves.urllib.parse import urlparse
from testtools import matchers
from tempest.api.volume import base
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 389d3be..35dd0ca 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
+import io
from tempest.api.volume import base
from tempest.common import utils
@@ -50,7 +50,7 @@
self.images_client.delete_image, image['id'])
# Upload image with 1KB data
- image_file = six.BytesIO(data_utils.random_bytes())
+ image_file = io.BytesIO(data_utils.random_bytes())
self.images_client.store_image_file(image['id'], image_file)
waiters.wait_for_image_status(self.images_client,
image['id'], 'active')
diff --git a/tempest/clients.py b/tempest/clients.py
index 6d19a0c..9ff02ea 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -231,89 +231,85 @@
def _set_volume_clients(self):
- # if only api_v3 is enabled, all these clients should be available
- if (CONF.volume_feature_enabled.api_v2 or
- CONF.volume_feature_enabled.api_v3):
- self.backups_client_latest = self.volume_v3.BackupsClient()
- self.encryption_types_client_latest = \
- self.volume_v3.EncryptionTypesClient()
- self.snapshot_manage_client_latest = \
- self.volume_v3.SnapshotManageClient()
- self.snapshots_client_latest = self.volume_v3.SnapshotsClient()
- self.volume_capabilities_client_latest = \
- self.volume_v3.CapabilitiesClient()
- self.volume_manage_client_latest = (
- self.volume_v3.VolumeManageClient())
- self.volume_qos_client_latest = self.volume_v3.QosSpecsClient()
- self.volume_services_client_latest = (
- self.volume_v3.ServicesClient())
- self.volume_types_client_latest = self.volume_v3.TypesClient()
- self.volume_hosts_client_latest = self.volume_v3.HostsClient()
- self.volume_quotas_client_latest = self.volume_v3.QuotasClient()
- self.volume_quota_classes_client_latest = \
- self.volume_v3.QuotaClassesClient()
- self.volume_scheduler_stats_client_latest = \
- self.volume_v3.SchedulerStatsClient()
- self.volume_transfers_client_latest = \
- self.volume_v3.TransfersClient()
- self.volume_availability_zone_client_latest = \
- self.volume_v3.AvailabilityZoneClient()
- self.volume_limits_client_latest = self.volume_v3.LimitsClient()
- self.volumes_client_latest = self.volume_v3.VolumesClient()
- self.volumes_extension_client_latest = \
- self.volume_v3.ExtensionsClient()
- self.group_types_client_latest = self.volume_v3.GroupTypesClient()
- self.groups_client_latest = self.volume_v3.GroupsClient()
- self.group_snapshots_client_latest = \
- self.volume_v3.GroupSnapshotsClient()
- self.volume_messages_client_latest = (
- self.volume_v3.MessagesClient())
- self.volume_versions_client_latest = (
- self.volume_v3.VersionsClient())
- self.attachments_client_latest = (
- self.volume_v3.AttachmentsClient())
+ self.backups_client_latest = self.volume_v3.BackupsClient()
+ self.encryption_types_client_latest = \
+ self.volume_v3.EncryptionTypesClient()
+ self.snapshot_manage_client_latest = \
+ self.volume_v3.SnapshotManageClient()
+ self.snapshots_client_latest = self.volume_v3.SnapshotsClient()
+ self.volume_capabilities_client_latest = \
+ self.volume_v3.CapabilitiesClient()
+ self.volume_manage_client_latest = (
+ self.volume_v3.VolumeManageClient())
+ self.volume_qos_client_latest = self.volume_v3.QosSpecsClient()
+ self.volume_services_client_latest = (
+ self.volume_v3.ServicesClient())
+ self.volume_types_client_latest = self.volume_v3.TypesClient()
+ self.volume_hosts_client_latest = self.volume_v3.HostsClient()
+ self.volume_quotas_client_latest = self.volume_v3.QuotasClient()
+ self.volume_quota_classes_client_latest = \
+ self.volume_v3.QuotaClassesClient()
+ self.volume_scheduler_stats_client_latest = \
+ self.volume_v3.SchedulerStatsClient()
+ self.volume_transfers_client_latest = \
+ self.volume_v3.TransfersClient()
+ self.volume_availability_zone_client_latest = \
+ self.volume_v3.AvailabilityZoneClient()
+ self.volume_limits_client_latest = self.volume_v3.LimitsClient()
+ self.volumes_client_latest = self.volume_v3.VolumesClient()
+ self.volumes_extension_client_latest = \
+ self.volume_v3.ExtensionsClient()
+ self.group_types_client_latest = self.volume_v3.GroupTypesClient()
+ self.groups_client_latest = self.volume_v3.GroupsClient()
+ self.group_snapshots_client_latest = \
+ self.volume_v3.GroupSnapshotsClient()
+ self.volume_messages_client_latest = (
+ self.volume_v3.MessagesClient())
+ self.volume_versions_client_latest = (
+ self.volume_v3.VersionsClient())
+ self.attachments_client_latest = (
+ self.volume_v3.AttachmentsClient())
- # TODO(gmann): Below alias for service clients have been
- # deprecated and will be removed in future. Start using the alias
- # defined above with suffix _latest.
- # ****************Deprecated alias start from here***************
- self.backups_v2_client = self.volume_v3.BackupsClient()
- self.encryption_types_v2_client = \
- self.volume_v3.EncryptionTypesClient()
- self.snapshot_manage_v2_client = \
- self.volume_v3.SnapshotManageClient()
- self.snapshots_v2_client = self.volume_v3.SnapshotsClient()
- self.volume_capabilities_v2_client = \
- self.volume_v3.CapabilitiesClient()
- self.volume_manage_v2_client = self.volume_v3.VolumeManageClient()
- self.volume_qos_v2_client = self.volume_v3.QosSpecsClient()
- self.volume_services_v2_client = self.volume_v3.ServicesClient()
- self.volume_types_v2_client = self.volume_v3.TypesClient()
- self.volume_hosts_v2_client = self.volume_v3.HostsClient()
- self.volume_quotas_v2_client = self.volume_v3.QuotasClient()
- self.volume_quota_classes_v2_client = \
- self.volume_v3.QuotaClassesClient()
- self.volume_scheduler_stats_v2_client = \
- self.volume_v3.SchedulerStatsClient()
- self.volume_transfers_v2_client = self.volume_v3.TransfersClient()
- self.volume_v2_availability_zone_client = \
- self.volume_v3.AvailabilityZoneClient()
- self.volume_v2_limits_client = self.volume_v3.LimitsClient()
- self.volumes_v2_client = self.volume_v3.VolumesClient()
- self.volumes_v2_extension_client = \
- self.volume_v3.ExtensionsClient()
+ # TODO(gmann): Below alias for service clients have been
+ # deprecated and will be removed in future. Start using the alias
+ # defined above with suffix _latest.
+ # ****************Deprecated alias start from here***************
+ self.backups_v2_client = self.volume_v3.BackupsClient()
+ self.encryption_types_v2_client = \
+ self.volume_v3.EncryptionTypesClient()
+ self.snapshot_manage_v2_client = \
+ self.volume_v3.SnapshotManageClient()
+ self.snapshots_v2_client = self.volume_v3.SnapshotsClient()
+ self.volume_capabilities_v2_client = \
+ self.volume_v3.CapabilitiesClient()
+ self.volume_manage_v2_client = self.volume_v3.VolumeManageClient()
+ self.volume_qos_v2_client = self.volume_v3.QosSpecsClient()
+ self.volume_services_v2_client = self.volume_v3.ServicesClient()
+ self.volume_types_v2_client = self.volume_v3.TypesClient()
+ self.volume_hosts_v2_client = self.volume_v3.HostsClient()
+ self.volume_quotas_v2_client = self.volume_v3.QuotasClient()
+ self.volume_quota_classes_v2_client = \
+ self.volume_v3.QuotaClassesClient()
+ self.volume_scheduler_stats_v2_client = \
+ self.volume_v3.SchedulerStatsClient()
+ self.volume_transfers_v2_client = self.volume_v3.TransfersClient()
+ self.volume_v2_availability_zone_client = \
+ self.volume_v3.AvailabilityZoneClient()
+ self.volume_v2_limits_client = self.volume_v3.LimitsClient()
+ self.volumes_v2_client = self.volume_v3.VolumesClient()
+ self.volumes_v2_extension_client = \
+ self.volume_v3.ExtensionsClient()
- if CONF.volume_feature_enabled.api_v3:
- self.backups_v3_client = self.volume_v3.BackupsClient()
- self.group_types_v3_client = self.volume_v3.GroupTypesClient()
- self.groups_v3_client = self.volume_v3.GroupsClient()
- self.group_snapshots_v3_client = \
- self.volume_v3.GroupSnapshotsClient()
- self.snapshots_v3_client = self.volume_v3.SnapshotsClient()
- self.volume_v3_messages_client = self.volume_v3.MessagesClient()
- self.volume_v3_versions_client = self.volume_v3.VersionsClient()
- self.volumes_v3_client = self.volume_v3.VolumesClient()
- # ****************Deprecated alias end here***********************
+ self.backups_v3_client = self.volume_v3.BackupsClient()
+ self.group_types_v3_client = self.volume_v3.GroupTypesClient()
+ self.groups_v3_client = self.volume_v3.GroupsClient()
+ self.group_snapshots_v3_client = \
+ self.volume_v3.GroupSnapshotsClient()
+ self.snapshots_v3_client = self.volume_v3.SnapshotsClient()
+ self.volume_v3_messages_client = self.volume_v3.MessagesClient()
+ self.volume_v3_versions_client = self.volume_v3.VersionsClient()
+ self.volumes_v3_client = self.volume_v3.VolumesClient()
+ # ****************Deprecated alias end here***********************
def _set_object_storage_clients(self):
self.account_client = self.object_storage.AccountClient()
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 84d2492..f2370f3 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_log import log as logging
-from six.moves.urllib import parse as urllib
from tempest import clients
from tempest.common import credentials_factory as credentials
diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py
index 6e93d69..3eae552 100644
--- a/tempest/cmd/init.py
+++ b/tempest/cmd/init.py
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import configparser
import os
import shutil
import sys
@@ -19,7 +20,6 @@
from cliff import command
from oslo_config import generator
from oslo_log import log as logging
-from six import moves
from stestr import commands
from tempest.cmd import workspace
@@ -92,7 +92,7 @@
stestr_conf_file.write(stestr_conf)
def get_configparser(self, conf_path):
- config_parse = moves.configparser.ConfigParser()
+ config_parse = configparser.ConfigParser()
config_parse.optionxform = str
# get any existing values if a config file already exists
if os.path.isfile(conf_path):
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index 235d8e3..0db1ab1 100644
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -202,22 +202,8 @@
not CONF.identity_feature_enabled.api_v3, update)
-def verify_cinder_api_versions(os, update):
- # Check cinder api versions
- versions = _get_api_versions(os, 'cinder')
- if (CONF.volume_feature_enabled.api_v2 !=
- contains_version('v2.', versions)):
- print_and_or_update('api_v2', 'volume-feature-enabled',
- not CONF.volume_feature_enabled.api_v2, update)
- if (CONF.volume_feature_enabled.api_v3 !=
- contains_version('v3.', versions)):
- print_and_or_update('api_v3', 'volume-feature-enabled',
- not CONF.volume_feature_enabled.api_v3, update)
-
-
def verify_api_versions(os, service, update):
verify = {
- 'cinder': verify_cinder_api_versions,
'glance': verify_glance_api_versions,
'keystone': verify_keystone_api_versions,
}
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
index 42f68f1..a062f6f 100644
--- a/tempest/common/compute.py
+++ b/tempest/common/compute.py
@@ -18,8 +18,7 @@
import ssl
import struct
import textwrap
-
-from six.moves.urllib import parse as urlparse
+from urllib import parse as urlparse
from oslo_log import log as logging
from oslo_utils import excutils
diff --git a/tempest/config.py b/tempest/config.py
index 1367678..0df5045 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -972,6 +972,9 @@
default=['BACKEND_1', 'BACKEND_2'],
help='A list of backend names separated by comma. '
'The backend name must be declared in cinder.conf'),
+ cfg.StrOpt('volume_type',
+ default='',
+ help='Volume type to be used while creating volume.'),
cfg.StrOpt('storage_protocol',
default='iSCSI',
help='Backend protocol to target when creating volume types'),
@@ -1043,31 +1046,6 @@
help='A list of enabled volume extensions with a special '
'entry all which indicates every extension is enabled. '
'Empty list indicates all extensions are disabled'),
- cfg.BoolOpt('api_v2',
- default=True,
- help="Is the v2 volume API enabled",
- deprecated_for_removal=True,
- deprecated_reason="The v2 volume API has been deprecated "
- "since Pike release. Now Tempest run all "
- "the volume tests against v2 or v3 API "
- "based on CONF.volume.catalog_type which "
- "makes this config option unusable. If "
- "catalog_type is volumev2, then all the "
- "volume tests will run against v2 API. "
- "Use ``CONF.volume.catalog_type`` to run "
- "the Tempest against volume v2 or v3 API"),
- cfg.BoolOpt('api_v3',
- default=True,
- help="Is the v3 volume API enabled",
- deprecated_for_removal=True,
- deprecated_reason="Tempest run all the volume tests against "
- "v2 or v3 API based on "
- "CONF.volume.catalog_type which makes this "
- "config option unusable. If catalog_type is "
- "volumev3 which is default, then all the "
- "volume tests will run against v3 API. "
- "Use ``CONF.volume.catalog_type`` to run "
- "the Tempest against volume v2 or v3 API"),
cfg.BoolOpt('extend_attached_volume',
default=False,
help='Does the cloud support extending the size of a volume '
diff --git a/tempest/lib/auth.py b/tempest/lib/auth.py
index 9f8c7c5..8bdf98e 100644
--- a/tempest/lib/auth.py
+++ b/tempest/lib/auth.py
@@ -18,10 +18,9 @@
import copy
import datetime
import re
+from urllib import parse as urlparse
from oslo_log import log as logging
-import six
-from six.moves.urllib import parse as urlparse
from tempest.lib import exceptions
from tempest.lib.services.identity.v2 import token_client as json_v2id
@@ -65,8 +64,7 @@
return url
-@six.add_metaclass(abc.ABCMeta)
-class AuthProvider(object):
+class AuthProvider(object, metaclass=abc.ABCMeta):
"""Provide authentication"""
SCOPES = set(['project'])
diff --git a/tempest/lib/cmd/check_uuid.py b/tempest/lib/cmd/check_uuid.py
index ff09671..0ae11ca 100755
--- a/tempest/lib/cmd/check_uuid.py
+++ b/tempest/lib/cmd/check_uuid.py
@@ -22,10 +22,10 @@
import os
import sys
import unittest
+import urllib.parse as urlparse
import uuid
from oslo_utils import uuidutils
-import six.moves.urllib.parse as urlparse
DECORATOR_MODULE = 'decorators'
DECORATOR_NAME = 'idempotent_id'
diff --git a/tempest/lib/common/cred_client.py b/tempest/lib/common/cred_client.py
index f6e9b49..f13d6d0 100644
--- a/tempest/lib/common/cred_client.py
+++ b/tempest/lib/common/cred_client.py
@@ -13,7 +13,6 @@
import abc
from oslo_log import log as logging
-import six
from tempest.lib import auth
from tempest.lib import exceptions as lib_exc
@@ -22,8 +21,7 @@
LOG = logging.getLogger(__name__)
-@six.add_metaclass(abc.ABCMeta)
-class CredsClient(object):
+class CredsClient(object, metaclass=abc.ABCMeta):
"""This class is a wrapper around the identity clients
to provide a single interface for managing credentials in both v2 and v3
diff --git a/tempest/lib/common/cred_provider.py b/tempest/lib/common/cred_provider.py
index 42ed41b..35bca1d 100644
--- a/tempest/lib/common/cred_provider.py
+++ b/tempest/lib/common/cred_provider.py
@@ -14,14 +14,12 @@
import abc
-import six
from tempest.lib import auth
from tempest.lib import exceptions
-@six.add_metaclass(abc.ABCMeta)
-class CredentialProvider(object):
+class CredentialProvider(object, metaclass=abc.ABCMeta):
def __init__(self, identity_version, name=None,
network_resources=None, credentials_domain=None,
admin_role=None, identity_uri=None):
@@ -60,6 +58,42 @@
return
@abc.abstractmethod
+ def get_system_admin_creds(self):
+ return
+
+ @abc.abstractmethod
+ def get_system_member_creds(self):
+ return
+
+ @abc.abstractmethod
+ def get_system_reader_creds(self):
+ return
+
+ @abc.abstractmethod
+ def get_domain_admin_creds(self):
+ return
+
+ @abc.abstractmethod
+ def get_domain_member_creds(self):
+ return
+
+ @abc.abstractmethod
+ def get_domain_reader_creds(self):
+ return
+
+ @abc.abstractmethod
+ def get_project_admin_creds(self):
+ return
+
+ @abc.abstractmethod
+ def get_project_member_creds(self):
+ return
+
+ @abc.abstractmethod
+ def get_project_reader_creds(self):
+ return
+
+ @abc.abstractmethod
def clear_creds(self):
return
diff --git a/tempest/lib/common/dynamic_creds.py b/tempest/lib/common/dynamic_creds.py
index ecbbe8f..95f7e0b 100644
--- a/tempest/lib/common/dynamic_creds.py
+++ b/tempest/lib/common/dynamic_creds.py
@@ -254,6 +254,8 @@
user, role, domain)
elif scope == 'system':
self.creds_client.assign_user_role_on_system(user, role)
+ LOG.info("Roles assigned to the user %s are: %s",
+ user['id'], roles_to_assign)
creds = self.creds_client.get_credentials(**cred_params)
return cred_provider.TestResources(creds)
@@ -339,7 +341,7 @@
tenant_id=tenant_id,
enable_dhcp=self.network_resources['dhcp'],
ip_version=(ipaddress.ip_network(
- six.text_type(subnet_cidr)).version))
+ str(subnet_cidr)).version))
else:
resp_body = self.subnets_admin_client.\
create_subnet(network_id=network_id,
@@ -347,7 +349,7 @@
name=subnet_name,
tenant_id=tenant_id,
ip_version=(ipaddress.ip_network(
- six.text_type(subnet_cidr)).version))
+ str(subnet_cidr)).version))
break
except lib_exc.BadRequest as e:
if 'overlaps with another subnet' not in str(e):
@@ -405,12 +407,18 @@
" credentials: %s", credentials)
return credentials
+ # TODO(gmann): Remove this method in favor of get_project_member_creds()
+ # after the deprecation phase.
def get_primary_creds(self):
return self.get_credentials('primary')
+ # TODO(gmann): Remove this method in favor of get_project_admin_creds()
+ # after the deprecation phase.
def get_admin_creds(self):
return self.get_credentials('admin')
+ # TODO(gmann): Replace this method with more appropriate name.
+ # like get_project_alt_member_creds()
def get_alt_creds(self):
return self.get_credentials('alt')
diff --git a/tempest/lib/common/jsonschema_validator.py b/tempest/lib/common/jsonschema_validator.py
index bbf5e89..0ac757d 100644
--- a/tempest/lib/common/jsonschema_validator.py
+++ b/tempest/lib/common/jsonschema_validator.py
@@ -15,7 +15,6 @@
import jsonschema
from oslo_serialization import base64
from oslo_utils import timeutils
-import six
# JSON Schema validator and format checker used for JSON Schema validation
JSONSCHEMA_VALIDATOR = jsonschema.Draft4Validator
@@ -43,7 +42,7 @@
@jsonschema.FormatChecker.cls_checks('base64')
def _validate_base64_format(instance):
try:
- if isinstance(instance, six.text_type):
+ if isinstance(instance, str):
instance = instance.encode('utf-8')
base64.decode_as_bytes(instance)
except TypeError:
diff --git a/tempest/lib/common/preprov_creds.py b/tempest/lib/common/preprov_creds.py
index 8325f44..313d3eb 100644
--- a/tempest/lib/common/preprov_creds.py
+++ b/tempest/lib/common/preprov_creds.py
@@ -17,7 +17,6 @@
from oslo_concurrency import lockutils
from oslo_log import log as logging
-import six
import yaml
from tempest.lib import auth
@@ -138,7 +137,7 @@
temp_hash = hashlib.md5()
account_for_hash = dict((k, v) for (k, v) in account.items()
if k in cls.HASH_CRED_FIELDS)
- temp_hash.update(six.text_type(account_for_hash).encode('utf-8'))
+ temp_hash.update(str(account_for_hash).encode('utf-8'))
temp_hash_key = temp_hash.hexdigest()
hash_dict['creds'][temp_hash_key] = account
for role in roles:
@@ -308,6 +307,8 @@
self.remove_hash(_hash)
LOG.info("%s returned allocated creds:\n%s", self.name, clean_creds)
+ # TODO(gmann): Remove this method in favor of get_project_member_creds()
+ # after the deprecation phase.
def get_primary_creds(self):
if self._creds.get('primary'):
return self._creds.get('primary')
@@ -315,6 +316,8 @@
self._creds['primary'] = net_creds
return net_creds
+ # TODO(gmann): Replace this method with more appropriate name.
+ # like get_project_alt_member_creds()
def get_alt_creds(self):
if self._creds.get('alt'):
return self._creds.get('alt')
@@ -387,7 +390,7 @@
def get_creds_by_roles(self, roles, force_new=False):
roles = list(set(roles))
- exist_creds = self._creds.get(six.text_type(roles).encode(
+ exist_creds = self._creds.get(str(roles).encode(
'utf-8'), None)
# The force kwarg is used to allocate an additional set of creds with
# the same role list. The index used for the previously allocation
@@ -397,17 +400,19 @@
elif exist_creds and force_new:
# NOTE(andreaf) In py3.x encode returns bytes, and b'' is bytes
# In py2.7 encode returns strings, and b'' is still string
- new_index = six.text_type(roles).encode('utf-8') + b'-' + \
- six.text_type(len(self._creds)).encode('utf-8')
+ new_index = str(roles).encode('utf-8') + b'-' + \
+ str(len(self._creds)).encode('utf-8')
self._creds[new_index] = exist_creds
net_creds = self._get_creds(roles=roles)
- self._creds[six.text_type(roles).encode('utf-8')] = net_creds
+ self._creds[str(roles).encode('utf-8')] = net_creds
return net_creds
def clear_creds(self):
for creds in self._creds.values():
self.remove_credentials(creds)
+ # TODO(gmann): Remove this method in favor of get_project_admin_creds()
+ # after the deprecation phase.
def get_admin_creds(self):
return self.get_creds_by_roles([self.admin_role])
diff --git a/tempest/lib/common/rest_client.py b/tempest/lib/common/rest_client.py
index a987e03..00f2aeb 100644
--- a/tempest/lib/common/rest_client.py
+++ b/tempest/lib/common/rest_client.py
@@ -18,13 +18,13 @@
import email.utils
import re
import time
+import urllib
import jsonschema
from oslo_log import log as logging
from oslo_log import versionutils
from oslo_serialization import jsonutils as json
import six
-from six.moves import urllib
from tempest.lib.common import http
from tempest.lib.common import jsonschema_validator
@@ -418,7 +418,7 @@
def _safe_body(self, body, maxlen=4096):
# convert a structure into a string safely
try:
- text = six.text_type(body)
+ text = str(body)
except UnicodeDecodeError:
# if this isn't actually text, return marker that
return "<BinaryData: removed>"
@@ -890,7 +890,7 @@
return True
return 'exceed' in resp_body.get('message', 'blabla')
- def wait_for_resource_deletion(self, id):
+ def wait_for_resource_deletion(self, id, *args, **kwargs):
"""Waits for a resource to be deleted
This method will loop over is_resource_deleted until either
@@ -903,7 +903,7 @@
"""
start_time = int(time.time())
while True:
- if self.is_resource_deleted(id):
+ if self.is_resource_deleted(id, *args, **kwargs):
return
if int(time.time()) - start_time >= self.build_timeout:
message = ('Failed to delete %(resource_type)s %(id)s within '
diff --git a/tempest/lib/common/ssh.py b/tempest/lib/common/ssh.py
index 3a05f27..60107d7 100644
--- a/tempest/lib/common/ssh.py
+++ b/tempest/lib/common/ssh.py
@@ -14,6 +14,7 @@
# under the License.
+import io
import select
import socket
import time
@@ -67,7 +68,7 @@
self.password = password
if isinstance(pkey, six.string_types):
pkey = paramiko.RSAKey.from_private_key(
- six.StringIO(str(pkey)))
+ io.StringIO(str(pkey)))
self.pkey = pkey
self.look_for_keys = look_for_keys
self.key_filename = key_filename
diff --git a/tempest/lib/services/compute/agents_client.py b/tempest/lib/services/compute/agents_client.py
index 12b3900..bd973dd 100644
--- a/tempest/lib/services/compute/agents_client.py
+++ b/tempest/lib/services/compute/agents_client.py
@@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import agents as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/compute/baremetal_nodes_client.py b/tempest/lib/services/compute/baremetal_nodes_client.py
index 3efdbce..83af451 100644
--- a/tempest/lib/services/compute/baremetal_nodes_client.py
+++ b/tempest/lib/services/compute/baremetal_nodes_client.py
@@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import baremetal_nodes \
as schema
diff --git a/tempest/lib/services/compute/flavors_client.py b/tempest/lib/services/compute/flavors_client.py
index e22b5b2..5282405 100644
--- a/tempest/lib/services/compute/flavors_client.py
+++ b/tempest/lib/services/compute/flavors_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import flavors as schema
from tempest.lib.api_schema.response.compute.v2_1 import flavors_access \
diff --git a/tempest/lib/services/compute/floating_ip_pools_client.py b/tempest/lib/services/compute/floating_ip_pools_client.py
index d3af050..aa065b8 100644
--- a/tempest/lib/services/compute/floating_ip_pools_client.py
+++ b/tempest/lib/services/compute/floating_ip_pools_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import floating_ips as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/compute/floating_ips_client.py b/tempest/lib/services/compute/floating_ips_client.py
index d7a1a9b..e6b6916 100644
--- a/tempest/lib/services/compute/floating_ips_client.py
+++ b/tempest/lib/services/compute/floating_ips_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import floating_ips as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/compute/hosts_client.py b/tempest/lib/services/compute/hosts_client.py
index 743b4ec..bbecc3b 100644
--- a/tempest/lib/services/compute/hosts_client.py
+++ b/tempest/lib/services/compute/hosts_client.py
@@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import hosts as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/compute/images_client.py b/tempest/lib/services/compute/images_client.py
index b252ee9..b6d8d30 100644
--- a/tempest/lib/services/compute/images_client.py
+++ b/tempest/lib/services/compute/images_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import images as schema
from tempest.lib.api_schema.response.compute.v2_45 import images as schemav245
diff --git a/tempest/lib/services/compute/keypairs_client.py b/tempest/lib/services/compute/keypairs_client.py
index 47cf2d0..9d7b7fc 100644
--- a/tempest/lib/services/compute/keypairs_client.py
+++ b/tempest/lib/services/compute/keypairs_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import keypairs as schemav21
from tempest.lib.api_schema.response.compute.v2_2 import keypairs as schemav22
diff --git a/tempest/lib/services/compute/migrations_client.py b/tempest/lib/services/compute/migrations_client.py
index 812dc96..8a6e62a 100644
--- a/tempest/lib/services/compute/migrations_client.py
+++ b/tempest/lib/services/compute/migrations_client.py
@@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import migrations as schema
from tempest.lib.api_schema.response.compute.v2_23 import migrations \
diff --git a/tempest/lib/services/compute/quotas_client.py b/tempest/lib/services/compute/quotas_client.py
index 12e865e..dd796aa 100644
--- a/tempest/lib/services/compute/quotas_client.py
+++ b/tempest/lib/services/compute/quotas_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import quotas as schema
from tempest.lib.api_schema.response.compute.v2_36 import quotas as schemav236
diff --git a/tempest/lib/services/compute/security_groups_client.py b/tempest/lib/services/compute/security_groups_client.py
index 9493144..0bba990 100644
--- a/tempest/lib/services/compute/security_groups_client.py
+++ b/tempest/lib/services/compute/security_groups_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import \
security_groups as schema
diff --git a/tempest/lib/services/compute/servers_client.py b/tempest/lib/services/compute/servers_client.py
index e82b58f..c36f80a 100644
--- a/tempest/lib/services/compute/servers_client.py
+++ b/tempest/lib/services/compute/servers_client.py
@@ -16,9 +16,9 @@
# under the License.
import copy
+from urllib import parse as urllib
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import \
security_groups as security_groups_schema
diff --git a/tempest/lib/services/compute/services_client.py b/tempest/lib/services/compute/services_client.py
index 4e3383f..7d9f3e2 100644
--- a/tempest/lib/services/compute/services_client.py
+++ b/tempest/lib/services/compute/services_client.py
@@ -14,8 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import services as schema
from tempest.lib.api_schema.response.compute.v2_11 import services \
diff --git a/tempest/lib/services/compute/snapshots_client.py b/tempest/lib/services/compute/snapshots_client.py
index 225eb8d..2e6f7cf 100644
--- a/tempest/lib/services/compute/snapshots_client.py
+++ b/tempest/lib/services/compute/snapshots_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import snapshots as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/compute/tenant_usages_client.py b/tempest/lib/services/compute/tenant_usages_client.py
index a34730c..b47d917 100644
--- a/tempest/lib/services/compute/tenant_usages_client.py
+++ b/tempest/lib/services/compute/tenant_usages_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import tenant_usages
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/compute/volumes_client.py b/tempest/lib/services/compute/volumes_client.py
index 11282ee..52172ed 100644
--- a/tempest/lib/services/compute/volumes_client.py
+++ b/tempest/lib/services/compute/volumes_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.compute.v2_1 import volumes as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v2/identity_client.py b/tempest/lib/services/identity/v2/identity_client.py
index d7526f3..6239ba6 100644
--- a/tempest/lib/services/identity/v2/identity_client.py
+++ b/tempest/lib/services/identity/v2/identity_client.py
@@ -10,8 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v2/roles_client.py b/tempest/lib/services/identity/v2/roles_client.py
index a133fc3..1580c33 100644
--- a/tempest/lib/services/identity/v2/roles_client.py
+++ b/tempest/lib/services/identity/v2/roles_client.py
@@ -10,8 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v2/services_client.py b/tempest/lib/services/identity/v2/services_client.py
index fc51cb4..2a0e5ca 100644
--- a/tempest/lib/services/identity/v2/services_client.py
+++ b/tempest/lib/services/identity/v2/services_client.py
@@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v2/tenants_client.py b/tempest/lib/services/identity/v2/tenants_client.py
index 09618ad..3435835 100644
--- a/tempest/lib/services/identity/v2/tenants_client.py
+++ b/tempest/lib/services/identity/v2/tenants_client.py
@@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v2/users_client.py b/tempest/lib/services/identity/v2/users_client.py
index 72f29be..c3217c9 100644
--- a/tempest/lib/services/identity/v2/users_client.py
+++ b/tempest/lib/services/identity/v2/users_client.py
@@ -10,8 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/access_rules_client.py b/tempest/lib/services/identity/v3/access_rules_client.py
index 4f13e47..c3be5df 100644
--- a/tempest/lib/services/identity/v3/access_rules_client.py
+++ b/tempest/lib/services/identity/v3/access_rules_client.py
@@ -18,8 +18,9 @@
https://docs.openstack.org/api-ref/identity/v3/index.html#application-credentials
"""
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/application_credentials_client.py b/tempest/lib/services/identity/v3/application_credentials_client.py
index be2e172..e7f3ac2 100644
--- a/tempest/lib/services/identity/v3/application_credentials_client.py
+++ b/tempest/lib/services/identity/v3/application_credentials_client.py
@@ -18,8 +18,9 @@
https://docs.openstack.org/api-ref/identity/v3/index.html#application-credentials
"""
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/credentials_client.py b/tempest/lib/services/identity/v3/credentials_client.py
index 3f4b40e..27f6156 100644
--- a/tempest/lib/services/identity/v3/credentials_client.py
+++ b/tempest/lib/services/identity/v3/credentials_client.py
@@ -17,8 +17,9 @@
https://docs.openstack.org/api-ref/identity/v3/index.html#credentials
"""
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/domains_client.py b/tempest/lib/services/identity/v3/domains_client.py
index bd32cfc..c1d1980 100644
--- a/tempest/lib/services/identity/v3/domains_client.py
+++ b/tempest/lib/services/identity/v3/domains_client.py
@@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/endpoints_client.py b/tempest/lib/services/identity/v3/endpoints_client.py
index 236b34c..de85388 100644
--- a/tempest/lib/services/identity/v3/endpoints_client.py
+++ b/tempest/lib/services/identity/v3/endpoints_client.py
@@ -17,8 +17,9 @@
https://docs.openstack.org/api-ref/identity/v3/index.html#service-catalog-and-endpoints
"""
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/groups_client.py b/tempest/lib/services/identity/v3/groups_client.py
index 2cfb24a..6f82067 100644
--- a/tempest/lib/services/identity/v3/groups_client.py
+++ b/tempest/lib/services/identity/v3/groups_client.py
@@ -17,8 +17,9 @@
https://docs.openstack.org/api-ref/identity/v3/index.html#groups
"""
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/oauth_token_client.py b/tempest/lib/services/identity/v3/oauth_token_client.py
index 722deca..236b224 100644
--- a/tempest/lib/services/identity/v3/oauth_token_client.py
+++ b/tempest/lib/services/identity/v3/oauth_token_client.py
@@ -18,9 +18,9 @@
import hmac
import random
import time
+from urllib import parse as urlparse
import six
-from six.moves.urllib import parse as urlparse
from oslo_serialization import jsonutils as json
@@ -33,7 +33,7 @@
def _escape(self, s):
"""Escape a unicode string in an OAuth-compatible fashion."""
safe = b'~'
- s = s.encode('utf-8') if isinstance(s, six.text_type) else s
+ s = s.encode('utf-8') if isinstance(s, str) else s
s = urlparse.quote(s, safe)
if isinstance(s, six.binary_type):
s = s.decode('utf-8')
@@ -47,8 +47,8 @@
verifier=None,
http_method='GET'):
"""Generate OAUTH params along with signature."""
- timestamp = six.text_type(int(time.time()))
- nonce = six.text_type(random.getrandbits(64)) + timestamp
+ timestamp = str(int(time.time()))
+ nonce = str(random.getrandbits(64)) + timestamp
oauth_params = [
('oauth_nonce', nonce),
('oauth_timestamp', timestamp),
diff --git a/tempest/lib/services/identity/v3/projects_client.py b/tempest/lib/services/identity/v3/projects_client.py
index b186fba..fffbe7a 100644
--- a/tempest/lib/services/identity/v3/projects_client.py
+++ b/tempest/lib/services/identity/v3/projects_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/regions_client.py b/tempest/lib/services/identity/v3/regions_client.py
index a598c9c..3aed5b8 100644
--- a/tempest/lib/services/identity/v3/regions_client.py
+++ b/tempest/lib/services/identity/v3/regions_client.py
@@ -17,8 +17,9 @@
https://docs.openstack.org/api-ref/identity/v3/index.html#regions
"""
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/role_assignments_client.py b/tempest/lib/services/identity/v3/role_assignments_client.py
index 51ee8f6..f615709 100644
--- a/tempest/lib/services/identity/v3/role_assignments_client.py
+++ b/tempest/lib/services/identity/v3/role_assignments_client.py
@@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/roles_client.py b/tempest/lib/services/identity/v3/roles_client.py
index e41dc28..4836784 100644
--- a/tempest/lib/services/identity/v3/roles_client.py
+++ b/tempest/lib/services/identity/v3/roles_client.py
@@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/services_client.py b/tempest/lib/services/identity/v3/services_client.py
index eb961a5..994df2f 100644
--- a/tempest/lib/services/identity/v3/services_client.py
+++ b/tempest/lib/services/identity/v3/services_client.py
@@ -17,8 +17,9 @@
https://docs.openstack.org/api-ref/identity/v3/index.html#service-catalog-and-endpoints
"""
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/trusts_client.py b/tempest/lib/services/identity/v3/trusts_client.py
index f1cc806..48a7956 100644
--- a/tempest/lib/services/identity/v3/trusts_client.py
+++ b/tempest/lib/services/identity/v3/trusts_client.py
@@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/identity/v3/users_client.py b/tempest/lib/services/identity/v3/users_client.py
index bba02a4..771ffea 100644
--- a/tempest/lib/services/identity/v3/users_client.py
+++ b/tempest/lib/services/identity/v3/users_client.py
@@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/image/v1/images_client.py b/tempest/lib/services/image/v1/images_client.py
index 0e76a63..c9a4a94 100644
--- a/tempest/lib/services/image/v1/images_client.py
+++ b/tempest/lib/services/image/v1/images_client.py
@@ -14,9 +14,9 @@
# under the License.
import functools
+from urllib import parse as urllib
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
diff --git a/tempest/lib/services/image/v2/images_client.py b/tempest/lib/services/image/v2/images_client.py
index 4713cce..fa3bb8c 100644
--- a/tempest/lib/services/image/v2/images_client.py
+++ b/tempest/lib/services/image/v2/images_client.py
@@ -14,9 +14,9 @@
# under the License.
import functools
+from urllib import parse as urllib
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
diff --git a/tempest/lib/services/image/v2/namespace_objects_client.py b/tempest/lib/services/image/v2/namespace_objects_client.py
index 0cae816..32f5a2c 100644
--- a/tempest/lib/services/image/v2/namespace_objects_client.py
+++ b/tempest/lib/services/image/v2/namespace_objects_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/image/v2/namespace_tags_client.py b/tempest/lib/services/image/v2/namespace_tags_client.py
index 4315f16..5bca229 100644
--- a/tempest/lib/services/image/v2/namespace_tags_client.py
+++ b/tempest/lib/services/image/v2/namespace_tags_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/network/base.py b/tempest/lib/services/network/base.py
index fe8b244..ee87dd4 100644
--- a/tempest/lib/services/network/base.py
+++ b/tempest/lib/services/network/base.py
@@ -10,8 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/object_storage/account_client.py b/tempest/lib/services/object_storage/account_client.py
index 8c15a88..52b2534 100644
--- a/tempest/lib/services/object_storage/account_client.py
+++ b/tempest/lib/services/object_storage/account_client.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
from xml.etree import ElementTree as etree
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/object_storage/container_client.py b/tempest/lib/services/object_storage/container_client.py
index 027fb1f..6d07ec1 100644
--- a/tempest/lib/services/object_storage/container_client.py
+++ b/tempest/lib/services/object_storage/container_client.py
@@ -13,17 +13,25 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
from xml.etree import ElementTree as etree
import debtcollector.moves
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
+from tempest.lib import exceptions
class ContainerClient(rest_client.RestClient):
+ def is_resource_deleted(self, container):
+ try:
+ self.list_container_metadata(container)
+ except exceptions.NotFound:
+ return True
+ return False
+
def update_container(self, container_name, **headers):
"""Creates or Updates a container
diff --git a/tempest/lib/services/object_storage/object_client.py b/tempest/lib/services/object_storage/object_client.py
index 1d38153..bb82975 100644
--- a/tempest/lib/services/object_storage/object_client.py
+++ b/tempest/lib/services/object_storage/object_client.py
@@ -14,8 +14,8 @@
# under the License.
import ssl
-from six.moves import http_client as httplib
-from six.moves.urllib import parse as urlparse
+from http import client as httplib
+from urllib import parse as urlparse
from tempest.lib.common import rest_client
from tempest.lib import exceptions
@@ -23,6 +23,13 @@
class ObjectClient(rest_client.RestClient):
+ def is_resource_deleted(self, object_name, container):
+ try:
+ self.get_object(container, object_name)
+ except exceptions.NotFound:
+ return True
+ return False
+
def create_object(self, container, object_name, data,
params=None, metadata=None, headers=None,
chunked=False):
diff --git a/tempest/lib/services/placement/placement_client.py b/tempest/lib/services/placement/placement_client.py
index b8e91b8..216ac08 100644
--- a/tempest/lib/services/placement/placement_client.py
+++ b/tempest/lib/services/placement/placement_client.py
@@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
from tempest.lib.services.placement import base_placement_client
diff --git a/tempest/lib/services/placement/resource_providers_client.py b/tempest/lib/services/placement/resource_providers_client.py
index 56f6409..e6fbcb2 100644
--- a/tempest/lib/services/placement/resource_providers_client.py
+++ b/tempest/lib/services/placement/resource_providers_client.py
@@ -10,8 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
from tempest.lib.services.placement import base_placement_client
@@ -80,3 +81,29 @@
self.expected_success(200, resp.status)
body = json.loads(body)
return rest_client.ResponseBody(resp, body)
+
+ def update_resource_providers_inventories(self, rp_uuid, **kwargs):
+ """Update resource providers inventories.
+
+ For full list of available parameters, please refer to the official
+ API reference:
+ https://docs.openstack.org/api-ref/placement/#update-resource-provider-inventories
+ """
+ url = '/resource_providers/{}/inventories'.format(rp_uuid)
+ data = json.dumps(kwargs)
+ resp, body = self.put(url, data)
+ self.expected_success(200, resp.status)
+ body = json.loads(body)
+ return rest_client.ResponseBody(resp, body)
+
+ def delete_resource_providers_inventories(self, rp_uuid):
+ """Delete resource providers inventories.
+
+ For full list of available parameters, please refer to the official
+ API reference:
+ https://docs.openstack.org/api-ref/placement/#delete-resource-provider-inventories
+ """
+ url = '/resource_providers/{}/inventories'.format(rp_uuid)
+ resp, body = self.delete(url)
+ self.expected_success(204, resp.status)
+ return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/hosts_client.py b/tempest/lib/services/volume/v1/hosts_client.py
index f344678..2e94274 100644
--- a/tempest/lib/services/volume/v1/hosts_client.py
+++ b/tempest/lib/services/volume/v1/hosts_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v1/quotas_client.py b/tempest/lib/services/volume/v1/quotas_client.py
index 7f191ca..d7c9698 100644
--- a/tempest/lib/services/volume/v1/quotas_client.py
+++ b/tempest/lib/services/volume/v1/quotas_client.py
@@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v1/services_client.py b/tempest/lib/services/volume/v1/services_client.py
index d438a34..957a0e6 100644
--- a/tempest/lib/services/volume/v1/services_client.py
+++ b/tempest/lib/services/volume/v1/services_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v1/snapshots_client.py b/tempest/lib/services/volume/v1/snapshots_client.py
index 7dfdcf2..a478686 100644
--- a/tempest/lib/services/volume/v1/snapshots_client.py
+++ b/tempest/lib/services/volume/v1/snapshots_client.py
@@ -10,8 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
diff --git a/tempest/lib/services/volume/v1/types_client.py b/tempest/lib/services/volume/v1/types_client.py
index d434e65..6237fb4 100644
--- a/tempest/lib/services/volume/v1/types_client.py
+++ b/tempest/lib/services/volume/v1/types_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
diff --git a/tempest/lib/services/volume/v1/volumes_client.py b/tempest/lib/services/volume/v1/volumes_client.py
index 2efb0da..9fca800 100644
--- a/tempest/lib/services/volume/v1/volumes_client.py
+++ b/tempest/lib/services/volume/v1/volumes_client.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
import six
-from six.moves.urllib import parse as urllib
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
diff --git a/tempest/lib/services/volume/v3/backups_client.py b/tempest/lib/services/volume/v3/backups_client.py
index 1df45fa..4bf7ffb 100644
--- a/tempest/lib/services/volume/v3/backups_client.py
+++ b/tempest/lib/services/volume/v3/backups_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import backups as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v3/group_snapshots_client.py b/tempest/lib/services/volume/v3/group_snapshots_client.py
index 4051c06..0f36fc9 100644
--- a/tempest/lib/services/volume/v3/group_snapshots_client.py
+++ b/tempest/lib/services/volume/v3/group_snapshots_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import group_snapshots as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v3/group_types_client.py b/tempest/lib/services/volume/v3/group_types_client.py
index 1dcd508..9de36f4 100644
--- a/tempest/lib/services/volume/v3/group_types_client.py
+++ b/tempest/lib/services/volume/v3/group_types_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import group_types as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v3/groups_client.py b/tempest/lib/services/volume/v3/groups_client.py
index 3d8523d..d1500cf 100644
--- a/tempest/lib/services/volume/v3/groups_client.py
+++ b/tempest/lib/services/volume/v3/groups_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import groups as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v3/hosts_client.py b/tempest/lib/services/volume/v3/hosts_client.py
index 019a852..9c64659 100644
--- a/tempest/lib/services/volume/v3/hosts_client.py
+++ b/tempest/lib/services/volume/v3/hosts_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import hosts as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v3/quotas_client.py b/tempest/lib/services/volume/v3/quotas_client.py
index 5b1a52c..3f4c4e1 100644
--- a/tempest/lib/services/volume/v3/quotas_client.py
+++ b/tempest/lib/services/volume/v3/quotas_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import quotas as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v3/services_client.py b/tempest/lib/services/volume/v3/services_client.py
index 8bc82c9..4672da8 100644
--- a/tempest/lib/services/volume/v3/services_client.py
+++ b/tempest/lib/services/volume/v3/services_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import services as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v3/snapshots_client.py b/tempest/lib/services/volume/v3/snapshots_client.py
index 8ca2044..ae31ee9 100644
--- a/tempest/lib/services/volume/v3/snapshots_client.py
+++ b/tempest/lib/services/volume/v3/snapshots_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import snapshots as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v3/transfers_client.py b/tempest/lib/services/volume/v3/transfers_client.py
index f572f95..36198c3 100644
--- a/tempest/lib/services/volume/v3/transfers_client.py
+++ b/tempest/lib/services/volume/v3/transfers_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import transfers as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v3/types_client.py b/tempest/lib/services/volume/v3/types_client.py
index 1ebd447..9858d87 100644
--- a/tempest/lib/services/volume/v3/types_client.py
+++ b/tempest/lib/services/volume/v3/types_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import volume_types as schema
from tempest.lib.common import rest_client
diff --git a/tempest/lib/services/volume/v3/versions_client.py b/tempest/lib/services/volume/v3/versions_client.py
index 4ac4112..0bed827 100644
--- a/tempest/lib/services/volume/v3/versions_client.py
+++ b/tempest/lib/services/volume/v3/versions_client.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from six.moves.urllib.parse import urljoin
+from urllib.parse import urljoin
from oslo_serialization import jsonutils as json
diff --git a/tempest/lib/services/volume/v3/volumes_client.py b/tempest/lib/services/volume/v3/volumes_client.py
index b8535d8..147a79b 100644
--- a/tempest/lib/services/volume/v3/volumes_client.py
+++ b/tempest/lib/services/volume/v3/volumes_client.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse as urllib
+
from oslo_serialization import jsonutils as json
import six
-from six.moves.urllib import parse as urllib
from tempest.lib.api_schema.response.volume import volumes as schema
from tempest.lib.common import rest_client
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 86e84fe..428f53d 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -486,7 +486,7 @@
snapshot['id'])['snapshot']
return snapshot
- def _cleanup_volume_type(self, volume_type):
+ def cleanup_volume_type(self, volume_type):
"""Clean up a given volume type.
Ensuring all volumes associated to a type are first removed before
@@ -542,7 +542,7 @@
volume_type = volume_type_resp['volume_type']
self.assertIn('id', volume_type)
- self.addCleanup(self._cleanup_volume_type, volume_type)
+ self.addCleanup(self.cleanup_volume_type, volume_type)
return volume_type
def create_loginable_secgroup_rule(self, secgroup_id=None, rulesets=None):
diff --git a/tempest/services/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py
index 9fec548..0d7720e 100644
--- a/tempest/services/orchestration/json/orchestration_client.py
+++ b/tempest/services/orchestration/json/orchestration_client.py
@@ -15,9 +15,9 @@
import re
import time
+from urllib import parse as urllib
from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
from tempest import exceptions
from tempest.lib.common import rest_client
diff --git a/tempest/test_discover/plugins.py b/tempest/test_discover/plugins.py
index b20b60e..1d69d9d 100644
--- a/tempest/test_discover/plugins.py
+++ b/tempest/test_discover/plugins.py
@@ -15,7 +15,6 @@
import abc
from oslo_log import log as logging
-import six
import stevedore
from tempest.lib.common.utils import misc
@@ -24,8 +23,7 @@
LOG = logging.getLogger(__name__)
-@six.add_metaclass(abc.ABCMeta)
-class TempestPlugin(object):
+class TempestPlugin(object, metaclass=abc.ABCMeta):
"""Provide basic hooks for an external plugin
To provide tempest the necessary information to run the plugin.
diff --git a/tempest/tests/api/compute/test_base.py b/tempest/tests/api/compute/test_base.py
index 74d2625..8a1873b 100644
--- a/tempest/tests/api/compute/test_base.py
+++ b/tempest/tests/api/compute/test_base.py
@@ -15,7 +15,6 @@
from unittest import mock
from oslo_utils import uuidutils
-import six
from tempest.api.compute import base as compute_base
from tempest.common import waiters
@@ -128,9 +127,9 @@
mock.sentinel.server_id, wait_until='active')
# make our assertions
if fault:
- self.assertIn(fault, six.text_type(ex))
+ self.assertIn(fault, str(ex))
else:
- self.assertNotIn(fault, six.text_type(ex))
+ self.assertNotIn(fault, str(ex))
if compute_base.BaseV2ComputeTest.is_requested_microversion_compatible(
'2.35'):
status = 'ACTIVE'
diff --git a/tempest/tests/cmd/test_run.py b/tempest/tests/cmd/test_run.py
index ec7b760..3b5e901 100644
--- a/tempest/tests/cmd/test_run.py
+++ b/tempest/tests/cmd/test_run.py
@@ -21,7 +21,6 @@
from unittest import mock
import fixtures
-import six
from tempest.cmd import run
from tempest.cmd import workspace
@@ -153,12 +152,12 @@
subprocess.call(['stestr', 'init'])
out, err = self.assertRunExit(['tempest', 'run', '-l'], 0)
tests = out.split()
- tests = sorted([six.text_type(x.rstrip()) for x in tests if x])
+ tests = sorted([str(x.rstrip()) for x in tests if x])
result = [
- six.text_type('tests.test_failing.FakeTestClass.test_pass'),
- six.text_type('tests.test_failing.FakeTestClass.test_pass_list'),
- six.text_type('tests.test_passing.FakeTestClass.test_pass'),
- six.text_type('tests.test_passing.FakeTestClass.test_pass_list'),
+ str('tests.test_failing.FakeTestClass.test_pass'),
+ str('tests.test_failing.FakeTestClass.test_pass_list'),
+ str('tests.test_passing.FakeTestClass.test_pass'),
+ str('tests.test_passing.FakeTestClass.test_pass_list'),
]
# NOTE(mtreinish): on python 3 the subprocess prints b'' around
# stdout.
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index 277e049..e19efb7 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -97,15 +97,15 @@
self.useFixture(fixtures.MockPatchObject(
verify_tempest_config, '_get_unversioned_endpoint',
return_value='http://fake_endpoint:5000'))
- fake_resp = {'versions': [{'id': 'v1.0'}, {'id': 'v2.0'}]}
+ fake_resp = {'versions': [{'id': 'v2.0'}, {'id': 'v3.0'}]}
fake_resp = json.dumps(fake_resp)
self.useFixture(fixtures.MockPatch(
'tempest.lib.common.http.ClosingHttp.request',
return_value=(None, fake_resp)))
fake_os = mock.MagicMock()
versions = verify_tempest_config._get_api_versions(fake_os, 'cinder')
- self.assertIn('v1.0', versions)
self.assertIn('v2.0', versions)
+ self.assertIn('v3.0', versions)
def test_get_nova_versions(self):
self.useFixture(fixtures.MockPatchObject(
@@ -145,7 +145,7 @@
self.assertTrue(mock_log_error.called)
def test_verify_api_versions(self):
- api_services = ['cinder', 'glance', 'keystone']
+ api_services = ['glance', 'keystone']
fake_os = mock.MagicMock()
for svc in api_services:
m = 'verify_%s_api_versions' % svc
@@ -154,7 +154,7 @@
verify_mock.assert_called_once_with(fake_os, True)
def test_verify_api_versions_not_implemented(self):
- api_services = ['cinder', 'glance', 'keystone']
+ api_services = ['glance', 'keystone']
fake_os = mock.MagicMock()
for svc in api_services:
m = 'verify_%s_api_versions' % svc
@@ -178,52 +178,6 @@
'identity-feature-enabled',
False, True)
- @mock.patch('tempest.lib.common.http.ClosingHttp.request')
- def test_verify_cinder_api_versions_no_v3(self, mock_request):
- self.useFixture(fixtures.MockPatchObject(
- verify_tempest_config, '_get_unversioned_endpoint',
- return_value='http://fake_endpoint:5000'))
- fake_resp = {'versions': [{'id': 'v2.0'}]}
- fake_resp = json.dumps(fake_resp)
- mock_request.return_value = (None, fake_resp)
- fake_os = mock.MagicMock()
- with mock.patch.object(verify_tempest_config,
- 'print_and_or_update') as print_mock:
- verify_tempest_config.verify_cinder_api_versions(fake_os, True)
- print_mock.assert_any_call('api_v3', 'volume-feature-enabled',
- False, True)
- self.assertEqual(1, print_mock.call_count)
-
- @mock.patch('tempest.lib.common.http.ClosingHttp.request')
- def test_verify_cinder_api_versions_no_v2(self, mock_request):
- self.useFixture(fixtures.MockPatchObject(
- verify_tempest_config, '_get_unversioned_endpoint',
- return_value='http://fake_endpoint:5000'))
- fake_resp = {'versions': [{'id': 'v3.0'}]}
- fake_resp = json.dumps(fake_resp)
- mock_request.return_value = (None, fake_resp)
- fake_os = mock.MagicMock()
- with mock.patch.object(verify_tempest_config,
- 'print_and_or_update') as print_mock:
- verify_tempest_config.verify_cinder_api_versions(fake_os, True)
- print_mock.assert_any_call('api_v2', 'volume-feature-enabled',
- False, True)
- self.assertEqual(1, print_mock.call_count)
-
- @mock.patch('tempest.lib.common.http.ClosingHttp.request')
- def test_verify_cinder_api_versions_no_v1(self, mock_request):
- self.useFixture(fixtures.MockPatchObject(
- verify_tempest_config, '_get_unversioned_endpoint',
- return_value='http://fake_endpoint:5000'))
- fake_resp = {'versions': [{'id': 'v2.0'}, {'id': 'v3.0'}]}
- fake_resp = json.dumps(fake_resp)
- mock_request.return_value = (None, fake_resp)
- fake_os = mock.MagicMock()
- with mock.patch.object(verify_tempest_config,
- 'print_and_or_update') as print_mock:
- verify_tempest_config.verify_cinder_api_versions(fake_os, True)
- print_mock.assert_not_called()
-
def test_verify_glance_version_no_v2_with_v1_1(self):
# This test verifies that wrong config api_v2 = True is detected
class FakeClient(object):
diff --git a/tempest/tests/cmd/test_workspace.py b/tempest/tests/cmd/test_workspace.py
index eae6202..f16d533 100644
--- a/tempest/tests/cmd/test_workspace.py
+++ b/tempest/tests/cmd/test_workspace.py
@@ -12,15 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+from io import StringIO
import os
import shutil
import subprocess
import tempfile
from unittest.mock import patch
-try:
- from StringIO import StringIO
-except ImportError:
- from io import StringIO
from tempest.cmd import workspace
from tempest.lib.common.utils import data_utils
diff --git a/tempest/tests/common/test_compute.py b/tempest/tests/common/test_compute.py
index 45a439c..142bb08 100644
--- a/tempest/tests/common/test_compute.py
+++ b/tempest/tests/common/test_compute.py
@@ -15,7 +15,7 @@
from unittest import mock
-from six.moves.urllib import parse as urlparse
+from urllib import parse as urlparse
from tempest.common import compute
diff --git a/tempest/tests/lib/common/test_api_version_utils.py b/tempest/tests/lib/common/test_api_version_utils.py
index b99e8d4..8d5de09 100644
--- a/tempest/tests/lib/common/test_api_version_utils.py
+++ b/tempest/tests/lib/common/test_api_version_utils.py
@@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
import testtools
from tempest.lib.common import api_version_utils
@@ -31,7 +30,7 @@
cfg_max_version)
except testtools.TestCase.skipException as e:
if not expected_skip:
- raise testtools.TestCase.failureException(six.text_type(e))
+ raise testtools.TestCase.failureException(str(e))
def test_version_min_in_range(self):
self._test_version('2.2', '2.10', '2.1', '2.7')
diff --git a/tempest/tests/lib/common/test_preprov_creds.py b/tempest/tests/lib/common/test_preprov_creds.py
index 579363e..499b6fe 100644
--- a/tempest/tests/lib/common/test_preprov_creds.py
+++ b/tempest/tests/lib/common/test_preprov_creds.py
@@ -17,7 +17,6 @@
import shutil
from unittest import mock
-import six
import testtools
import fixtures
@@ -109,7 +108,7 @@
hash = hashlib.md5()
account_for_hash = dict((k, v) for (k, v) in account.items()
if k in hash_fields)
- hash.update(six.text_type(account_for_hash).encode('utf-8'))
+ hash.update(str(account_for_hash).encode('utf-8'))
temp_hash = hash.hexdigest()
hash_list.append(temp_hash)
return hash_list
diff --git a/tempest/tests/lib/services/image/v2/test_images_client.py b/tempest/tests/lib/services/image/v2/test_images_client.py
index fe671bd..7ee61d2 100644
--- a/tempest/tests/lib/services/image/v2/test_images_client.py
+++ b/tempest/tests/lib/services/image/v2/test_images_client.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
+import io
from tempest.lib.common.utils import data_utils
from tempest.lib.services.image.v2 import images_client
@@ -178,7 +178,7 @@
{}, image_id="e485aab9-0907-4973-921c-bb6da8a8fcf8", status=204)
def test_store_image_file(self):
- data = six.BytesIO(data_utils.random_bytes())
+ data = io.BytesIO(data_utils.random_bytes())
self.check_service_client_function(
self.client.store_image_file,
diff --git a/tempest/tests/lib/services/placement/test_resource_providers_client.py b/tempest/tests/lib/services/placement/test_resource_providers_client.py
index 11aeaf2..485f584 100644
--- a/tempest/tests/lib/services/placement/test_resource_providers_client.py
+++ b/tempest/tests/lib/services/placement/test_resource_providers_client.py
@@ -48,6 +48,43 @@
FAKE_RESOURCE_PROVIDER_AGGREGATES = {
'aggregates': [FAKE_AGGREGATE_UUID]
}
+ FAKE_RESOURCE_UPDATE_INVENTORIES_RESPONSE = {
+ "inventories": {
+ "MEMORY_MB": {
+ "allocation_ratio": 2.0,
+ "max_unit": 16,
+ "min_unit": 1,
+ "reserved": 0,
+ "step_size": 4,
+ "total": 128
+ },
+ "VCPU": {
+ "allocation_ratio": 10.0,
+ "max_unit": 2147483647,
+ "min_unit": 1,
+ "reserved": 2,
+ "step_size": 1,
+ "total": 64
+ }
+ },
+ "resource_provider_generation": 2
+ }
+ FAKE_RESOURCE_UPDATE_INVENTORIES_REQUEST = {
+ "inventories": {
+ "MEMORY_MB": {
+ "allocation_ratio": 2.0,
+ "max_unit": 16,
+ "step_size": 4,
+ "total": 128
+ },
+ "VCPU": {
+ "allocation_ratio": 10.0,
+ "reserved": 2,
+ "total": 64
+ }
+ },
+ "resource_provider_generation": 1
+ }
def setUp(self):
super(TestResourceProvidersClient, self).setUp()
@@ -102,6 +139,32 @@
def test_list_resource_provider_inventories_with_bytes_body(self):
self._test_list_resource_provider_inventories(bytes_body=True)
+ def _test_update_resource_providers_inventories(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_resource_providers_inventories,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_RESOURCE_UPDATE_INVENTORIES_RESPONSE,
+ to_utf=bytes_body,
+ status=200,
+ rp_uuid=self.FAKE_RESOURCE_PROVIDER_UUID,
+ **self.FAKE_RESOURCE_UPDATE_INVENTORIES_REQUEST
+ )
+
+ def test_update_resource_providers_inventories_with_str_body(self):
+ self._test_update_resource_providers_inventories()
+
+ def test_update_resource_providers_inventories_with_bytes_body(self):
+ self._test_update_resource_providers_inventories(bytes_body=True)
+
+ def test_delete_resource_providers_inventories(self):
+ self.check_service_client_function(
+ self.client.delete_resource_providers_inventories,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ {},
+ status=204,
+ rp_uuid=self.FAKE_RESOURCE_PROVIDER_UUID,
+ )
+
def _test_list_resource_provider_aggregates(self, bytes_body=False):
self.check_service_client_function(
self.client.list_resource_provider_aggregates,
diff --git a/tempest/tests/lib/test_decorators.py b/tempest/tests/lib/test_decorators.py
index e3c17e8..fc93f76 100644
--- a/tempest/tests/lib/test_decorators.py
+++ b/tempest/tests/lib/test_decorators.py
@@ -16,7 +16,6 @@
import abc
from unittest import mock
-import six
import testtools
from tempest.lib import base as test
@@ -69,8 +68,7 @@
condition=True)
-@six.add_metaclass(abc.ABCMeta)
-class BaseSkipDecoratorTests(object):
+class BaseSkipDecoratorTests(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def _test_skip_helper(self, raise_exception=True, expected_to_skip=True,
diff --git a/tempest/tests/lib/test_ssh.py b/tempest/tests/lib/test_ssh.py
index 85048fb..035bdb0 100644
--- a/tempest/tests/lib/test_ssh.py
+++ b/tempest/tests/lib/test_ssh.py
@@ -12,11 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from io import StringIO
import socket
from unittest import mock
import six
-from six import StringIO
import testtools
from tempest.lib.common import ssh
@@ -30,7 +30,7 @@
SELECT_POLLIN = 1
@mock.patch('paramiko.RSAKey.from_private_key')
- @mock.patch('six.StringIO')
+ @mock.patch('io.StringIO')
def test_pkey_calls_paramiko_RSAKey(self, cs_mock, rsa_mock):
cs_mock.return_value = mock.sentinel.csio
pkey = 'mykey'
@@ -274,7 +274,7 @@
client = ssh.Client('localhost', 'root', timeout=2)
exc = self.assertRaises(exceptions.SSHExecCommandFailed,
client.exec_command, "test")
- self.assertIn('R' + self._utf8_string, six.text_type(exc))
+ self.assertIn('R' + self._utf8_string, str(exc))
def test_exec_command_no_select(self):
gsc_mock = self.patch('tempest.lib.common.ssh.Client.'
diff --git a/tempest/tests/test_list_tests.py b/tempest/tests/test_list_tests.py
index 1cc9c9a..fe44ef6 100644
--- a/tempest/tests/test_list_tests.py
+++ b/tempest/tests/test_list_tests.py
@@ -16,8 +16,6 @@
import re
import subprocess
-import six
-
from tempest.tests import base
@@ -32,7 +30,7 @@
self.assertEqual(0, p.returncode,
"test discovery failed, one or more files cause an "
"error on import %s" % ids)
- ids = six.text_type(ids).split('\n')
+ ids = str(ids).split('\n')
for test_id in ids:
if re.match(r'(\w+\.){3}\w+', test_id):
if not test_id.startswith('tempest.'):
diff --git a/tempest/tests/test_microversions.py b/tempest/tests/test_microversions.py
index ee6db71..835f51c 100644
--- a/tempest/tests/test_microversions.py
+++ b/tempest/tests/test_microversions.py
@@ -13,7 +13,6 @@
# under the License.
from oslo_config import cfg
-import six
import testtools
from tempest.api.compute import base as compute_base
@@ -75,7 +74,7 @@
self.assertRaises(testtools.TestCase.skipException,
test_class.skip_checks)
except testtools.TestCase.skipException as e:
- raise testtools.TestCase.failureException(six.text_type(e))
+ raise testtools.TestCase.failureException(str(e))
def test_config_version_none_none(self):
expected_pass_tests = [VersionTestNoneTolatest, VersionTestNoneTo2_2]
diff --git a/tools/check_logs.py b/tools/check_logs.py
index 7e191a0..cc74b17 100755
--- a/tools/check_logs.py
+++ b/tools/check_logs.py
@@ -17,12 +17,13 @@
import argparse
import gzip
+import io
import os
import re
import sys
+import urllib.request as urlreq
import six
-import six.moves.urllib.request as urlreq
import yaml
# DEVSTACK_GATE_GRENADE is either unset if grenade is not running
@@ -69,7 +70,7 @@
req = urlreq.Request(url)
req.add_header('Accept-Encoding', 'gzip')
page = urlreq.urlopen(req)
- buf = six.StringIO(page.read())
+ buf = io.StringIO(page.read())
f = gzip.GzipFile(fileobj=buf)
if scan_content(f.read().splitlines(), regexp, allow_list):
logs_with_errors.append(name)
diff --git a/zuul.d/integrated-gate.yaml b/zuul.d/integrated-gate.yaml
index 52ccd3e..0a9fb71 100644
--- a/zuul.d/integrated-gate.yaml
+++ b/zuul.d/integrated-gate.yaml
@@ -62,12 +62,16 @@
- job:
name: tempest-full-py3
parent: devstack-tempest
- # This currently works from stable/pike on.
- # Before stable/pike, legacy version of tempest-full
- # 'legacy-tempest-dsvm-neutron-full' run.
- branches: ^(?!stable/ocata).*$
+ # This job version is with swift disabled on py3
+ # as swift was not ready on py3 until stable/train.
+ branches:
+ - stable/pike
+ - stable/queens
+ - stable/rocky
+ - stable/stein
+ - stable/train
description: |
- Base integration test with Neutron networking and py3.
+ Base integration test with Neutron networking, swift disabled, and py3.
Former names for this job where:
* legacy-tempest-dsvm-py35
* gate-tempest-dsvm-py35
@@ -111,6 +115,25 @@
neutron-qos: true
- job:
+ name: tempest-full-py3
+ parent: devstack-tempest
+ # This job version is with swift enabled on py3
+ # as swift is ready on py3 from stable/ussuri onwards.
+ branches: ^(?!stable/(ocata|pike|queens|rocky|stein|train)).*$
+ description: |
+ Base integration test with Neutron networking, swift enable, and py3.
+ Former names for this job where:
+ * legacy-tempest-dsvm-py35
+ * gate-tempest-dsvm-py35
+ vars:
+ tox_envlist: full
+ devstack_localrc:
+ USE_PYTHON3: true
+ FORCE_CONFIG_DRIVE: true
+ ENABLE_VOLUME_MULTIATTACH: true
+ GLANCE_USE_IMPORT_WORKFLOW: True
+
+- job:
name: tempest-integrated-networking
parent: devstack-tempest
branches: ^(?!stable/ocata).*$
@@ -425,11 +448,9 @@
run on Nova gate only.
check:
jobs:
- - grenade
- tempest-integrated-compute
gate:
jobs:
- - grenade
- tempest-integrated-compute
- project-template: