Merge "Improve error message on volume tests failure"
diff --git a/REVIEWING.rst b/REVIEWING.rst
index cfe7f4c..9b272bb 100644
--- a/REVIEWING.rst
+++ b/REVIEWING.rst
@@ -93,6 +93,12 @@
.. _reno: http://docs.openstack.org/developer/reno/
+Deprecated Code
+---------------
+Sometimes we have some bugs in deprecated code. Basically, we leave it. Because
+we don't need to maintain it. However, if the bug is critical, we might need to
+fix it. When it will happen, we will deal with it on a case-by-case basis.
+
When to approve
---------------
* Every patch needs two +2s before being approved.
diff --git a/releasenotes/notes/12.2.0-clients_module-16f3025f515bf9ec.yaml b/releasenotes/notes/12.2.0-clients_module-16f3025f515bf9ec.yaml
index 53741da..484d543 100644
--- a/releasenotes/notes/12.2.0-clients_module-16f3025f515bf9ec.yaml
+++ b/releasenotes/notes/12.2.0-clients_module-16f3025f515bf9ec.yaml
@@ -8,7 +8,7 @@
access service clients defined in Tempest as well as service clients
defined in all loaded plugins.
The new ServiceClients class only exposes for now the service clients
- which are in tempest.lib, i.e. compute, network and image. The remaing
+ which are in tempest.lib, i.e. compute, network and image. The remaining
service clients (identity, volume and object-storage) will be added in
future updates.
deprecations:
diff --git a/requirements.txt b/requirements.txt
index 07dd1c1..ea73180 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-pbr>=1.6 # Apache-2.0
+pbr>=1.8 # Apache-2.0
cliff>=2.2.0 # Apache-2.0
jsonschema!=2.5.0,<3.0.0,>=2.0.0 # MIT
testtools>=1.4.0 # MIT
diff --git a/tempest/api/compute/admin/test_volumes_negative.py b/tempest/api/compute/admin/test_volumes_negative.py
new file mode 100644
index 0000000..b9dac6f
--- /dev/null
+++ b/tempest/api/compute/admin/test_volumes_negative.py
@@ -0,0 +1,61 @@
+# Copyright 2016 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import config
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+
+CONF = config.CONF
+
+
+class VolumesAdminNegativeTest(base.BaseV2ComputeAdminTest):
+
+ @classmethod
+ def skip_checks(cls):
+ super(VolumesAdminNegativeTest, cls).skip_checks()
+ if not CONF.service_available.cinder:
+ skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
+ raise cls.skipException(skip_msg)
+
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesAdminNegativeTest, cls).setup_clients()
+ cls.servers_admin_client = cls.os_adm.servers_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesAdminNegativeTest, cls).resource_setup()
+ cls.server = cls.create_test_server(wait_until='ACTIVE')
+
+ @test.idempotent_id('309b5ecd-0585-4a7e-a36f-d2b2bf55259d')
+ def test_update_attached_volume_with_nonexistent_volume_in_uri(self):
+ volume = self.create_volume()
+ nonexistent_volume = data_utils.rand_uuid()
+ self.assertRaises(lib_exc.NotFound,
+ self.servers_admin_client.update_attached_volume,
+ self.server['id'], nonexistent_volume,
+ volumeId=volume['id'])
+
+ @test.idempotent_id('7dcac15a-b107-46d3-a5f6-cb863f4e454a')
+ def test_update_attached_volume_with_nonexistent_volume_in_body(self):
+ volume = self.create_volume()
+ self.attach_volume(self.server, volume)
+
+ nonexistent_volume = data_utils.rand_uuid()
+ self.assertRaises(lib_exc.BadRequest,
+ self.servers_admin_client.update_attached_volume,
+ self.server['id'], volume['id'],
+ volumeId=nonexistent_volume)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index b738e82..d8294f7 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -365,7 +365,7 @@
return address['addr']
raise exceptions.ServerUnreachable(server_id=server['id'])
else:
- raise exceptions.InvalidConfiguration()
+ raise lib_exc.InvalidConfiguration()
def setUp(self):
super(BaseV2ComputeTest, self).setUp()
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index 999233d..26d4efe 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -20,7 +20,7 @@
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
-from tempest import exceptions
+from tempest.lib import exceptions
from tempest import test
CONF = config.CONF
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 6c417f1..19e2880 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -45,35 +45,18 @@
super(ImagesOneServerTestJSON, cls).setup_clients()
cls.client = cls.compute_images_client
- @classmethod
- def resource_setup(cls):
- super(ImagesOneServerTestJSON, cls).resource_setup()
- server = cls.create_test_server(wait_until='ACTIVE')
- cls.server_id = server['id']
-
def _get_default_flavor_disk_size(self, flavor_id):
flavor = self.flavors_client.show_flavor(flavor_id)['flavor']
return flavor['disk']
- @classmethod
- def _rebuild_server_when_fails(cls, server_id):
- try:
- waiters.wait_for_server_status(cls.servers_client,
- server_id, 'ACTIVE')
- except Exception:
- LOG.exception('server %s timed out to become ACTIVE. rebuilding'
- % server_id)
- # Rebuild server if cannot reach the ACTIVE state
- # Usually it means the server had a serious accident
- cls.server_id = cls.rebuild_server(server_id)
-
@test.idempotent_id('3731d080-d4c5-4872-b41a-64d0d0021314')
def test_create_delete_image(self):
+ server_id = self.create_test_server(wait_until='ACTIVE')['id']
# Create a new image
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
- body = self.client.create_image(self.server_id, name=name,
+ body = self.client.create_image(server_id, name=name,
metadata=meta)
image_id = data_utils.parse_image_id(body.response['location'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
@@ -98,10 +81,11 @@
# Verify the image was deleted correctly
self.client.delete_image(image_id)
self.client.wait_for_resource_deletion(image_id)
- self.addCleanup(self._rebuild_server_when_fails, self.server_id)
@test.idempotent_id('3b7c6fe4-dfe7-477c-9243-b06359db51e6')
def test_create_image_specify_multibyte_character_image_name(self):
+ server_id = self.create_test_server(wait_until='ACTIVE')['id']
+
# prefix character is:
# http://www.fileformat.info/info/unicode/char/1F4A9/index.htm
@@ -109,7 +93,6 @@
# #1370954 in glance which will 500 if mysql is used as the
# backend and it attempts to store a 4 byte utf-8 character
utf8_name = data_utils.rand_name('\xe2\x82\xa1')
- body = self.client.create_image(self.server_id, name=utf8_name)
+ body = self.client.create_image(server_id, name=utf8_name)
image_id = data_utils.parse_image_id(body.response['location'])
self.addCleanup(self.client.delete_image, image_id)
- self.addCleanup(self._rebuild_server_when_fails, self.server_id)
diff --git a/tempest/api/network/admin/test_routers_dvr.py b/tempest/api/network/admin/test_routers_dvr.py
index 66feba8..aaac921 100644
--- a/tempest/api/network/admin/test_routers_dvr.py
+++ b/tempest/api/network/admin/test_routers_dvr.py
@@ -98,15 +98,22 @@
attribute will be set to True
"""
name = data_utils.rand_name('router')
+ tenant_id = self.routers_client.tenant_id
# router needs to be in admin state down in order to be upgraded to DVR
# l3ha routers are not upgradable to dvr, make it explicitly non ha
router = self.admin_routers_client.create_router(name=name,
distributed=False,
admin_state_up=False,
- ha=False)
+ ha=False,
+ tenant_id=tenant_id)
+ router_id = router['router']['id']
self.addCleanup(self.admin_routers_client.delete_router,
- router['router']['id'])
+ router_id)
self.assertFalse(router['router']['distributed'])
router = self.admin_routers_client.update_router(
- router['router']['id'], distributed=True)
+ router_id, distributed=True)
self.assertTrue(router['router']['distributed'])
+ show_body = self.admin_routers_client.show_router(router_id)
+ self.assertTrue(show_body['router']['distributed'])
+ show_body = self.routers_client.show_router(router_id)
+ self.assertNotIn('distributed', show_body['router'])
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index 6b0c20f..d2056c4 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -27,39 +27,11 @@
CONF = config.CONF
-class NetworksTest(base.BaseNetworkTest):
- """Tests the following operations in the Neutron API:
-
- create a network for a project
- list project's networks
- show a project network details
- create a subnet for a project
- list project's subnets
- show a project subnet details
- network update
- subnet update
- delete a network also deletes its subnets
- list external networks
-
- All subnet tests are run once with ipv4 and once with ipv6.
-
- v2.0 of the Neutron API is assumed. It is also assumed that the following
- options are defined in the [network] section of etc/tempest.conf:
-
- project_network_cidr with a block of cidr's from which smaller blocks
- can be allocated for project ipv4 subnets
-
- project_network_v6_cidr is the equivalent for ipv6 subnets
-
- project_network_mask_bits with the mask bits to be used to partition
- the block defined by project_network_cidr
-
- project_network_v6_mask_bits is the equivalent for ipv6 subnets
- """
+class BaseNetworkTestResources(base.BaseNetworkTest):
@classmethod
def resource_setup(cls):
- super(NetworksTest, cls).resource_setup()
+ super(BaseNetworkTestResources, cls).resource_setup()
cls.network = cls.create_network()
cls.name = cls.network['name']
cls.subnet = cls._create_subnet_with_last_subnet_block(cls.network,
@@ -171,6 +143,37 @@
self.networks.pop()
self.subnets.pop()
+
+class NetworksTest(BaseNetworkTestResources):
+ """Tests the following operations in the Neutron API:
+
+ create a network for a project
+ list project's networks
+ show a project network details
+ create a subnet for a project
+ list project's subnets
+ show a project subnet details
+ network update
+ subnet update
+ delete a network also deletes its subnets
+ list external networks
+
+ All subnet tests are run once with ipv4 and once with ipv6.
+
+ v2.0 of the Neutron API is assumed. It is also assumed that the following
+ options are defined in the [network] section of etc/tempest.conf:
+
+ project_network_cidr with a block of cidr's from which smaller blocks
+ can be allocated for project ipv4 subnets
+
+ project_network_v6_cidr is the equivalent for ipv6 subnets
+
+ project_network_mask_bits with the mask bits to be used to partition
+ the block defined by project_network_cidr
+
+ project_network_v6_mask_bits is the equivalent for ipv6 subnets
+ """
+
@test.attr(type='smoke')
@test.idempotent_id('0e269138-0da6-4efc-a46d-578161e7b221')
def test_create_update_delete_network_subnet(self):
@@ -559,7 +562,9 @@
'Subnet are not in the same network')
-class NetworksIpV6TestAttrs(NetworksIpV6Test):
+class NetworksIpV6TestAttrs(BaseNetworkTestResources):
+
+ _ip_version = 6
@classmethod
def skip_checks(cls):
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index de2e71f..ed6a302 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -390,35 +390,3 @@
class RoutersIpV6Test(RoutersTest):
_ip_version = 6
-
-
-class DvrRoutersTest(base.BaseRouterTest):
-
- @classmethod
- def skip_checks(cls):
- super(DvrRoutersTest, cls).skip_checks()
- if not test.is_extension_enabled('dvr', 'network'):
- msg = "DVR extension not enabled."
- raise cls.skipException(msg)
-
- @test.idempotent_id('141297aa-3424-455d-aa8d-f2d95731e00a')
- def test_create_distributed_router(self):
- name = data_utils.rand_name('router')
- create_body = self.admin_routers_client.create_router(
- name=name, distributed=True)
- self.addCleanup(self._delete_router,
- create_body['router']['id'],
- self.admin_routers_client)
- self.assertTrue(create_body['router']['distributed'])
-
- @test.idempotent_id('644d7a4a-01a1-4b68-bb8d-0c0042cb1729')
- def test_convert_centralized_router(self):
- router = self._create_router()
- self.assertNotIn('distributed', router)
- update_body = self.admin_routers_client.update_router(router['id'],
- distributed=True)
- self.assertTrue(update_body['router']['distributed'])
- show_body = self.admin_routers_client.show_router(router['id'])
- self.assertTrue(show_body['router']['distributed'])
- show_body = self.routers_client.show_router(router['id'])
- self.assertNotIn('distributed', show_body['router'])
diff --git a/tempest/api/object_storage/test_account_bulk.py b/tempest/api/object_storage/test_account_bulk.py
index 7292ee9..a75ed98 100644
--- a/tempest/api/object_storage/test_account_bulk.py
+++ b/tempest/api/object_storage/test_account_bulk.py
@@ -66,7 +66,7 @@
self.assertNotIn(container_name, body)
@test.idempotent_id('a407de51-1983-47cc-9f14-47c2b059413c')
- @test.requires_ext(extension='bulk', service='object')
+ @test.requires_ext(extension='bulk_upload', service='object')
def test_extract_archive(self):
# Test bulk operation of file upload with an archived file
filepath, container_name, object_name = self._create_archive()
@@ -102,7 +102,7 @@
self.assertIn(object_name, [c['name'] for c in contents_list])
@test.idempotent_id('c075e682-0d2a-43b2-808d-4116200d736d')
- @test.requires_ext(extension='bulk', service='object')
+ @test.requires_ext(extension='bulk_delete', service='object')
def test_bulk_delete(self):
# Test bulk operation of deleting multiple files
filepath, container_name, object_name = self._create_archive()
@@ -129,7 +129,7 @@
self._check_contents_deleted(container_name)
@test.idempotent_id('dbea2bcb-efbb-4674-ac8a-a5a0e33d1d79')
- @test.requires_ext(extension='bulk', service='object')
+ @test.requires_ext(extension='bulk_delete', service='object')
def test_bulk_delete_by_POST(self):
# Test bulk operation of deleting multiple files
filepath, container_name, object_name = self._create_archive()
diff --git a/tempest/api/volume/admin/v2/test_volumes_list.py b/tempest/api/volume/admin/v2/test_volumes_list.py
index 4437803..cdd9df9 100644
--- a/tempest/api/volume/admin/v2/test_volumes_list.py
+++ b/tempest/api/volume/admin/v2/test_volumes_list.py
@@ -29,7 +29,9 @@
def resource_setup(cls):
super(VolumesListAdminV2TestJSON, cls).resource_setup()
# Create 3 test volumes
- cls.volume_list = []
+ # NOTE(zhufl): When using pre-provisioned credentials, the project
+ # may have volumes other than those created below.
+ cls.volume_list = cls.volumes_client.list_volumes()['volumes']
for i in range(3):
volume = cls.create_volume()
# Fetch volume details
@@ -59,5 +61,6 @@
# primary tenant
fetched_tenant_id = [operator.itemgetter(
'os-vol-tenant-attr:tenant_id')(item) for item in fetched_list]
- expected_tenant_id = [self.volumes_client.tenant_id] * 3
+ expected_tenant_id = [self.volumes_client.tenant_id] * \
+ len(self.volume_list)
self.assertEqual(expected_tenant_id, fetched_tenant_id)
diff --git a/tempest/api/volume/v3/base.py b/tempest/api/volume/v3/base.py
index c31c83c..e38f947 100644
--- a/tempest/api/volume/v3/base.py
+++ b/tempest/api/volume/v3/base.py
@@ -44,7 +44,7 @@
@classmethod
def setup_clients(cls):
super(VolumesV3Test, cls).setup_clients()
- cls.messages_client = cls.os.volume_messages_client
+ cls.messages_client = cls.os.volume_v3_messages_client
def setUp(self):
super(VolumesV3Test, self).setUp()
@@ -60,5 +60,5 @@
@classmethod
def setup_clients(cls):
super(VolumesV3AdminTest, cls).setup_clients()
- cls.admin_messages_client = cls.os_adm.volume_messages_client
+ cls.admin_messages_client = cls.os_adm.volume_v3_messages_client
cls.admin_volume_types_client = cls.os_adm.volume_types_v2_client
diff --git a/tempest/clients.py b/tempest/clients.py
index 0158efd..d131dc4 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -292,7 +292,7 @@
self.snapshots_v2_client = self.volume_v2.SnapshotsClient()
self.volumes_client = self.volume_v1.VolumesClient()
self.volumes_v2_client = self.volume_v2.VolumesClient()
- self.volume_messages_client = volume.v3.MessagesClient(
+ self.volume_v3_messages_client = volume.v3.MessagesClient(
self.auth_provider, **params)
self.volume_types_client = self.volume_v1.TypesClient()
self.volume_types_v2_client = self.volume_v2.TypesClient()
diff --git a/tempest/lib/api_schema/response/compute/v2_1/parameter_types.py b/tempest/lib/api_schema/response/compute/v2_1/parameter_types.py
index 07cc890..3cc5ca4 100644
--- a/tempest/lib/api_schema/response/compute/v2_1/parameter_types.py
+++ b/tempest/lib/api_schema/response/compute/v2_1/parameter_types.py
@@ -94,3 +94,14 @@
'format': 'data-time'
}
}
+
+power_state = {
+ 'type': 'integer',
+ # 0: NOSTATE
+ # 1: RUNNING
+ # 3: PAUSED
+ # 4: SHUTDOWN
+ # 6: CRASHED
+ # 7: SUSPENDED
+ 'enum': [0, 1, 3, 4, 6, 7]
+}
diff --git a/tempest/lib/api_schema/response/compute/v2_1/servers.py b/tempest/lib/api_schema/response/compute/v2_1/servers.py
index 44497db..63e8467 100644
--- a/tempest/lib/api_schema/response/compute/v2_1/servers.py
+++ b/tempest/lib/api_schema/response/compute/v2_1/servers.py
@@ -170,7 +170,7 @@
# attributes.
'OS-EXT-STS:task_state': {'type': ['string', 'null']},
'OS-EXT-STS:vm_state': {'type': 'string'},
- 'OS-EXT-STS:power_state': {'type': 'integer'},
+ 'OS-EXT-STS:power_state': parameter_types.power_state,
'OS-EXT-SRV-ATTR:host': {'type': ['string', 'null']},
'OS-EXT-SRV-ATTR:instance_name': {'type': 'string'},
'OS-EXT-SRV-ATTR:hypervisor_hostname': {'type': ['string', 'null']},
diff --git a/tempest/lib/api_schema/response/compute/v2_16/servers.py b/tempest/lib/api_schema/response/compute/v2_16/servers.py
index 6868110..3eb658f 100644
--- a/tempest/lib/api_schema/response/compute/v2_16/servers.py
+++ b/tempest/lib/api_schema/response/compute/v2_16/servers.py
@@ -77,7 +77,7 @@
'OS-EXT-AZ:availability_zone': {'type': 'string'},
'OS-EXT-STS:task_state': {'type': ['string', 'null']},
'OS-EXT-STS:vm_state': {'type': 'string'},
- 'OS-EXT-STS:power_state': {'type': 'integer'},
+ 'OS-EXT-STS:power_state': parameter_types.power_state,
'OS-EXT-SRV-ATTR:host': {'type': ['string', 'null']},
'OS-EXT-SRV-ATTR:instance_name': {'type': 'string'},
'OS-EXT-SRV-ATTR:hypervisor_hostname': {'type': ['string', 'null']},
diff --git a/tempest/lib/api_schema/response/compute/v2_3/servers.py b/tempest/lib/api_schema/response/compute/v2_3/servers.py
index ee16333..f24103e 100644
--- a/tempest/lib/api_schema/response/compute/v2_3/servers.py
+++ b/tempest/lib/api_schema/response/compute/v2_3/servers.py
@@ -85,7 +85,7 @@
'OS-EXT-AZ:availability_zone': {'type': 'string'},
'OS-EXT-STS:task_state': {'type': ['string', 'null']},
'OS-EXT-STS:vm_state': {'type': 'string'},
- 'OS-EXT-STS:power_state': {'type': 'integer'},
+ 'OS-EXT-STS:power_state': parameter_types.power_state,
'OS-EXT-SRV-ATTR:host': {'type': ['string', 'null']},
'OS-EXT-SRV-ATTR:instance_name': {'type': 'string'},
'OS-EXT-SRV-ATTR:hypervisor_hostname': {'type': ['string', 'null']},
diff --git a/tempest/lib/services/volume/v1/volumes_client.py b/tempest/lib/services/volume/v1/volumes_client.py
index 3df8da4..cc98c91 100644
--- a/tempest/lib/services/volume/v1/volumes_client.py
+++ b/tempest/lib/services/volume/v1/volumes_client.py
@@ -22,7 +22,7 @@
class VolumesClient(rest_client.RestClient):
- """Base client class to send CRUD Volume API requests"""
+ """Client class to send CRUD Volume V1 API requests"""
def _prepare_params(self, params):
"""Prepares params for use in get or _ext_get methods.
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 2215c80..8b86267 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -141,6 +141,9 @@
if clients is None:
clients = self.manager
+ if name is None:
+ name = data_utils.rand_name(self.__class__.__name__ + "-server")
+
vnic_type = CONF.network.port_vnic_type
# If vnic_type is configured create port for
@@ -402,10 +405,14 @@
servers = self.servers_client.list_servers()
servers = servers['servers']
for server in servers:
- console_output = self.servers_client.get_console_output(
- server['id'])['output']
- LOG.debug('Console output for %s\nbody=\n%s',
- server['id'], console_output)
+ try:
+ console_output = self.servers_client.get_console_output(
+ server['id'])['output']
+ LOG.debug('Console output for %s\nbody=\n%s',
+ server['id'], console_output)
+ except lib_exc.NotFound:
+ LOG.debug("Server %s disappeared(deleted) while looking "
+ "for the console log", server['id'])
def _log_net_info(self, exc):
# network debug is called as part of ssh init
@@ -676,11 +683,6 @@
if not CONF.service_available.neutron:
raise cls.skipException('Neutron not available')
- @classmethod
- def resource_setup(cls):
- super(NetworkScenarioTest, cls).resource_setup()
- cls.tenant_id = cls.manager.identity_client.tenant_id
-
def _create_network(self, networks_client=None,
routers_client=None, tenant_id=None,
namestart='network-smoke-',
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index 60b030d..0605902 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -35,6 +35,12 @@
"""
@classmethod
+ def setup_clients(cls):
+ super(TestNetworkAdvancedServerOps, cls).setup_clients()
+ cls.admin_servers_client = cls.os_adm.servers_client
+ cls.admin_hosts_client = cls.os_adm.hosts_client
+
+ @classmethod
def skip_checks(cls):
super(TestNetworkAdvancedServerOps, cls).skip_checks()
if not (CONF.network.project_networks_reachable
@@ -94,6 +100,10 @@
'ACTIVE')
self._check_network_connectivity(server, keypair, floating_ip)
+ def _get_host_for_server(self, server_id):
+ body = self.admin_servers_client.show_server(server_id)['server']
+ return body['OS-EXT-SRV-ATTR:host']
+
@test.idempotent_id('61f1aa9a-1573-410e-9054-afa557cab021')
@test.services('compute', 'network')
def test_server_connectivity_stop_start(self):
@@ -184,3 +194,29 @@
self.servers_client.confirm_resize_server(server['id'])
self._wait_server_status_and_check_network_connectivity(
server, keypair, floating_ip)
+
+ @test.idempotent_id('a4858f6c-401e-4155-9a49-d5cd053d1a2f')
+ @testtools.skipUnless(CONF.compute_feature_enabled.cold_migration,
+ 'Cold migration is not available.')
+ @test.services('compute', 'network')
+ def test_server_connectivity_cold_migration(self):
+ if CONF.compute.min_compute_nodes < 2:
+ msg = "Less than 2 compute nodes, skipping multinode tests."
+ raise self.skipException(msg)
+
+ keypair = self.create_keypair()
+ server = self._setup_server(keypair)
+ floating_ip = self._setup_network(server, keypair)
+ src_host = self._get_host_for_server(server['id'])
+ self._wait_server_status_and_check_network_connectivity(
+ server, keypair, floating_ip)
+
+ self.admin_servers_client.migrate_server(server['id'])
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'VERIFY_RESIZE')
+ self.servers_client.confirm_resize_server(server['id'])
+ self._wait_server_status_and_check_network_connectivity(
+ server, keypair, floating_ip)
+ dst_host = self._get_host_for_server(server['id'])
+
+ self.assertNotEqual(src_host, dst_host)
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 125d61a..af313a5 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -19,7 +19,6 @@
from oslo_log import log as logging
import testtools
-from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
from tempest.lib.common.utils import test_utils
@@ -105,8 +104,7 @@
def _setup_network_and_servers(self, **kwargs):
boot_with_port = kwargs.pop('boot_with_port', False)
- self.security_group = \
- self._create_security_group(tenant_id=self.tenant_id)
+ self.security_group = self._create_security_group()
self.network, self.subnet, self.router = self.create_networks(**kwargs)
self.check_networks()
@@ -117,8 +115,7 @@
self.port_id = self._create_port(self.network['id'])['id']
self.ports.append({'port': self.port_id})
- name = data_utils.rand_name('server-smoke')
- server = self._create_server(name, self.network, self.port_id)
+ server = self._create_server(self.network, self.port_id)
self._check_tenant_network_connectivity()
floating_ip = self.create_floating_ip(server)
@@ -152,7 +149,7 @@
self.assertIn(self.router['id'],
seen_router_ids)
- def _create_server(self, name, network, port_id=None):
+ def _create_server(self, network, port_id=None):
keypair = self.create_keypair()
self.keypairs[keypair['name']] = keypair
security_groups = [{'name': self.security_group['name']}]
@@ -161,7 +158,6 @@
network['port'] = port_id
server = self.create_server(
- name=name,
networks=[network],
key_name=keypair['name'],
security_groups=security_groups,
@@ -221,15 +217,14 @@
def _reassociate_floating_ips(self):
floating_ip, server = self.floating_ip_tuple
- name = data_utils.rand_name('new_server-smoke')
# create a new server for the floating ip
- server = self._create_server(name, self.network)
+ server = self._create_server(self.network)
self._associate_floating_ip(floating_ip, server)
self.floating_ip_tuple = Floating_IP_tuple(
floating_ip, server)
def _create_new_network(self, create_gateway=False):
- self.new_net = self._create_network(tenant_id=self.tenant_id)
+ self.new_net = self._create_network()
if create_gateway:
self.new_subnet = self._create_subnet(
network=self.new_net)
@@ -460,8 +455,7 @@
self._check_network_internal_connectivity(network=self.network)
self._check_network_external_connectivity()
self._create_new_network(create_gateway=True)
- name = data_utils.rand_name('server-smoke')
- self._create_server(name, self.new_net)
+ self._create_server(self.new_net)
self._check_network_internal_connectivity(network=self.new_net,
should_connect=False)
router_id = self.router['id']
@@ -689,8 +683,7 @@
# Boot another server with the same port to make sure nothing was
# left around that could cause issues.
- name = data_utils.rand_name('reuse-port')
- server = self._create_server(name, self.network, port['id'])
+ server = self._create_server(self.network, port['id'])
port_list = self._list_ports(device_id=server['id'],
network_id=self.network['id'])
self.assertEqual(1, len(port_list),
@@ -814,8 +807,7 @@
ssh_client = self.get_remote_client(fip['floating_ip_address'],
private_key=private_key)
spoof_nic = ssh_client.get_nic_name_by_mac(spoof_port["mac_address"])
- name = data_utils.rand_name('peer')
- peer = self._create_server(name, self.new_net)
+ peer = self._create_server(self.new_net)
peer_address = peer['addresses'][self.new_net['name']][0]['addr']
self._check_remote_connectivity(ssh_client, dest=peer_address,
nic=spoof_nic, should_succeed=True)
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index 496f07e..6700236 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -63,7 +63,7 @@
def setUp(self):
super(TestGettingAddress, self).setUp()
self.keypair = self.create_keypair()
- self.sec_grp = self._create_security_group(tenant_id=self.tenant_id)
+ self.sec_grp = self._create_security_group()
def prepare_network(self, address6_mode, n_subnets6=1, dualnet=False):
"""Prepare network
@@ -74,15 +74,15 @@
if dualnet - create IPv6 subnets on a different network
:return: list of created networks
"""
- self.network = self._create_network(tenant_id=self.tenant_id)
+ self.network = self._create_network()
if dualnet:
- self.network_v6 = self._create_network(tenant_id=self.tenant_id)
+ self.network_v6 = self._create_network()
sub4 = self._create_subnet(network=self.network,
namestart='sub4',
ip_version=4)
- router = self._get_router(tenant_id=self.tenant_id)
+ router = self._get_router()
self.routers_client.add_router_interface(router['id'],
subnet_id=sub4['id'])
diff --git a/tempest/scenario/test_object_storage_basic_ops.py b/tempest/scenario/test_object_storage_basic_ops.py
index 9ac1e30..1d2b2b6 100644
--- a/tempest/scenario/test_object_storage_basic_ops.py
+++ b/tempest/scenario/test_object_storage_basic_ops.py
@@ -18,23 +18,21 @@
class TestObjectStorageBasicOps(manager.ObjectStorageScenarioTest):
- """Test swift basic ops.
-
- * get swift stat.
- * create container.
- * upload a file to the created container.
- * list container's objects and assure that the uploaded file is present.
- * download the object and check the content
- * delete object from container.
- * list container's objects and assure that the deleted file is gone.
- * delete a container.
- * list containers and assure that the deleted container is gone.
- * change ACL of the container and make sure it works successfully
- """
-
@test.idempotent_id('b920faf1-7b8a-4657-b9fe-9c4512bfb381')
@test.services('object_storage')
def test_swift_basic_ops(self):
+ """Test swift basic ops.
+
+ * get swift stat.
+ * create container.
+ * upload a file to the created container.
+ * list container's objects and assure that the uploaded file is
+ present.
+ * download the object and check the content
+ * delete object from container.
+ * list container's objects and assure that the deleted file is gone.
+ * delete a container.
+ """
self.get_swift_stat()
container_name = self.create_container()
obj_name, obj_data = self.upload_object_to_container(container_name)
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index e031ff7..c66128d 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -119,14 +119,13 @@
@test.services('compute', 'network')
def test_server_basic_ops(self):
keypair = self.create_keypair()
- self.security_group = self._create_security_group()
- security_groups = [{'name': self.security_group['name']}]
+ security_group = self._create_security_group()
self.md = {'meta1': 'data1', 'meta2': 'data2', 'metaN': 'dataN'}
self.instance = self.create_server(
image_id=self.image_ref,
flavor=self.flavor_ref,
key_name=keypair['name'],
- security_groups=security_groups,
+ security_groups=[{'name': security_group['name']}],
config_drive=CONF.compute_feature_enabled.config_drive,
metadata=self.md,
wait_until='ACTIVE')
diff --git a/tempest/tests/lib/services/network/test_versions_client.py b/tempest/tests/lib/services/network/test_versions_client.py
index ae52c8a..026dc6d 100644
--- a/tempest/tests/lib/services/network/test_versions_client.py
+++ b/tempest/tests/lib/services/network/test_versions_client.py
@@ -35,10 +35,7 @@
"type": "text/html"
}
],
- "status": "CURRENT",
- "updated": "2013-07-23T11:33:21Z",
- "version": "2.0",
- "min_version": "2.0"
+ "status": "CURRENT"
}
}