Merge "Add mac info to test_list_virtual_interfaces"
diff --git a/HACKING.rst b/HACKING.rst
index 8e0ac44..a918f4a 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -72,11 +72,10 @@
Most other assert method can include more information by default.
For example ``self.assertIn`` can include the whole set.
-It is recommended to use testtools matcher for the more tricky assertions.
-`[doc] <http://testtools.readthedocs.org/en/latest/for-test-authors.html#matchers>`_
+It is recommended to use testtools `matcher`_ for the more tricky assertions.
+You can implement your own specific `matcher`_ as well.
-You can implement your own specific matcher as well.
-`[doc] <http://testtools.readthedocs.org/en/latest/for-test-authors.html#writing-your-own-matchers>`_
+.. _matcher: http://testtools.readthedocs.org/en/latest/for-test-authors.html#matchers
If the test case fails you can see the related logs and the information
carried by the exception (exception class, backtrack and exception info).
@@ -158,8 +157,8 @@
sections for the test (one of those is mandatory):
- A resource (part of the URL of the request): Resources needed for a test
- must be created in `setUpClass` and registered with `set_resource` e.g.:
- `cls.set_resource("server", server['id'])`
+ must be created in `setUpClass` and registered with `set_resource` e.g.:
+ `cls.set_resource("server", server['id'])`
- A json schema: defines properties for a request.
diff --git a/README.rst b/README.rst
index d94fbdd..7108eaf 100644
--- a/README.rst
+++ b/README.rst
@@ -191,8 +191,6 @@
$> testr run --parallel
-.. _testr: http://testrepository.readthedocs.org/en/latest/MANUAL.html
-
To run one single test serially ::
$> testr run tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_reboot_non_existent_server
diff --git a/REVIEWING.rst b/REVIEWING.rst
index 74bd2ad..12ccb75 100644
--- a/REVIEWING.rst
+++ b/REVIEWING.rst
@@ -34,7 +34,7 @@
Reject Copy and Paste Test Code
-------------------------
+-------------------------------
When creating new tests that are similar to existing tests it is tempting to
simply copy the code and make a few modifications. This increases code size and
the maintenance burden. Such changes should not be approved if it is easy to
diff --git a/doc/source/account_generator.rst b/doc/source/account_generator.rst
index 1c30473..032a20d 100644
--- a/doc/source/account_generator.rst
+++ b/doc/source/account_generator.rst
@@ -1,5 +1,5 @@
---------------------------------
+--------------------------------------
Tempest Test-Account Generator Utility
---------------------------------
+--------------------------------------
-.. automodule:: tempest.cmd.account_generator
\ No newline at end of file
+.. automodule:: tempest.cmd.account_generator
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 3c109b5..ec430b7 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -6,7 +6,8 @@
This guide is a starting point for configuring tempest. It aims to elaborate
on and explain some of the mandatory and common configuration settings and how
they are used in conjunction. The source of truth on each option is the sample
-config file which explains the purpose of each individual option.
+config file which explains the purpose of each individual option. You can see
+the sample config file here: :ref:`tempest-sampleconf`
Lock Path
---------
diff --git a/doc/source/index.rst b/doc/source/index.rst
index e9f2161..fe6074f 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -24,7 +24,6 @@
field_guide/index
field_guide/api
- field_guide/cli
field_guide/scenario
field_guide/stress
field_guide/thirdparty
diff --git a/requirements.txt b/requirements.txt
index cc2a187..5ebcb65 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -9,7 +9,7 @@
testtools>=1.4.0
boto>=2.32.1
paramiko>=1.13.0
-netaddr>=0.7.12
+netaddr>=0.7.12,!=0.7.16
testrepository>=0.0.18
pyOpenSSL>=0.14
oslo.concurrency>=2.3.0 # Apache-2.0
diff --git a/setup.cfg b/setup.cfg
index ab40f12..46e21f1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -42,5 +42,8 @@
build-dir = doc/build
source-dir = doc/source
+[pbr]
+warnerrors = True
+
[wheel]
universal = 1
diff --git a/tempest/README.rst b/tempest/README.rst
index fec2874..f93a173 100644
--- a/tempest/README.rst
+++ b/tempest/README.rst
@@ -57,7 +57,7 @@
stress job.
:ref:`third_party_field_guide`
------------------------------
+------------------------------
Many openstack components include 3rdparty API support. It is
completely legitimate for Tempest to include tests of 3rdparty APIs,
diff --git a/tempest/api/compute/admin/test_migrations.py b/tempest/api/compute/admin/test_migrations.py
index 0809bb4..f81d665 100644
--- a/tempest/api/compute/admin/test_migrations.py
+++ b/tempest/api/compute/admin/test_migrations.py
@@ -45,7 +45,7 @@
self.servers_client.resize_server(server_id, self.flavor_ref_alt)
waiters.wait_for_server_status(self.servers_client,
server_id, 'VERIFY_RESIZE')
- self.servers_client.confirm_resize(server_id)
+ self.servers_client.confirm_resize_server(server_id)
waiters.wait_for_server_status(self.servers_client,
server_id, 'ACTIVE')
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index a25a2af..2624fca 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -89,6 +89,7 @@
cls.migrations_client = cls.os.migrations_client
cls.security_group_default_rules_client = (
cls.os.security_group_default_rules_client)
+ cls.versions_client = cls.os.compute_versions_client
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index 7f23730..126d092 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -74,7 +74,7 @@
@test.idempotent_id('aaacd1d0-55a2-4ce8-818a-b5439df8adc9')
def test_create_image_from_stopped_server(self):
server = self.create_test_server(wait_until='ACTIVE')
- self.servers_client.stop(server['id'])
+ self.servers_client.stop_server(server['id'])
waiters.wait_for_server_status(self.servers_client,
server['id'], 'SHUTOFF')
self.addCleanup(self.servers_client.delete_server, server['id'])
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index cf0cf97..d7b4470 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -51,7 +51,7 @@
def test_delete_server_while_in_shutoff_state(self):
# Delete a server while it's VM state is Shutoff
server = self.create_test_server(wait_until='ACTIVE')
- self.client.stop(server['id'])
+ self.client.stop_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
diff --git a/tempest/api/compute/servers/test_disk_config.py b/tempest/api/compute/servers/test_disk_config.py
index 5b9338a..929b300 100644
--- a/tempest/api/compute/servers/test_disk_config.py
+++ b/tempest/api/compute/servers/test_disk_config.py
@@ -105,7 +105,7 @@
disk_config='AUTO')
waiters.wait_for_server_status(self.client, self.server_id,
'VERIFY_RESIZE')
- self.client.confirm_resize(self.server_id)
+ self.client.confirm_resize_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
server = self.client.show_server(self.server_id)
@@ -124,7 +124,7 @@
disk_config='MANUAL')
waiters.wait_for_server_status(self.client, self.server_id,
'VERIFY_RESIZE')
- self.client.confirm_resize(self.server_id)
+ self.client.confirm_resize_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
server = self.client.show_server(self.server_id)
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index 5c63557..16e4392 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -137,11 +137,11 @@
def test_list_servers_filter_by_shutoff_status(self):
# Filter the list of servers by server shutoff status
params = {'status': 'shutoff'}
- self.client.stop(self.s1['id'])
+ self.client.stop_server(self.s1['id'])
waiters.wait_for_server_status(self.client, self.s1['id'],
'SHUTOFF')
body = self.client.list_servers(**params)
- self.client.start(self.s1['id'])
+ self.client.start_server(self.s1['id'])
waiters.wait_for_server_status(self.client, self.s1['id'],
'ACTIVE')
servers = body['servers']
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 6b3b661..47629c0 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -191,7 +191,7 @@
old_image = server['image']['id']
new_image = (self.image_ref_alt
if old_image == self.image_ref else self.image_ref)
- self.client.stop(self.server_id)
+ self.client.stop_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'SHUTOFF')
rebuilt_server = self.client.rebuild_server(self.server_id, new_image)
# If the server was rebuilt on a different image, restore it to the
@@ -212,14 +212,14 @@
rebuilt_image_id = server['image']['id']
self.assertEqual(new_image, rebuilt_image_id)
- self.client.start(self.server_id)
+ self.client.start_server(self.server_id)
def _test_resize_server_confirm(self, stop=False):
# The server's RAM and disk space should be modified to that of
# the provided flavor
if stop:
- self.client.stop(self.server_id)
+ self.client.stop_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id,
'SHUTOFF')
@@ -227,7 +227,7 @@
waiters.wait_for_server_status(self.client, self.server_id,
'VERIFY_RESIZE')
- self.client.confirm_resize(self.server_id)
+ self.client.confirm_resize_server(self.server_id)
expected_status = 'SHUTOFF' if stop else 'ACTIVE'
waiters.wait_for_server_status(self.client, self.server_id,
expected_status)
@@ -237,7 +237,7 @@
if stop:
# NOTE(mriedem): tearDown requires the server to be started.
- self.client.start(self.server_id)
+ self.client.start_server(self.server_id)
# NOTE(jlk): Explicitly delete the server to get a new one for later
# tests. Avoids resize down race issues.
@@ -266,7 +266,7 @@
waiters.wait_for_server_status(self.client, self.server_id,
'VERIFY_RESIZE')
- self.client.revert_resize(self.server_id)
+ self.client.revert_resize_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
server = self.client.show_server(self.server_id)
@@ -411,7 +411,7 @@
server = self.create_test_server(wait_until='ACTIVE')
temp_server_id = server['id']
- self.client.stop(temp_server_id)
+ self.client.stop_server(temp_server_id)
waiters.wait_for_server_status(self.client, temp_server_id, 'SHUTOFF')
self.wait_for(self._get_output)
@@ -465,9 +465,9 @@
@test.idempotent_id('af8eafd4-38a7-4a4b-bdbc-75145a580560')
def test_stop_start_server(self):
- self.client.stop(self.server_id)
+ self.client.stop_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'SHUTOFF')
- self.client.start(self.server_id)
+ self.client.start_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
@test.idempotent_id('80a8094c-211e-440a-ab88-9e59d556c7ee')
@@ -479,11 +479,11 @@
self.assertEqual(server['status'], 'ACTIVE')
# Locked server is not allowed to be stopped by non-admin user
self.assertRaises(lib_exc.Conflict,
- self.client.stop, self.server_id)
+ self.client.stop_server, self.server_id)
self.client.unlock_server(self.server_id)
- self.client.stop(self.server_id)
+ self.client.stop_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'SHUTOFF')
- self.client.start(self.server_id)
+ self.client.start_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
def _validate_url(self, url):
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index c243adf..8cfb670 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -95,7 +95,7 @@
def test_update_server_name_in_stop_state(self):
# The server name should be changed to the the provided value
server = self.create_test_server(wait_until='ACTIVE')
- self.client.stop(server['id'])
+ self.client.stop_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
updated_server = self._update_server_name(server['id'], 'SHUTOFF')
self.assertNotIn('progress', updated_server)
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 8f81de0..d5b60da 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -243,22 +243,21 @@
def test_update_name_of_non_existent_server(self):
# Update name of a non-existent server
- server_name = data_utils.rand_name('server')
+ nonexistent_server = data_utils.rand_uuid()
new_name = data_utils.rand_name('server') + '_updated'
self.assertRaises(lib_exc.NotFound, self.client.update_server,
- server_name, name=new_name)
+ nonexistent_server, name=new_name)
@test.attr(type=['negative'])
@test.idempotent_id('38204696-17c6-44da-9590-40f87fb5a899')
def test_update_server_set_empty_name(self):
# Update name of the server to an empty string
- server_name = data_utils.rand_name('server')
new_name = ''
self.assertRaises(lib_exc.BadRequest, self.client.update_server,
- server_name, name=new_name)
+ self.server_id, name=new_name)
@test.attr(type=['negative'])
@test.idempotent_id('543d84c1-dd2e-4c6d-8cb2-b9da0efaa384')
@@ -336,7 +335,7 @@
def test_stop_non_existent_server(self):
# Stop a non existent server
nonexistent_server = data_utils.rand_uuid()
- self.assertRaises(lib_exc.NotFound, self.servers_client.stop,
+ self.assertRaises(lib_exc.NotFound, self.servers_client.stop_server,
nonexistent_server)
@test.idempotent_id('6a8dc0c6-6cd4-4c0a-9f32-413881828091')
diff --git a/tempest/api/compute/test_versions.py b/tempest/api/compute/test_versions.py
new file mode 100644
index 0000000..369cf31
--- /dev/null
+++ b/tempest/api/compute/test_versions.py
@@ -0,0 +1,24 @@
+# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
+#
+# 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 import test
+
+
+class TestVersions(base.BaseComputeTest):
+
+ @test.idempotent_id('6c0a0990-43b6-4529-9b61-5fd8daf7c55c')
+ def test_list_api_versions(self):
+ result = self.versions_client.list_versions()
+ self.assertIsNotNone(result)
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 6496854..abff422 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -97,11 +97,11 @@
# the volume remains attached.
self._create_and_attach()
- self.servers_client.stop(self.server['id'])
+ self.servers_client.stop_server(self.server['id'])
waiters.wait_for_server_status(self.servers_client, self.server['id'],
'SHUTOFF')
- self.servers_client.start(self.server['id'])
+ self.servers_client.start_server(self.server['id'])
waiters.wait_for_server_status(self.servers_client, self.server['id'],
'ACTIVE')
@@ -116,11 +116,11 @@
self._detach(self.server['id'], self.volume['id'])
self.attachment = None
- self.servers_client.stop(self.server['id'])
+ self.servers_client.stop_server(self.server['id'])
waiters.wait_for_server_status(self.servers_client, self.server['id'],
'SHUTOFF')
- self.servers_client.start(self.server['id'])
+ self.servers_client.start_server(self.server['id'])
waiters.wait_for_server_status(self.servers_client, self.server['id'],
'ACTIVE')
diff --git a/tempest/api/network/test_extensions.py b/tempest/api/network/test_extensions.py
index f56688f..d6b03eb 100644
--- a/tempest/api/network/test_extensions.py
+++ b/tempest/api/network/test_extensions.py
@@ -40,7 +40,7 @@
'agent', 'dhcp_agent_scheduler', 'provider',
'router', 'extraroute', 'external-net',
'allowed-address-pairs', 'extra_dhcp_opt',
- 'metering', 'dvr', 'service-type']
+ 'metering', 'dvr']
expected_alias = [ext for ext in expected_alias if
test.is_extension_enabled(ext, 'network')]
actual_alias = list()
diff --git a/tempest/api/network/test_networks_negative.py b/tempest/api/network/test_networks_negative.py
index 5dc1c21..94c3f9a 100644
--- a/tempest/api/network/test_networks_negative.py
+++ b/tempest/api/network/test_networks_negative.py
@@ -26,35 +26,35 @@
@test.attr(type=['negative'])
@test.idempotent_id('9293e937-824d-42d2-8d5b-e985ea67002a')
def test_show_non_existent_network(self):
- non_exist_id = data_utils.rand_name('network')
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.show_network,
non_exist_id)
@test.attr(type=['negative'])
@test.idempotent_id('d746b40c-5e09-4043-99f7-cba1be8b70df')
def test_show_non_existent_subnet(self):
- non_exist_id = data_utils.rand_name('subnet')
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.show_subnet,
non_exist_id)
@test.attr(type=['negative'])
@test.idempotent_id('a954861d-cbfd-44e8-b0a9-7fab111f235d')
def test_show_non_existent_port(self):
- non_exist_id = data_utils.rand_name('port')
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.show_port,
non_exist_id)
@test.attr(type=['negative'])
@test.idempotent_id('98bfe4e3-574e-4012-8b17-b2647063de87')
def test_update_non_existent_network(self):
- non_exist_id = data_utils.rand_name('network')
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.update_network,
non_exist_id, name="new_name")
@test.attr(type=['negative'])
@test.idempotent_id('03795047-4a94-4120-a0a1-bd376e36fd4e')
def test_delete_non_existent_network(self):
- non_exist_id = data_utils.rand_name('network')
+ non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.delete_network,
non_exist_id)
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 5d1784f..8f07614 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -15,6 +15,7 @@
from oslo_utils import timeutils
from tempest_lib import exceptions as lib_exc
+from tempest.common import compute
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
@@ -73,9 +74,11 @@
@classmethod
def create_server(cls):
- body = cls.servers_client.create_server(
- data_utils.rand_name('ceilometer-instance'),
- CONF.compute.image_ref, CONF.compute.flavor_ref,
+ tenant_network = cls.get_tenant_network()
+ body, server = compute.create_test_server(
+ cls.os,
+ tenant_network=tenant_network,
+ name=data_utils.rand_name('ceilometer-instance'),
wait_until='ACTIVE')
cls.server_ids.append(body['id'])
return body
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index 9db2321..db156f0 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import testtools
from testtools import matchers
from tempest.api.volume import base
@@ -138,6 +139,8 @@
imageRef=CONF.compute.image_ref, size=disk_size)
@test.idempotent_id('3f591b4a-7dc6-444c-bd51-77469506b3a1')
+ @testtools.skipUnless(CONF.volume_feature_enabled.clone,
+ 'Cinder volume clones are disabled')
def test_volume_create_get_update_delete_as_clone(self):
origin = self.create_volume()
self._volume_create_get_update_delete(source_volid=origin['id'])
diff --git a/tempest/api_schema/response/compute/v2_1/version.py b/tempest/api_schema/response/compute/v2_1/version.py
deleted file mode 100644
index 6579c63..0000000
--- a/tempest/api_schema/response/compute/v2_1/version.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-version = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'version': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'links': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'href': {'type': 'string', 'format': 'uri'},
- 'rel': {'type': 'string'},
- 'type': {'type': 'string'}
- },
- 'required': ['href', 'rel']
- }
- },
- 'media-types': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'base': {'type': 'string'},
- 'type': {'type': 'string'}
- },
- 'required': ['base', 'type']
- }
- },
- 'status': {'type': 'string'},
- 'updated': {'type': 'string', 'format': 'date-time'},
- 'version': {'type': 'string'},
- 'min_version': {'type': 'string'}
- },
- # NOTE: version and min_version have been added since Kilo,
- # so they should not be required.
- 'required': ['id', 'links', 'media-types', 'status', 'updated']
- }
- },
- 'required': ['version']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/versions.py b/tempest/api_schema/response/compute/v2_1/versions.py
new file mode 100644
index 0000000..a01dd41
--- /dev/null
+++ b/tempest/api_schema/response/compute/v2_1/versions.py
@@ -0,0 +1,54 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+list_versions = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'versions': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string'},
+ 'links': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'href': {'type': 'string',
+ 'format': 'uri'},
+ 'rel': {'type': 'string'},
+ },
+ 'required': ['href', 'rel'],
+ 'additionalProperties': False
+ }
+ },
+ 'status': {'type': 'string'},
+ 'updated': {'type': 'string', 'format': 'date-time'},
+ 'version': {'type': 'string'},
+ 'min_version': {'type': 'string'}
+ },
+ # NOTE: version and min_version have been added since Kilo,
+ # so they should not be required.
+ 'required': ['id', 'links', 'status', 'updated'],
+ 'additionalProperties': False
+ }
+ }
+ },
+ 'required': ['versions'],
+ 'additionalProperties': False
+ }
+}
diff --git a/tempest/clients.py b/tempest/clients.py
index b9f7991..c0d4585 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -77,6 +77,7 @@
TenantNetworksClient
from tempest.services.compute.json.tenant_usages_client import \
TenantUsagesClient
+from tempest.services.compute.json.versions_client import VersionsClient
from tempest.services.compute.json.volumes_extensions_client import \
VolumesExtensionsClient
from tempest.services.data_processing.v1_1.data_processing_client import \
@@ -322,6 +323,8 @@
})
self.volumes_extensions_client = VolumesExtensionsClient(
self.auth_provider, **params_volume)
+ self.compute_versions_client = VersionsClient(self.auth_provider,
+ **params_volume)
def _set_database_clients(self):
self.database_flavors_client = DatabaseFlavorsClient(
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index e05cab3..3d24547 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -25,7 +25,7 @@
**Usage:** ``tempest-account-generator [-h] [OPTIONS] accounts_file.yaml``.
Positional Arguments
------------------
+--------------------
**accounts_file.yaml** (Required) Provide an output accounts yaml file. Utility
creates a .yaml file in the directory where the command is ran. The appropriate
name for the file is *accounts.yaml* and it should be placed in *tempest/etc*
@@ -49,7 +49,7 @@
+----------+------------------+----------------------+
Optional Arguments
------------------
+------------------
**-h**, **--help** (Optional) Shows help message with the description of
utility and its arguments, and exits.
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
index 05ea393..5c4d8af 100644
--- a/tempest/common/compute.py
+++ b/tempest/common/compute.py
@@ -27,7 +27,7 @@
def create_test_server(clients, validatable=False, validation_resources=None,
- tenant_network=None, **kwargs):
+ tenant_network=None, wait_until=None, **kwargs):
"""Common wrapper utility returning a test server.
This method is a common wrapper returning a test server that can be
@@ -37,6 +37,9 @@
:param validatable: Whether the server will be pingable or sshable.
:param validation_resources: Resources created for the connection to the
server. Include a keypair, a security group and an IP.
+ :param tenant_network: Tenant network to be used for creating a server.
+ :param wait_until: Server status to wait for the server to reach after
+ its creation.
:returns a tuple
"""
@@ -78,8 +81,8 @@
LOG.debug("No key provided.")
if CONF.validation.connect_method == 'floating':
- if 'wait_until' not in kwargs:
- kwargs['wait_until'] = 'ACTIVE'
+ if wait_until is None:
+ wait_until = 'ACTIVE'
body = clients.servers_client.create_server(name, image_id, flavor,
**kwargs)
@@ -96,11 +99,11 @@
# long for PEP8 compliance so:
assoc = clients.floating_ips_client.associate_floating_ip_to_server
- if 'wait_until' in kwargs:
+ if wait_until:
for server in servers:
try:
waiters.wait_for_server_status(
- clients.servers_client, server['id'], kwargs['wait_until'])
+ clients.servers_client, server['id'], wait_until)
# Multiple validatable servers are not supported for now. Their
# creation will fail with the condition above (l.58).
diff --git a/tempest/config.py b/tempest/config.py
index b5f1de1..b6daa2e 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -702,6 +702,9 @@
cfg.BoolOpt('snapshot',
default=True,
help='Runs Cinder volume snapshot test'),
+ cfg.BoolOpt('clone',
+ default=True,
+ help='Runs Cinder volume clone test'),
cfg.ListOpt('api_extensions',
default=['all'],
help='A list of enabled volume extensions with a special '
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index c38ce2d..31459cb 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -63,9 +63,12 @@
def nova_show(self):
got_server = self.servers_client.show_server(self.server['id'])
+ excluded_keys = ['OS-EXT-AZ:availability_zone']
+ # Exclude these keys because of LP:#1486475
+ excluded_keys.extend(['OS-EXT-STS:power_state', 'updated'])
self.assertThat(
self.server, custom_matchers.MatchesDictExceptForKeys(
- got_server, excluded_keys=['OS-EXT-AZ:availability_zone']))
+ got_server, excluded_keys=excluded_keys))
def cinder_create(self):
self.volume = self.create_volume()
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index 71c48fe..62b2976 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -100,11 +100,11 @@
@test.services('compute', 'network')
def test_server_connectivity_stop_start(self):
self._setup_network_and_servers()
- self.servers_client.stop(self.server['id'])
+ self.servers_client.stop_server(self.server['id'])
waiters.wait_for_server_status(self.servers_client,
self.server['id'], 'SHUTOFF')
self._check_network_connectivity(should_connect=False)
- self.servers_client.start(self.server['id'])
+ self.servers_client.start_server(self.server['id'])
self._wait_server_status_and_check_network_connectivity()
@test.idempotent_id('7b6860c2-afa3-4846-9522-adeb38dfbe08')
@@ -164,5 +164,5 @@
flavor_ref=resize_flavor)
waiters.wait_for_server_status(self.servers_client, self.server['id'],
'VERIFY_RESIZE')
- self.servers_client.confirm_resize(self.server['id'])
+ self.servers_client.confirm_resize_server(self.server['id'])
self._wait_server_status_and_check_network_connectivity()
diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py
index 8693fb3..99eecae 100644
--- a/tempest/scenario/test_server_advanced_ops.py
+++ b/tempest/scenario/test_server_advanced_ops.py
@@ -63,7 +63,7 @@
'VERIFY_RESIZE')
LOG.debug("Confirming resize of instance %s", instance_id)
- self.servers_client.confirm_resize(instance_id)
+ self.servers_client.confirm_resize_server(instance_id)
waiters.wait_for_server_status(self.servers_client, instance_id,
'ACTIVE')
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 4912033..82f8b4c 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -11,6 +11,7 @@
# under the License.
from oslo_log import log
+from tempest_lib import decorators
from tempest.common.utils import data_utils
from tempest.common import waiters
@@ -92,21 +93,14 @@
def _stop_instances(self, instances):
# NOTE(gfidente): two loops so we do not wait for the status twice
for i in instances:
- self.servers_client.stop(i['id'])
+ self.servers_client.stop_server(i['id'])
for i in instances:
waiters.wait_for_server_status(self.servers_client,
i['id'], 'SHUTOFF')
def _ssh_to_server(self, server, keypair):
if CONF.compute.use_floatingip_for_ssh:
- floating_ip = (self.floating_ips_client.create_floating_ip()
- ['floating_ip'])
- self.addCleanup(self.delete_wrapper,
- self.floating_ips_client.delete_floating_ip,
- floating_ip['id'])
- self.floating_ips_client.associate_floating_ip_to_server(
- floating_ip['ip'], server['id'])
- ip = floating_ip['ip']
+ ip = self.create_floating_ip(server)['ip']
else:
ip = server
@@ -176,6 +170,7 @@
# deletion operations to succeed
self._stop_instances([instance_2nd, instance_from_snapshot])
+ @decorators.skip_because(bug='1489581')
@test.idempotent_id('36c34c67-7b54-4b59-b188-02a2f458a63b')
@test.services('compute', 'volume', 'image')
def test_create_ebs_image_and_check_boot(self):
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 671450a..9fbd03c 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -252,13 +252,13 @@
kwargs['OS-DCF:diskConfig'] = kwargs.pop('disk_config')
return self.action(server_id, 'resize', None, **kwargs)
- def confirm_resize(self, server_id, **kwargs):
+ def confirm_resize_server(self, server_id, **kwargs):
"""Confirms the flavor change for a server."""
return self.action(server_id, 'confirmResize',
None, schema.server_actions_confirm_resize,
**kwargs)
- def revert_resize(self, server_id, **kwargs):
+ def revert_resize_server(self, server_id, **kwargs):
"""Reverts a server back to its original flavor."""
return self.action(server_id, 'revertResize', None, **kwargs)
@@ -311,10 +311,10 @@
resp, body)
return service_client.ResponseBody(resp, body)
- def stop(self, server_id, **kwargs):
+ def stop_server(self, server_id, **kwargs):
return self.action(server_id, 'os-stop', None, **kwargs)
- def start(self, server_id, **kwargs):
+ def start_server(self, server_id, **kwargs):
return self.action(server_id, 'os-start', None, **kwargs)
def attach_volume(self, server_id, **kwargs):
diff --git a/tempest/services/compute/json/versions_client.py b/tempest/services/compute/json/versions_client.py
new file mode 100644
index 0000000..cbad02c
--- /dev/null
+++ b/tempest/services/compute/json/versions_client.py
@@ -0,0 +1,37 @@
+# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
+#
+# 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 oslo_serialization import jsonutils as json
+from six.moves import urllib
+
+from tempest.api_schema.response.compute.v2_1 import versions as schema
+from tempest.common import service_client
+
+
+class VersionsClient(service_client.ServiceClient):
+
+ def list_versions(self):
+ # NOTE: The URL which is gotten from keystone's catalog contains
+ # API version and project-id like "v2/{project-id}", but we need
+ # to access the URL which doesn't contain them for getting API
+ # versions. For that, here should use raw_request() instead of
+ # get().
+ endpoint = self.base_url
+ url = urllib.parse.urlparse(endpoint)
+ version_url = '%s://%s/' % (url.scheme, url.netloc)
+
+ resp, body = self.raw_request(version_url, 'GET')
+ body = json.loads(body)
+ self.validate_response(schema.list_versions, resp, body)
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/tests/services/compute/test_tenant_networks_client.py b/tempest/tests/services/compute/test_tenant_networks_client.py
new file mode 100644
index 0000000..d7c85f0
--- /dev/null
+++ b/tempest/tests/services/compute/test_tenant_networks_client.py
@@ -0,0 +1,77 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import httplib2
+
+from oslo_serialization import jsonutils as json
+from oslotest import mockpatch
+
+from tempest.services.compute.json import tenant_networks_client
+from tempest.tests import base
+from tempest.tests import fake_auth_provider
+
+
+class TestTenantNetworksClient(base.TestCase):
+
+ FAKE_NETWORK = {
+ "cidr": "None",
+ "id": "c2329eb4-cc8e-4439-ac4c-932369309e36",
+ "label": u'\u30d7'
+ }
+
+ FAKE_NETWORKS = [FAKE_NETWORK]
+
+ NETWORK_ID = FAKE_NETWORK['id']
+
+ def setUp(self):
+ super(TestTenantNetworksClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = tenant_networks_client.TenantNetworksClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_list_tenant_networks(self, bytes_body=False):
+ serialized_body = json.dumps({"networks": self.FAKE_NETWORKS})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.list_tenant_networks()
+ self.assertEqual({"networks": self.FAKE_NETWORKS}, resp)
+
+ def test_list_tenant_networks_with_str_body(self):
+ self._test_list_tenant_networks()
+
+ def test_list_tenant_networks_with_bytes_body(self):
+ self._test_list_tenant_networks(bytes_body=True)
+
+ def _test_show_tenant_network(self, bytes_body=False):
+ serialized_body = json.dumps({"network": self.FAKE_NETWORK})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.show_tenant_network(self.NETWORK_ID)
+ self.assertEqual({"network": self.FAKE_NETWORK}, resp)
+
+ def test_show_tenant_network_with_str_body(self):
+ self._test_show_tenant_network()
+
+ def test_show_tenant_network_with_bytes_body(self):
+ self._test_show_tenant_network(bytes_body=True)