Merge "Remove the heat tests"
diff --git a/releasenotes/notes/add-volume-backup-force-delete-af0156651a0cbf7f.yaml b/releasenotes/notes/add-volume-backup-force-delete-af0156651a0cbf7f.yaml
deleted file mode 100644
index 71bbfcb..0000000
--- a/releasenotes/notes/add-volume-backup-force-delete-af0156651a0cbf7f.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
----
-features:
- - |
- As in the [doc]:
- https://developer.openstack.org/api-ref/block-storage/v3/
- #force-delete-a-backup.
-
- * Force-deletes a backup(v2)
-
diff --git a/releasenotes/notes/deprecate-compute-images-client-in-volume-tests-92b6dd55fcaba620.yaml b/releasenotes/notes/deprecate-compute-images-client-in-volume-tests-92b6dd55fcaba620.yaml
index dc4ed27..1ae251c 100644
--- a/releasenotes/notes/deprecate-compute-images-client-in-volume-tests-92b6dd55fcaba620.yaml
+++ b/releasenotes/notes/deprecate-compute-images-client-in-volume-tests-92b6dd55fcaba620.yaml
@@ -6,5 +6,5 @@
compute_images_client and Glance v1 APIs are removed in volume tests.
upgrade:
- |
- Swith to use Glance v2 APIs in volume tests, by adding the Glance v2 client
- images_client.
+ Switch to use Glance v2 APIs in volume tests, by adding the Glance v2
+ client images_client.
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 79d03f4..902ea9a 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -59,15 +59,20 @@
msg += " for hypervisor_type %s" % CONF.compute.hypervisor_type
raise testtools.TestCase.failureException(msg)
+ def _create_test_aggregate(self, **kwargs):
+ if 'name' not in kwargs:
+ kwargs['name'] = data_utils.rand_name(self.aggregate_name_prefix)
+ aggregate = self.client.create_aggregate(**kwargs)['aggregate']
+ self.addCleanup(test_utils.call_and_ignore_notfound_exc,
+ self.client.delete_aggregate, aggregate['id'])
+ self.assertEqual(kwargs['name'], aggregate['name'])
+
+ return aggregate
+
@decorators.idempotent_id('0d148aa3-d54c-4317-aa8d-42040a475e20')
def test_aggregate_create_delete(self):
# Create and delete an aggregate.
- aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = (self.client.create_aggregate(name=aggregate_name)
- ['aggregate'])
- self.addCleanup(test_utils.call_and_ignore_notfound_exc,
- self.client.delete_aggregate, aggregate['id'])
- self.assertEqual(aggregate_name, aggregate['name'])
+ aggregate = self._create_test_aggregate()
self.assertIsNone(aggregate['availability_zone'])
self.client.delete_aggregate(aggregate['id'])
@@ -76,13 +81,8 @@
@decorators.idempotent_id('5873a6f8-671a-43ff-8838-7ce430bb6d0b')
def test_aggregate_create_delete_with_az(self):
# Create and delete an aggregate.
- aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
- aggregate = self.client.create_aggregate(
- name=aggregate_name, availability_zone=az_name)['aggregate']
- self.addCleanup(test_utils.call_and_ignore_notfound_exc,
- self.client.delete_aggregate, aggregate['id'])
- self.assertEqual(aggregate_name, aggregate['name'])
+ aggregate = self._create_test_aggregate(availability_zone=az_name)
self.assertEqual(az_name, aggregate['availability_zone'])
self.client.delete_aggregate(aggregate['id'])
@@ -91,11 +91,7 @@
@decorators.idempotent_id('68089c38-04b1-4758-bdf0-cf0daec4defd')
def test_aggregate_create_verify_entry_in_list(self):
# Create an aggregate and ensure it is listed.
- aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = (self.client.create_aggregate(name=aggregate_name)
- ['aggregate'])
- self.addCleanup(self.client.delete_aggregate, aggregate['id'])
-
+ aggregate = self._create_test_aggregate()
aggregates = self.client.list_aggregates()['aggregates']
self.assertIn((aggregate['id'], aggregate['availability_zone']),
map(lambda x: (x['id'], x['availability_zone']),
@@ -104,11 +100,7 @@
@decorators.idempotent_id('36ec92ca-7a73-43bc-b920-7531809e8540')
def test_aggregate_create_update_metadata_get_details(self):
# Create an aggregate and ensure its details are returned.
- aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = (self.client.create_aggregate(name=aggregate_name)
- ['aggregate'])
- self.addCleanup(self.client.delete_aggregate, aggregate['id'])
-
+ aggregate = self._create_test_aggregate()
body = self.client.show_aggregate(aggregate['id'])['aggregate']
self.assertEqual(aggregate['name'], body['name'])
self.assertEqual(aggregate['availability_zone'],
@@ -129,11 +121,9 @@
# Update an aggregate and ensure properties are updated correctly
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
- aggregate = self.client.create_aggregate(
- name=aggregate_name, availability_zone=az_name)['aggregate']
- self.addCleanup(self.client.delete_aggregate, aggregate['id'])
+ aggregate = self._create_test_aggregate(
+ name=aggregate_name, availability_zone=az_name)
- self.assertEqual(aggregate_name, aggregate['name'])
self.assertEqual(az_name, aggregate['availability_zone'])
self.assertIsNotNone(aggregate['id'])
@@ -159,9 +149,7 @@
# Add a host to the given aggregate and remove.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = (self.client.create_aggregate(name=aggregate_name)
- ['aggregate'])
- self.addCleanup(self.client.delete_aggregate, aggregate['id'])
+ aggregate = self._create_test_aggregate(name=aggregate_name)
body = (self.client.add_host(aggregate['id'], host=self.host)
['aggregate'])
@@ -182,9 +170,8 @@
# Add a host to the given aggregate and list.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = (self.client.create_aggregate(name=aggregate_name)
- ['aggregate'])
- self.addCleanup(self.client.delete_aggregate, aggregate['id'])
+ aggregate = self._create_test_aggregate(name=aggregate_name)
+
self.client.add_host(aggregate['id'], host=self.host)
self.addCleanup(self.client.remove_host, aggregate['id'],
host=self.host)
@@ -202,9 +189,8 @@
# Add a host to the given aggregate and get details.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
- aggregate = (self.client.create_aggregate(name=aggregate_name)
- ['aggregate'])
- self.addCleanup(self.client.delete_aggregate, aggregate['id'])
+ aggregate = self._create_test_aggregate(name=aggregate_name)
+
self.client.add_host(aggregate['id'], host=self.host)
self.addCleanup(self.client.remove_host, aggregate['id'],
host=self.host)
@@ -218,11 +204,9 @@
def test_aggregate_add_host_create_server_with_az(self):
# Add a host to the given aggregate and create a server.
self.useFixture(fixtures.LockFixture('availability_zone'))
- aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
- aggregate = self.client.create_aggregate(
- name=aggregate_name, availability_zone=az_name)['aggregate']
- self.addCleanup(self.client.delete_aggregate, aggregate['id'])
+ aggregate = self._create_test_aggregate(availability_zone=az_name)
+
self.client.add_host(aggregate['id'], host=self.host)
self.addCleanup(self.client.remove_host, aggregate['id'],
host=self.host)
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index b0f18d7..ca53696 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -124,8 +124,8 @@
data_utils.rand_uuid())
@decorators.idempotent_id('b0b17f83-d14e-4fc4-8f31-bcc9f3cfa629')
- @testtools.skipUnless(CONF.compute_feature_enabled.resize,
- 'Resize not available.')
+ @testtools.skipUnless(CONF.compute_feature_enabled.cold_migration,
+ 'Cold migration not available.')
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
'Suspend is not available.')
@decorators.attr(type=['negative'])
diff --git a/tempest/api/compute/admin/test_servers_on_multinodes.py b/tempest/api/compute/admin/test_servers_on_multinodes.py
index 6a2e5e9..858998a 100644
--- a/tempest/api/compute/admin/test_servers_on_multinodes.py
+++ b/tempest/api/compute/admin/test_servers_on_multinodes.py
@@ -25,6 +25,12 @@
class ServersOnMultiNodesTest(base.BaseV2ComputeAdminTest):
@classmethod
+ def resource_setup(cls):
+ super(ServersOnMultiNodesTest, cls).resource_setup()
+ cls.server01 = cls.create_test_server(wait_until='ACTIVE')['id']
+ cls.host01 = cls._get_host(cls.server01)
+
+ @classmethod
def skip_checks(cls):
super(ServersOnMultiNodesTest, cls).skip_checks()
@@ -32,8 +38,9 @@
raise cls.skipException(
"Less than 2 compute nodes, skipping multi-nodes test.")
- def _get_host(self, server_id):
- return self.os_admin.servers_client.show_server(
+ @classmethod
+ def _get_host(cls, server_id):
+ return cls.os_admin.servers_client.show_server(
server_id)['server']['OS-EXT-SRV-ATTR:host']
@decorators.idempotent_id('26a9d5df-6890-45f2-abc4-a659290cb130')
@@ -41,40 +48,31 @@
test.is_scheduler_filter_enabled("SameHostFilter"),
'SameHostFilter is not available.')
def test_create_servers_on_same_host(self):
- server01 = self.create_test_server(wait_until='ACTIVE')['id']
-
- hints = {'same_host': server01}
+ hints = {'same_host': self.server01}
server02 = self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')['id']
- host01 = self._get_host(server01)
host02 = self._get_host(server02)
- self.assertEqual(host01, host02)
+ self.assertEqual(self.host01, host02)
@decorators.idempotent_id('cc7ca884-6e3e-42a3-a92f-c522fcf25e8e')
@testtools.skipUnless(
test.is_scheduler_filter_enabled("DifferentHostFilter"),
'DifferentHostFilter is not available.')
def test_create_servers_on_different_hosts(self):
- server01 = self.create_test_server(wait_until='ACTIVE')['id']
-
- hints = {'different_host': server01}
+ hints = {'different_host': self.server01}
server02 = self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')['id']
- host01 = self._get_host(server01)
host02 = self._get_host(server02)
- self.assertNotEqual(host01, host02)
+ self.assertNotEqual(self.host01, host02)
@decorators.idempotent_id('7869cc84-d661-4e14-9f00-c18cdc89cf57')
@testtools.skipUnless(
test.is_scheduler_filter_enabled("DifferentHostFilter"),
'DifferentHostFilter is not available.')
def test_create_servers_on_different_hosts_with_list_of_servers(self):
- server01 = self.create_test_server(wait_until='ACTIVE')['id']
-
# This scheduler-hint supports list of servers also.
- hints = {'different_host': [server01]}
+ hints = {'different_host': [self.server01]}
server02 = self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')['id']
- host01 = self._get_host(server01)
host02 = self._get_host(server02)
- self.assertNotEqual(host01, host02)
+ self.assertNotEqual(self.host01, host02)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index a5ee716..141b9f3 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -123,10 +123,13 @@
@classmethod
def resource_cleanup(cls):
- cls.clear_images()
+ cls.clear_resources('images', cls.images,
+ cls.compute_images_client.delete_image)
cls.clear_servers()
- cls.clear_security_groups()
- cls.clear_server_groups()
+ cls.clear_resources('security groups', cls.security_groups,
+ cls.security_groups_client.delete_security_group)
+ cls.clear_resources('server groups', cls.server_groups,
+ cls.server_groups_client.delete_server_group)
cls.clear_volumes()
super(BaseV2ComputeTest, cls).resource_cleanup()
@@ -172,42 +175,19 @@
raise
@classmethod
- def clear_images(cls):
- LOG.debug('Clearing images: %s', ','.join(cls.images))
- for image_id in cls.images:
+ def clear_resources(cls, resource_name, resources, resource_del_func):
+ LOG.debug('Clearing %s: %s', resource_name,
+ ','.join(map(str, resources)))
+ for res_id in resources:
try:
test_utils.call_and_ignore_notfound_exc(
- cls.compute_images_client.delete_image, image_id)
- except Exception:
- LOG.exception('Exception raised deleting image %s', image_id)
-
- @classmethod
- def clear_security_groups(cls):
- LOG.debug('Clearing security groups: %s', ','.join(
- str(sg['id']) for sg in cls.security_groups))
- for sg in cls.security_groups:
- try:
- test_utils.call_and_ignore_notfound_exc(
- cls.security_groups_client.delete_security_group, sg['id'])
+ resource_del_func, res_id)
except Exception as exc:
- LOG.info('Exception raised deleting security group %s',
- sg['id'])
+ LOG.exception('Exception raised deleting %s: %s',
+ resource_name, res_id)
LOG.exception(exc)
@classmethod
- def clear_server_groups(cls):
- LOG.debug('Clearing server groups: %s', ','.join(cls.server_groups))
- for server_group_id in cls.server_groups:
- try:
- test_utils.call_and_ignore_notfound_exc(
- cls.server_groups_client.delete_server_group,
- server_group_id
- )
- except Exception:
- LOG.exception('Exception raised deleting server-group %s',
- server_group_id)
-
- @classmethod
def create_test_server(cls, validatable=False, volume_backed=False,
**kwargs):
"""Wrapper utility that returns a test server.
@@ -243,7 +223,7 @@
description = data_utils.rand_name('description')
body = cls.security_groups_client.create_security_group(
name=name, description=description)['security_group']
- cls.security_groups.append(body)
+ cls.security_groups.append(body['id'])
return body
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 8808510..76b9c44 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -168,6 +168,9 @@
@decorators.idempotent_id('aaa6cdf3-55a7-461a-add9-1c8596b9a07c')
def test_rebuild_server(self):
+ # Get the IPs the server has before rebuilding it
+ original_addresses = (self.client.show_server(self.server_id)['server']
+ ['addresses'])
# The server should be rebuilt using the provided image and data
meta = {'rebuild': 'server'}
new_name = data_utils.rand_name(self.__class__.__name__ + '-server')
@@ -197,6 +200,7 @@
rebuilt_image_id = server['image']['id']
self.assertTrue(self.image_ref_alt.endswith(rebuilt_image_id))
self.assertEqual(new_name, server['name'])
+ self.assertEqual(original_addresses, server['addresses'])
if CONF.validation.run_validation:
# Authentication is attempted in the following order of priority:
diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py
index 3b41775..42e13bd 100644
--- a/tempest/api/compute/test_extensions.py
+++ b/tempest/api/compute/test_extensions.py
@@ -35,16 +35,18 @@
raise self.skipException('There are not any extensions configured')
extensions = self.extensions_client.list_extensions()['extensions']
ext = CONF.compute_feature_enabled.api_extensions[0]
- if ext == 'all':
- self.assertIn('Hosts', map(lambda x: x['name'], extensions))
- elif ext:
- self.assertIn(ext, map(lambda x: x['alias'], extensions))
- else:
- raise self.skipException('There are not any extensions configured')
+
# Log extensions list
extension_list = map(lambda x: x['alias'], extensions)
LOG.debug("Nova extensions: %s", ','.join(extension_list))
+ if ext == 'all':
+ self.assertIn('Hosts', map(lambda x: x['name'], extensions))
+ elif ext:
+ self.assertIn(ext, extension_list)
+ else:
+ raise self.skipException('There are not any extensions configured')
+
@decorators.idempotent_id('05762f39-bdfa-4cdb-9b46-b78f8e78e2fd')
@test.requires_ext(extension='os-consoles', service='compute')
def test_get_extension(self):
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index b0a6622..11517cc 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -113,51 +113,35 @@
def test_list_get_volume_attachments(self):
# List volume attachment of the server
server = self._create_server()
- volume = self.create_volume()
- attachment = self.attach_volume(server, volume,
- device=('/dev/%s' % self.device))
+ volume_1st = self.create_volume()
+ attachment_1st = self.attach_volume(server, volume_1st,
+ device=('/dev/%s' % self.device))
body = self.servers_client.list_volume_attachments(
server['id'])['volumeAttachments']
self.assertEqual(1, len(body))
- self.assertIn(attachment, body)
+ self.assertIn(attachment_1st, body)
# Get volume attachment of the server
body = self.servers_client.show_volume_attachment(
server['id'],
- attachment['id'])['volumeAttachment']
+ attachment_1st['id'])['volumeAttachment']
self.assertEqual(server['id'], body['serverId'])
- self.assertEqual(volume['id'], body['volumeId'])
- self.assertEqual(attachment['id'], body['id'])
+ self.assertEqual(volume_1st['id'], body['volumeId'])
+ self.assertEqual(attachment_1st['id'], body['id'])
- @decorators.idempotent_id('757d488b-a951-4bc7-b3cd-f417028da08a')
- def test_list_get_two_volume_attachments(self):
- # NOTE: This test is using the volume device auto-assignment
- # without specifying the device ("/dev/sdb", etc). The feature
- # is supported since Nova Liberty release or later. So this should
- # be skipped on older clouds.
- server = self._create_server()
- volume_1st = self.create_volume()
+ # attach one more volume to server
volume_2nd = self.create_volume()
- attachment_1st = self.attach_volume(server, volume_1st)
attachment_2nd = self.attach_volume(server, volume_2nd)
-
body = self.servers_client.list_volume_attachments(
server['id'])['volumeAttachments']
self.assertEqual(2, len(body))
- body = self.servers_client.show_volume_attachment(
- server['id'],
- attachment_1st['id'])['volumeAttachment']
- self.assertEqual(server['id'], body['serverId'])
- self.assertEqual(attachment_1st['volumeId'], body['volumeId'])
- self.assertEqual(attachment_1st['id'], body['id'])
-
- body = self.servers_client.show_volume_attachment(
- server['id'],
- attachment_2nd['id'])['volumeAttachment']
- self.assertEqual(server['id'], body['serverId'])
- self.assertEqual(attachment_2nd['volumeId'], body['volumeId'])
- self.assertEqual(attachment_2nd['id'], body['id'])
+ for attachment in [attachment_1st, attachment_2nd]:
+ body = self.servers_client.show_volume_attachment(
+ server['id'], attachment['id'])['volumeAttachment']
+ self.assertEqual(server['id'], body['serverId'])
+ self.assertEqual(attachment['volumeId'], body['volumeId'])
+ self.assertEqual(attachment['id'], body['id'])
class AttachVolumeShelveTestJSON(AttachVolumeTestJSON):
diff --git a/tempest/api/network/test_metering_extensions.py b/tempest/api/network/admin/test_metering_extensions.py
similarity index 87%
rename from tempest/api/network/test_metering_extensions.py
rename to tempest/api/network/admin/test_metering_extensions.py
index 18dccc3..3f94868 100644
--- a/tempest/api/network/test_metering_extensions.py
+++ b/tempest/api/network/admin/test_metering_extensions.py
@@ -45,6 +45,28 @@
remote_ip_prefix, direction,
metering_label_id=cls.metering_label['id'])
+ @classmethod
+ def create_metering_label(cls, name, description):
+ """Wrapper utility that returns a test metering label."""
+ body = cls.admin_metering_labels_client.create_metering_label(
+ description=description,
+ name=name)
+ metering_label = body['metering_label']
+ cls.metering_labels.append(metering_label)
+ return metering_label
+
+ @classmethod
+ def create_metering_label_rule(cls, remote_ip_prefix, direction,
+ metering_label_id):
+ """Wrapper utility that returns a test metering label rule."""
+ client = cls.admin_metering_label_rules_client
+ body = client.create_metering_label_rule(
+ remote_ip_prefix=remote_ip_prefix, direction=direction,
+ metering_label_id=metering_label_id)
+ metering_label_rule = body['metering_label_rule']
+ cls.metering_label_rules.append(metering_label_rule)
+ return metering_label_rule
+
def _delete_metering_label(self, metering_label_id):
# Deletes a label and verifies if it is deleted or not
self.admin_metering_labels_client.delete_metering_label(
diff --git a/tempest/api/network/admin/test_ports.py b/tempest/api/network/admin/test_ports.py
new file mode 100644
index 0000000..807994b
--- /dev/null
+++ b/tempest/api/network/admin/test_ports.py
@@ -0,0 +1,99 @@
+# Copyright 2014 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import socket
+
+from tempest.api.network import base
+from tempest import config
+from tempest.lib import decorators
+
+CONF = config.CONF
+
+
+class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
+
+ @classmethod
+ def resource_setup(cls):
+ super(PortsAdminExtendedAttrsTestJSON, cls).resource_setup()
+ cls.network = cls.create_network()
+ cls.host_id = socket.gethostname()
+
+ @decorators.idempotent_id('8e8569c1-9ac7-44db-8bc1-f5fb2814f29b')
+ def test_create_port_binding_ext_attr(self):
+ post_body = {"network_id": self.network['id'],
+ "binding:host_id": self.host_id}
+ body = self.admin_ports_client.create_port(**post_body)
+ port = body['port']
+ self.addCleanup(self.admin_ports_client.delete_port, port['id'])
+ host_id = port['binding:host_id']
+ self.assertIsNotNone(host_id)
+ self.assertEqual(self.host_id, host_id)
+
+ @decorators.idempotent_id('6f6c412c-711f-444d-8502-0ac30fbf5dd5')
+ def test_update_port_binding_ext_attr(self):
+ post_body = {"network_id": self.network['id']}
+ body = self.admin_ports_client.create_port(**post_body)
+ port = body['port']
+ self.addCleanup(self.admin_ports_client.delete_port, port['id'])
+ update_body = {"binding:host_id": self.host_id}
+ body = self.admin_ports_client.update_port(port['id'], **update_body)
+ updated_port = body['port']
+ host_id = updated_port['binding:host_id']
+ self.assertIsNotNone(host_id)
+ self.assertEqual(self.host_id, host_id)
+
+ @decorators.idempotent_id('1c82a44a-6c6e-48ff-89e1-abe7eaf8f9f8')
+ def test_list_ports_binding_ext_attr(self):
+ # Create a new port
+ post_body = {"network_id": self.network['id']}
+ body = self.admin_ports_client.create_port(**post_body)
+ port = body['port']
+ self.addCleanup(self.admin_ports_client.delete_port, port['id'])
+
+ # Update the port's binding attributes so that is now 'bound'
+ # to a host
+ update_body = {"binding:host_id": self.host_id}
+ self.admin_ports_client.update_port(port['id'], **update_body)
+
+ # List all ports, ensure new port is part of list and its binding
+ # attributes are set and accurate
+ body = self.admin_ports_client.list_ports()
+ ports_list = body['ports']
+ pids_list = [p['id'] for p in ports_list]
+ self.assertIn(port['id'], pids_list)
+ listed_port = [p for p in ports_list if p['id'] == port['id']]
+ self.assertEqual(1, len(listed_port),
+ 'Multiple ports listed with id %s in ports listing: '
+ '%s' % (port['id'], ports_list))
+ self.assertEqual(self.host_id, listed_port[0]['binding:host_id'])
+
+ @decorators.idempotent_id('b54ac0ff-35fc-4c79-9ca3-c7dbd4ea4f13')
+ def test_show_port_binding_ext_attr(self):
+ body = self.admin_ports_client.create_port(
+ network_id=self.network['id'])
+ port = body['port']
+ self.addCleanup(self.admin_ports_client.delete_port, port['id'])
+ body = self.admin_ports_client.show_port(port['id'])
+ show_port = body['port']
+ self.assertEqual(port['binding:host_id'],
+ show_port['binding:host_id'])
+ self.assertEqual(port['binding:vif_type'],
+ show_port['binding:vif_type'])
+ self.assertEqual(port['binding:vif_details'],
+ show_port['binding:vif_details'])
+
+
+class PortsAdminExtendedAttrsIpV6TestJSON(PortsAdminExtendedAttrsTestJSON):
+ _ip_version = 6
diff --git a/tempest/api/network/admin/test_routers_dvr.py b/tempest/api/network/admin/test_routers_dvr.py
index 4ccad30..f9a0cfb 100644
--- a/tempest/api/network/admin/test_routers_dvr.py
+++ b/tempest/api/network/admin/test_routers_dvr.py
@@ -15,13 +15,13 @@
import testtools
-from tempest.api.network import base_routers as base
+from tempest.api.network import base
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest import test
-class RoutersTestDVR(base.BaseRouterTest):
+class RoutersTestDVR(base.BaseAdminNetworkTest):
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/network/admin/test_routers_negative.py b/tempest/api/network/admin/test_routers_negative.py
new file mode 100644
index 0000000..f350a15
--- /dev/null
+++ b/tempest/api/network/admin/test_routers_negative.py
@@ -0,0 +1,63 @@
+# Copyright 2013 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import testtools
+
+from tempest.api.network import base
+from tempest import config
+from tempest.lib import decorators
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+
+CONF = config.CONF
+
+
+class RoutersAdminNegativeTest(base.BaseAdminNetworkTest):
+
+ @classmethod
+ def skip_checks(cls):
+ super(RoutersAdminNegativeTest, cls).skip_checks()
+ if not test.is_extension_enabled('router', 'network'):
+ msg = "router extension not enabled."
+ raise cls.skipException(msg)
+
+ @decorators.attr(type=['negative'])
+ @decorators.idempotent_id('7101cc02-058a-11e7-93e1-fa163e4fa634')
+ @test.requires_ext(extension='ext-gw-mode', service='network')
+ @testtools.skipUnless(CONF.network.public_network_id,
+ 'The public_network_id option must be specified.')
+ def test_router_set_gateway_used_ip_returns_409(self):
+ # At first create a address from public_network_id
+ port = self.admin_ports_client.create_port(
+ network_id=CONF.network.public_network_id)['port']
+ self.addCleanup(self.admin_ports_client.delete_port,
+ port_id=port['id'])
+ # Add used ip and subnet_id in external_fixed_ips
+ fixed_ip = {
+ 'subnet_id': port['fixed_ips'][0]['subnet_id'],
+ 'ip_address': port['fixed_ips'][0]['ip_address']
+ }
+ external_gateway_info = {
+ 'network_id': CONF.network.public_network_id,
+ 'external_fixed_ips': [fixed_ip]
+ }
+ # Create a router and set gateway to used ip
+ self.assertRaises(lib_exc.Conflict,
+ self.admin_routers_client.create_router,
+ external_gateway_info=external_gateway_info)
+
+
+class RoutersAdminNegativeIpV6Test(RoutersAdminNegativeTest):
+ _ip_version = 6
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 359a444..8775495 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -269,25 +269,3 @@
cls.admin_metering_labels_client = cls.os_admin.metering_labels_client
cls.admin_metering_label_rules_client = (
cls.os_admin.metering_label_rules_client)
-
- @classmethod
- def create_metering_label(cls, name, description):
- """Wrapper utility that returns a test metering label."""
- body = cls.admin_metering_labels_client.create_metering_label(
- description=description,
- name=name)
- metering_label = body['metering_label']
- cls.metering_labels.append(metering_label)
- return metering_label
-
- @classmethod
- def create_metering_label_rule(cls, remote_ip_prefix, direction,
- metering_label_id):
- """Wrapper utility that returns a test metering label rule."""
- client = cls.admin_metering_label_rules_client
- body = client.create_metering_label_rule(
- remote_ip_prefix=remote_ip_prefix, direction=direction,
- metering_label_id=metering_label_id)
- metering_label_rule = body['metering_label_rule']
- cls.metering_label_rules.append(metering_label_rule)
- return metering_label_rule
diff --git a/tempest/api/network/base_routers.py b/tempest/api/network/base_routers.py
index f6fd871..62062ba 100644
--- a/tempest/api/network/base_routers.py
+++ b/tempest/api/network/base_routers.py
@@ -33,15 +33,6 @@
self.addCleanup(self._cleanup_router, router)
return router
- def _delete_router(self, router_id, routers_client=None):
- client = routers_client or self.routers_client
- client.delete_router(router_id)
- # Asserting that the router is not found in the list
- # after deletion
- list_body = client.list_routers()
- routers_list = [router['id'] for router in list_body['routers']]
- self.assertNotIn(router_id, routers_list)
-
def _add_router_interface_with_subnet_id(self, router_id, subnet_id):
interface = self.routers_client.add_router_interface(
router_id, subnet_id=subnet_id)
@@ -54,8 +45,3 @@
body = self.routers_client.remove_router_interface(router_id,
subnet_id=subnet_id)
self.assertEqual(subnet_id, body['subnet_id'])
-
- def _remove_router_interface_with_port_id(self, router_id, port_id):
- body = self.routers_client.remove_router_interface(router_id,
- port_id=port_id)
- self.assertEqual(port_id, body['port_id'])
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 69a1441..f81927d 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -13,12 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-import socket
-
import netaddr
import testtools
-from tempest.api.network import base
from tempest.api.network import base_security_groups as sec_base
from tempest.common import custom_matchers
from tempest import config
@@ -358,82 +355,5 @@
self.assertEmpty(port['security_groups'])
-class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
-
- @classmethod
- def resource_setup(cls):
- super(PortsAdminExtendedAttrsTestJSON, cls).resource_setup()
- cls.network = cls.create_network()
- cls.host_id = socket.gethostname()
-
- @decorators.idempotent_id('8e8569c1-9ac7-44db-8bc1-f5fb2814f29b')
- def test_create_port_binding_ext_attr(self):
- post_body = {"network_id": self.network['id'],
- "binding:host_id": self.host_id}
- body = self.admin_ports_client.create_port(**post_body)
- port = body['port']
- self.addCleanup(self.admin_ports_client.delete_port, port['id'])
- host_id = port['binding:host_id']
- self.assertIsNotNone(host_id)
- self.assertEqual(self.host_id, host_id)
-
- @decorators.idempotent_id('6f6c412c-711f-444d-8502-0ac30fbf5dd5')
- def test_update_port_binding_ext_attr(self):
- post_body = {"network_id": self.network['id']}
- body = self.admin_ports_client.create_port(**post_body)
- port = body['port']
- self.addCleanup(self.admin_ports_client.delete_port, port['id'])
- update_body = {"binding:host_id": self.host_id}
- body = self.admin_ports_client.update_port(port['id'], **update_body)
- updated_port = body['port']
- host_id = updated_port['binding:host_id']
- self.assertIsNotNone(host_id)
- self.assertEqual(self.host_id, host_id)
-
- @decorators.idempotent_id('1c82a44a-6c6e-48ff-89e1-abe7eaf8f9f8')
- def test_list_ports_binding_ext_attr(self):
- # Create a new port
- post_body = {"network_id": self.network['id']}
- body = self.admin_ports_client.create_port(**post_body)
- port = body['port']
- self.addCleanup(self.admin_ports_client.delete_port, port['id'])
-
- # Update the port's binding attributes so that is now 'bound'
- # to a host
- update_body = {"binding:host_id": self.host_id}
- self.admin_ports_client.update_port(port['id'], **update_body)
-
- # List all ports, ensure new port is part of list and its binding
- # attributes are set and accurate
- body = self.admin_ports_client.list_ports()
- ports_list = body['ports']
- pids_list = [p['id'] for p in ports_list]
- self.assertIn(port['id'], pids_list)
- listed_port = [p for p in ports_list if p['id'] == port['id']]
- self.assertEqual(1, len(listed_port),
- 'Multiple ports listed with id %s in ports listing: '
- '%s' % (port['id'], ports_list))
- self.assertEqual(self.host_id, listed_port[0]['binding:host_id'])
-
- @decorators.idempotent_id('b54ac0ff-35fc-4c79-9ca3-c7dbd4ea4f13')
- def test_show_port_binding_ext_attr(self):
- body = self.admin_ports_client.create_port(
- network_id=self.network['id'])
- port = body['port']
- self.addCleanup(self.admin_ports_client.delete_port, port['id'])
- body = self.admin_ports_client.show_port(port['id'])
- show_port = body['port']
- self.assertEqual(port['binding:host_id'],
- show_port['binding:host_id'])
- self.assertEqual(port['binding:vif_type'],
- show_port['binding:vif_type'])
- self.assertEqual(port['binding:vif_details'],
- show_port['binding:vif_details'])
-
-
class PortsIpV6TestJSON(PortsTestJSON):
_ip_version = 6
-
-
-class PortsAdminExtendedAttrsIpV6TestJSON(PortsAdminExtendedAttrsTestJSON):
- _ip_version = 6
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 97ad4d4..ee0e395 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -153,8 +153,8 @@
interface = self.routers_client.add_router_interface(
router['id'],
port_id=port_body['port']['id'])
- self.addCleanup(self._remove_router_interface_with_port_id,
- router['id'], port_body['port']['id'])
+ self.addCleanup(self.routers_client.remove_router_interface,
+ router['id'], port_id=port_body['port']['id'])
self.assertIn('subnet_id', interface.keys())
self.assertIn('port_id', interface.keys())
# Verify router id is equal to device id in port details
diff --git a/tempest/api/network/test_routers_negative.py b/tempest/api/network/test_routers_negative.py
index fdd8dd8..72face8 100644
--- a/tempest/api/network/test_routers_negative.py
+++ b/tempest/api/network/test_routers_negative.py
@@ -14,9 +14,8 @@
# under the License.
import netaddr
-import testtools
-from tempest.api.network import base_routers as base
+from tempest.api.network import base
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@@ -26,7 +25,7 @@
CONF = config.CONF
-class RoutersNegativeTest(base.BaseRouterTest):
+class RoutersNegativeTest(base.BaseNetworkTest):
@classmethod
def skip_checks(cls):
@@ -75,37 +74,15 @@
network_name=data_utils.rand_name('router-network02-'))
subnet01 = self.create_subnet(network01)
subnet02 = self.create_subnet(network02)
- self._add_router_interface_with_subnet_id(self.router['id'],
- subnet01['id'])
+ interface = self.routers_client.add_router_interface(
+ self.router['id'], subnet_id=subnet01['id'])
+ self.addCleanup(self.routers_client.remove_router_interface,
+ self.router['id'], subnet_id=subnet01['id'])
+ self.assertEqual(subnet01['id'], interface['subnet_id'])
self.assertRaises(lib_exc.BadRequest,
- self._add_router_interface_with_subnet_id,
+ self.routers_client.add_router_interface,
self.router['id'],
- subnet02['id'])
-
- @decorators.attr(type=['negative'])
- @decorators.idempotent_id('7101cc02-058a-11e7-93e1-fa163e4fa634')
- @test.requires_ext(extension='ext-gw-mode', service='network')
- @testtools.skipUnless(CONF.network.public_network_id,
- 'The public_network_id option must be specified.')
- def test_router_set_gateway_used_ip_returns_409(self):
- # At first create a address from public_network_id
- port = self.admin_ports_client.create_port(
- network_id=CONF.network.public_network_id)['port']
- self.addCleanup(self.admin_ports_client.delete_port,
- port_id=port['id'])
- # Add used ip and subnet_id in external_fixed_ips
- fixed_ip = {
- 'subnet_id': port['fixed_ips'][0]['subnet_id'],
- 'ip_address': port['fixed_ips'][0]['ip_address']
- }
- external_gateway_info = {
- 'network_id': CONF.network.public_network_id,
- 'external_fixed_ips': [fixed_ip]
- }
- # Create a router and set gateway to used ip
- self.assertRaises(lib_exc.Conflict,
- self.admin_routers_client.create_router,
- external_gateway_info=external_gateway_info)
+ subnet_id=subnet02['id'])
@decorators.attr(type=['negative'])
@decorators.idempotent_id('04df80f9-224d-47f5-837a-bf23e33d1c20')
@@ -142,7 +119,7 @@
_ip_version = 6
-class DvrRoutersNegativeTest(base.BaseRouterTest):
+class DvrRoutersNegativeTest(base.BaseNetworkTest):
@classmethod
def skip_checks(cls):
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index a6f9246..afc3281 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -121,7 +121,7 @@
'available')
@decorators.idempotent_id('47a35425-a891-4e13-961c-c45deea21e94')
- def test_volume_backup_reset_status_force_delete(self):
+ def test_volume_backup_reset_status(self):
# Create a volume
volume = self.create_volume()
# Create a backup
@@ -136,6 +136,3 @@
status="error")
waiters.wait_for_volume_resource_status(self.admin_backups_client,
backup['id'], 'error')
- # Force delete a backup volume when backup is in error state.
- self.admin_backups_client.force_delete_backup(backup['id'])
- self.admin_backups_client.wait_for_resource_deletion(backup['id'])
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index c877969..cc1e087 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -144,8 +144,7 @@
snapshot['id'], 'available')
return snapshot
- def create_backup(self, volume_id, backup_client=None,
- wait_until="available", **kwargs):
+ def create_backup(self, volume_id, backup_client=None, **kwargs):
"""Wrapper utility that returns a test backup."""
if backup_client is None:
backup_client = self.backups_client
@@ -155,12 +154,9 @@
backup = backup_client.create_backup(
volume_id=volume_id, **kwargs)['backup']
-
- self.addCleanup(test_utils.call_and_ignore_notfound_exc,
- backup_client.delete_backup, backup['id'])
- waiters.wait_for_volume_resource_status(backup_client,
- backup['id'],
- wait_until)
+ self.addCleanup(backup_client.delete_backup, backup['id'])
+ waiters.wait_for_volume_resource_status(backup_client, backup['id'],
+ 'available')
return backup
# NOTE(afazekas): these create_* and clean_* could be defined
diff --git a/tempest/api/volume/test_volumes_extend.py b/tempest/api/volume/test_volumes_extend.py
index 837758f..1eb76a0 100644
--- a/tempest/api/volume/test_volumes_extend.py
+++ b/tempest/api/volume/test_volumes_extend.py
@@ -40,6 +40,7 @@
@decorators.idempotent_id('86be1cba-2640-11e5-9c82-635fb964c912')
@testtools.skipUnless(CONF.volume_feature_enabled.snapshot,
"Cinder volume snapshots are disabled")
+ @decorators.skip_because(bug='1687044')
def test_volume_extend_when_volume_has_snapshot(self):
volume = self.create_volume()
self.create_snapshot(volume['id'])
diff --git a/tempest/lib/services/volume/v2/backups_client.py b/tempest/lib/services/volume/v2/backups_client.py
index 197d57e..2b5e82d 100644
--- a/tempest/lib/services/volume/v2/backups_client.py
+++ b/tempest/lib/services/volume/v2/backups_client.py
@@ -55,14 +55,6 @@
self.expected_success(202, resp.status)
return rest_client.ResponseBody(resp, body)
- def force_delete_backup(self, backup_id):
- """Force delete a backup volume."""
- post_body = json.dumps({'os-force_delete': {}})
- url = 'backups/%s/action' % backup_id
- resp, body = self.post(url, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp)
-
def show_backup(self, backup_id):
"""Returns the details of a single backup."""
url = "backups/%s" % backup_id
diff --git a/tempest/test.py b/tempest/test.py
index f6b17ad..e8108f4 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -339,24 +339,24 @@
if credentials_type == 'primary':
cls.os = debtcollector.moves.moved_read_only_property(
'os', 'os_primary', version='Pike',
- removal_version='Ocata')
+ removal_version='Queens')
cls.manager =\
debtcollector.moves.moved_read_only_property(
'manager', 'os_primary', version='Pike',
- removal_version='Ocata')
+ removal_version='Queens')
if credentials_type == 'admin':
cls.os_adm = debtcollector.moves.moved_read_only_property(
'os_adm', 'os_admin', version='Pike',
- removal_version='Ocata')
+ removal_version='Queens')
cls.admin_manager =\
debtcollector.moves.moved_read_only_property(
'admin_manager', 'os_admin', version='Pike',
- removal_version='Ocata')
+ removal_version='Queens')
if credentials_type == 'alt':
cls.alt_manager =\
debtcollector.moves.moved_read_only_property(
'alt_manager', 'os_alt', version='Pike',
- removal_version='Ocata')
+ removal_version='Queens')
elif isinstance(credentials_type, list):
manager = cls.get_client_manager(roles=credentials_type[1:],
force_new=True)
diff --git a/tempest/tests/lib/services/base.py b/tempest/tests/lib/services/base.py
index a244aa2..71b7f2d 100644
--- a/tempest/tests/lib/services/base.py
+++ b/tempest/tests/lib/services/base.py
@@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import fixtures
from oslo_serialization import jsonutils as json
-from oslotest import mockpatch
from tempest.tests import base
from tempest.tests.lib import fake_http
@@ -33,7 +33,7 @@
body, to_utf=False, status=200,
headers=None, **kwargs):
mocked_response = self.create_response(body, to_utf, status, headers)
- self.useFixture(mockpatch.Patch(
+ self.useFixture(fixtures.MockPatch(
function2mock, return_value=mocked_response))
if kwargs:
resp = function(**kwargs)
diff --git a/tempest/tests/lib/services/compute/test_flavors_client.py b/tempest/tests/lib/services/compute/test_flavors_client.py
index 445ee22..cbd17c6 100644
--- a/tempest/tests/lib/services/compute/test_flavors_client.py
+++ b/tempest/tests/lib/services/compute/test_flavors_client.py
@@ -14,8 +14,8 @@
import copy
+import fixtures
from oslo_serialization import jsonutils as json
-from oslotest import mockpatch
from tempest.lib.services.compute import flavors_client
from tempest.tests.lib import fake_auth_provider
@@ -118,7 +118,7 @@
if bytes_body:
body = body.encode('utf-8')
response = fake_http.fake_http_response({}, status=200), body
- self.useFixture(mockpatch.Patch(
+ self.useFixture(fixtures.MockPatch(
'tempest.lib.common.rest_client.RestClient.get',
return_value=response))
self.assertEqual(is_deleted,
diff --git a/tempest/tests/lib/services/compute/test_floating_ips_client.py b/tempest/tests/lib/services/compute/test_floating_ips_client.py
index 92737f2..950f9ce 100644
--- a/tempest/tests/lib/services/compute/test_floating_ips_client.py
+++ b/tempest/tests/lib/services/compute/test_floating_ips_client.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslotest import mockpatch
+import fixtures
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.compute import floating_ips_client
@@ -99,14 +99,14 @@
server_id='c782b7a9-33cd-45f0-b795-7f87f456408b')
def test_is_resource_deleted_true(self):
- self.useFixture(mockpatch.Patch(
+ self.useFixture(fixtures.MockPatch(
'tempest.lib.services.compute.floating_ips_client.'
'FloatingIPsClient.show_floating_ip',
side_effect=lib_exc.NotFound()))
self.assertTrue(self.client.is_resource_deleted('fake-id'))
def test_is_resource_deleted_false(self):
- self.useFixture(mockpatch.Patch(
+ self.useFixture(fixtures.MockPatch(
'tempest.lib.services.compute.floating_ips_client.'
'FloatingIPsClient.show_floating_ip',
return_value={"floating_ip": TestFloatingIpsClient.floating_ip}))
diff --git a/tempest/tests/lib/services/compute/test_images_client.py b/tempest/tests/lib/services/compute/test_images_client.py
index a9a570d..c2c3b76 100644
--- a/tempest/tests/lib/services/compute/test_images_client.py
+++ b/tempest/tests/lib/services/compute/test_images_client.py
@@ -14,8 +14,7 @@
import copy
-from oslotest import mockpatch
-
+import fixtures
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.compute import images_client
from tempest.tests.lib import fake_auth_provider
@@ -187,15 +186,15 @@
def _test_resource_deleted(self, bytes_body=False):
params = {"id": self.FAKE_IMAGE_ID}
expected_op = self.FAKE_IMAGE_DATA['show']
- self.useFixture(mockpatch.Patch('tempest.lib.services.compute'
+ self.useFixture(fixtures.MockPatch('tempest.lib.services.compute'
'.images_client.ImagesClient.show_image',
- side_effect=lib_exc.NotFound))
+ side_effect=lib_exc.NotFound))
self.assertEqual(True, self.client.is_resource_deleted(**params))
tempdata = copy.deepcopy(self.FAKE_IMAGE_DATA['show'])
tempdata['image']['id'] = None
- self.useFixture(mockpatch.Patch('tempest.lib.services.compute'
+ self.useFixture(fixtures.MockPatch('tempest.lib.services.compute'
'.images_client.ImagesClient.show_image',
- return_value=expected_op))
+ return_value=expected_op))
self.assertEqual(False, self.client.is_resource_deleted(**params))
def test_list_images_with_str_body(self):
diff --git a/tempest/tests/lib/services/compute/test_security_groups_client.py b/tempest/tests/lib/services/compute/test_security_groups_client.py
index d293a08..7bbf20e 100644
--- a/tempest/tests/lib/services/compute/test_security_groups_client.py
+++ b/tempest/tests/lib/services/compute/test_security_groups_client.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslotest import mockpatch
+import fixtures
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.compute import security_groups_client
@@ -103,11 +103,11 @@
def test_is_resource_deleted_true(self):
mod = ('tempest.lib.services.compute.security_groups_client.'
'SecurityGroupsClient.show_security_group')
- self.useFixture(mockpatch.Patch(mod, side_effect=lib_exc.NotFound))
+ self.useFixture(fixtures.MockPatch(mod, side_effect=lib_exc.NotFound))
self.assertTrue(self.client.is_resource_deleted('fake-id'))
def test_is_resource_deleted_false(self):
mod = ('tempest.lib.services.compute.security_groups_client.'
'SecurityGroupsClient.show_security_group')
- self.useFixture(mockpatch.Patch(mod, return_value='success'))
+ self.useFixture(fixtures.MockPatch(mod, return_value='success'))
self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tempest/tests/lib/services/compute/test_server_groups_client.py b/tempest/tests/lib/services/compute/test_server_groups_client.py
index bf03b84..1c535ca 100644
--- a/tempest/tests/lib/services/compute/test_server_groups_client.py
+++ b/tempest/tests/lib/services/compute/test_server_groups_client.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslotest import mockpatch
+import fixtures
from tempest.tests.lib import fake_auth_provider
from tempest.lib.services.compute import server_groups_client
@@ -50,7 +50,7 @@
def test_delete_server_group(self):
response = fake_http.fake_http_response({}, status=204), ''
- self.useFixture(mockpatch.Patch(
+ self.useFixture(fixtures.MockPatch(
'tempest.lib.common.rest_client.RestClient.delete',
return_value=response))
self.client.delete_server_group('fake-group')
diff --git a/tempest/tests/lib/services/compute/test_snapshots_client.py b/tempest/tests/lib/services/compute/test_snapshots_client.py
index 1629943..1e2902c 100644
--- a/tempest/tests/lib/services/compute/test_snapshots_client.py
+++ b/tempest/tests/lib/services/compute/test_snapshots_client.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslotest import mockpatch
+import fixtures
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.compute import snapshots_client
@@ -91,13 +91,13 @@
def test_is_resource_deleted_true(self):
module = ('tempest.lib.services.compute.snapshots_client.'
'SnapshotsClient.show_snapshot')
- self.useFixture(mockpatch.Patch(
+ self.useFixture(fixtures.MockPatch(
module, side_effect=lib_exc.NotFound))
self.assertTrue(self.client.is_resource_deleted('fake-id'))
def test_is_resource_deleted_false(self):
module = ('tempest.lib.services.compute.snapshots_client.'
'SnapshotsClient.show_snapshot')
- self.useFixture(mockpatch.Patch(
+ self.useFixture(fixtures.MockPatch(
module, return_value={}))
self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tempest/tests/lib/services/compute/test_versions_client.py b/tempest/tests/lib/services/compute/test_versions_client.py
index 255a0a3..40d424f 100644
--- a/tempest/tests/lib/services/compute/test_versions_client.py
+++ b/tempest/tests/lib/services/compute/test_versions_client.py
@@ -14,7 +14,7 @@
import copy
-from oslotest import mockpatch
+import fixtures
from tempest.lib.services.compute import versions_client
from tempest.tests.lib import fake_auth_provider
@@ -73,7 +73,7 @@
200)
def _test_get_version_by_url(self, bytes_body=False):
- self.useFixture(mockpatch.Patch(
+ self.useFixture(fixtures.MockPatch(
"tempest.lib.common.rest_client.RestClient.token",
return_value="Dummy Token"))
params = {"version_url": self.versions_client._get_base_version_url()}
diff --git a/tempest/tests/lib/services/compute/test_volumes_client.py b/tempest/tests/lib/services/compute/test_volumes_client.py
index b81cdbb..4b4f02e 100644
--- a/tempest/tests/lib/services/compute/test_volumes_client.py
+++ b/tempest/tests/lib/services/compute/test_volumes_client.py
@@ -14,7 +14,7 @@
import copy
-from oslotest import mockpatch
+import fixtures
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.compute import volumes_client
@@ -102,13 +102,13 @@
def test_is_resource_deleted_true(self):
module = ('tempest.lib.services.compute.volumes_client.'
'VolumesClient.show_volume')
- self.useFixture(mockpatch.Patch(
+ self.useFixture(fixtures.MockPatch(
module, side_effect=lib_exc.NotFound))
self.assertTrue(self.client.is_resource_deleted('fake-id'))
def test_is_resource_deleted_false(self):
module = ('tempest.lib.services.compute.volumes_client.'
'VolumesClient.show_volume')
- self.useFixture(mockpatch.Patch(
+ self.useFixture(fixtures.MockPatch(
module, return_value={}))
self.assertFalse(self.client.is_resource_deleted('fake-id'))