Merge "Factor up (most) CONF value in clients.Manager"
diff --git a/.gitignore b/.gitignore
index 5b87cec..e96deb1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@
!.coveragerc
cover/
doc/source/_static/tempest.conf.sample
+doc/source/plugin-registry.rst
# Files created by releasenotes build
releasenotes/build
diff --git a/README.rst b/README.rst
index 725a890..53c7de5 100644
--- a/README.rst
+++ b/README.rst
@@ -1,13 +1,8 @@
Tempest - The OpenStack Integration Test Suite
==============================================
-.. image:: https://img.shields.io/pypi/v/tempest.svg
- :target: https://pypi.python.org/pypi/tempest/
- :alt: Latest Version
-
-.. image:: https://img.shields.io/pypi/dm/tempest.svg
- :target: https://pypi.python.org/pypi/tempest/
- :alt: Downloads
+The documentation for Tempest is officially hosted at:
+http://docs.openstack.org/developer/tempest/
This is a set of integration tests to be run against a live OpenStack
cluster. Tempest has batteries of tests for OpenStack API validation,
@@ -63,19 +58,21 @@
This can be done within a venv, but the assumption for this guide is that
the Tempest cli entry point will be in your shell's PATH.
-#. Installing Tempest will create a /etc/tempest dir which will contain the
- sample config file packaged with Tempest. The contents of /etc/tempest will
- be copied to all local working dirs, so if there is any common configuration
- you'd like to be shared between anyone setting up local Tempest working dirs
- it's recommended that you copy or rename tempest.conf.sample to tempest.conf
- and make those changes to that file in /etc/tempest
+#. Installing Tempest may create a /etc/tempest dir, however if one isn't
+ created you can create one or use ~/.tempest/etc or ~/.config/tempest in
+ place of /etc/tempest. If none of these dirs are created tempest will create
+ ~/.tempest/etc when it's needed. The contents of this dir will always
+ automatically be copied to all etc/ dirs in local workspaces as an initial
+ setup step. So if there is any common configuration you'd like to be shared
+ between local Tempest workspaces it's recommended that you pre-populate it
+ before running ``tempest init``.
-#. Setup a local working Tempest dir. This is done by using the tempest init
+#. Setup a local Tempest workspace. This is done by using the tempest init
command::
$ tempest init cloud-01
- works the same as::
+ which also works the same as::
$ mkdir cloud-01 && cd cloud-01 && tempest init
@@ -88,11 +85,23 @@
config files located in the etc/ subdir created by the ``tempest init``
command. Tempest is expecting a tempest.conf file in etc/ so if only a
sample exists you must rename or copy it to tempest.conf before making
- any changes to it otherwise Tempest will not know how to load it.
+ any changes to it otherwise Tempest will not know how to load it. For
+ details on configuring tempest refer to the :ref:`tempest-configuration`.
#. Once the configuration is done you're now ready to run Tempest. This can
- be done with testr directly or any `testr`_ based test runner, like
- `ostestr`_. For example, from the working dir running::
+ be done using the :ref:`tempest_run` command. This can be done by either
+ running::
+
+ $ tempest run
+
+ from the Tempest workspace directory. Or you can use the ``--workspace``
+ argument to run in the workspace you created regarless of your current
+ working directory. For example::
+
+ $ tempest run --workspace cloud-01
+
+ There is also the option to use testr directly, or any `testr`_ based test
+ runner, like `ostestr`_. For example, from the workspace dir run::
$ ostestr --regex '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario))'
diff --git a/doc/source/conf.py b/doc/source/conf.py
index eef3620..127613d 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -15,6 +15,17 @@
import os
import subprocess
+# Build the plugin registry
+def build_plugin_registry(app):
+ root_dir = os.path.dirname(
+ os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+ subprocess.call(['tools/generate-tempest-plugins-list.sh'], cwd=root_dir)
+
+def setup(app):
+ app.connect('builder-inited', build_plugin_registry)
+
+
+
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 60ff46b..f1ede06 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -2,19 +2,14 @@
Tempest Testing Project
=======================
-Contents:
+--------
+Overview
+--------
.. toctree::
:maxdepth: 2
overview
- HACKING
- REVIEWING
- plugin
- plugin-registry
- library
- microversion_testing
- test-removal
------------
Field Guides
@@ -32,6 +27,10 @@
field_guide/stress
field_guide/unit_tests
+=========
+For users
+=========
+
---------------------------
Tempest Configuration Guide
---------------------------
@@ -56,6 +55,41 @@
workspace
run
+==============
+For developers
+==============
+
+-----------
+Development
+-----------
+
+.. toctree::
+ :maxdepth: 2
+
+ HACKING
+ REVIEWING
+ microversion_testing
+ test-removal
+
+-------
+Plugins
+-------
+
+.. toctree::
+ :maxdepth: 2
+
+ plugin
+ plugin-registry
+
+-------
+Library
+-------
+
+.. toctree::
+ :maxdepth: 2
+
+ library
+
==================
Indices and tables
==================
diff --git a/doc/source/plugin-registry.rst b/doc/source/plugin-registry.rst
deleted file mode 100644
index 517e5b8..0000000
--- a/doc/source/plugin-registry.rst
+++ /dev/null
@@ -1,23 +0,0 @@
-..
- Note to patch submitters: this file is covered by a periodic proposal
- job. You should edit the files data/tempest-plugins-registry.footer
- data/tempest-plugins-registry.header instead of this one.
-
-==========================
- Tempest Plugin Registry
-==========================
-
-Since we've created the external plugin mechanism, it's gotten used by
-a lot of projects. The following is a list of plugins that currently
-exist.
-
-Detected Plugins
-================
-
-The following will list plugins that a script has found in the openstack/
-namespace, which includes but is not limited to official OpenStack
-projects.
-
-+----------------------------+-------------------------------------------------------------------------+
-|Plugin Name |URL |
-+----------------------------+-------------------------------------------------------------------------+
diff --git a/doc/source/run.rst b/doc/source/run.rst
index 07fa5f7..ce7f03e 100644
--- a/doc/source/run.rst
+++ b/doc/source/run.rst
@@ -1,3 +1,5 @@
+.. _tempest_run:
+
-----------
Tempest Run
-----------
diff --git a/releasenotes/notes/identity-clients-as-library-e663c6132fcac6c2.yaml b/releasenotes/notes/identity-clients-as-library-e663c6132fcac6c2.yaml
index b7850d0..f9173a0 100644
--- a/releasenotes/notes/identity-clients-as-library-e663c6132fcac6c2.yaml
+++ b/releasenotes/notes/identity-clients-as-library-e663c6132fcac6c2.yaml
@@ -7,3 +7,7 @@
any maintenance changes.
* endpoints_client(v2)
+ * roles_client(v2)
+ * services_client(v2)
+ * tenants_client(v2)
+ * users_client(v2)
diff --git a/requirements.txt b/requirements.txt
index 45fe345..84be219 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,7 +5,7 @@
cliff!=1.16.0,!=1.17.0,>=1.15.0 # Apache-2.0
jsonschema!=2.5.0,<3.0.0,>=2.0.0 # MIT
testtools>=1.4.0 # MIT
-paramiko>=2.0 # LGPL
+paramiko>=2.0 # LGPLv2.1+
netaddr!=0.7.16,>=0.7.12 # BSD
testrepository>=0.0.18 # Apache-2.0/BSD
pyOpenSSL>=0.14 # Apache-2.0
@@ -14,7 +14,7 @@
oslo.i18n>=2.1.0 # Apache-2.0
oslo.log>=1.14.0 # Apache-2.0
oslo.serialization>=1.10.0 # Apache-2.0
-oslo.utils>=3.11.0 # Apache-2.0
+oslo.utils>=3.14.0 # Apache-2.0
six>=1.9.0 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
diff --git a/tempest/api/compute/servers/test_disk_config.py b/tempest/api/compute/servers/test_disk_config.py
index 617cdd5..aba0240 100644
--- a/tempest/api/compute/servers/test_disk_config.py
+++ b/tempest/api/compute/servers/test_disk_config.py
@@ -37,17 +37,11 @@
super(ServerDiskConfigTestJSON, cls).setup_clients()
cls.client = cls.os.servers_client
- @classmethod
- def resource_setup(cls):
- super(ServerDiskConfigTestJSON, cls).resource_setup()
- server = cls.create_test_server(wait_until='ACTIVE')
- cls.server_id = server['id']
-
- def _update_server_with_disk_config(self, disk_config):
- server = self.client.show_server(self.server_id)['server']
+ def _update_server_with_disk_config(self, server_id, disk_config):
+ server = self.client.show_server(server_id)['server']
if disk_config != server['OS-DCF:diskConfig']:
server = self.client.update_server(
- self.server_id, disk_config=disk_config)['server']
+ server_id, disk_config=disk_config)['server']
waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
server = self.client.show_server(server['id'])['server']
self.assertEqual(disk_config, server['OS-DCF:diskConfig'])
@@ -55,9 +49,12 @@
@test.idempotent_id('bef56b09-2e8c-4883-a370-4950812f430e')
def test_rebuild_server_with_manual_disk_config(self):
# A server should be rebuilt using the manual disk config option
- self._update_server_with_disk_config(disk_config='AUTO')
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.addCleanup(self.client.delete_server, server['id'])
+ self._update_server_with_disk_config(server['id'],
+ disk_config='AUTO')
- server = self.client.rebuild_server(self.server_id,
+ server = self.client.rebuild_server(server['id'],
self.image_ref_alt,
disk_config='MANUAL')['server']
@@ -71,9 +68,12 @@
@test.idempotent_id('9c9fae77-4feb-402f-8450-bf1c8b609713')
def test_rebuild_server_with_auto_disk_config(self):
# A server should be rebuilt using the auto disk config option
- self._update_server_with_disk_config(disk_config='MANUAL')
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.addCleanup(self.client.delete_server, server['id'])
+ self._update_server_with_disk_config(server['id'],
+ disk_config='MANUAL')
- server = self.client.rebuild_server(self.server_id,
+ server = self.client.rebuild_server(server['id'],
self.image_ref_alt,
disk_config='AUTO')['server']
@@ -84,31 +84,24 @@
server = self.client.show_server(server['id'])['server']
self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
- def _get_alternative_flavor(self):
- server = self.client.show_server(self.server_id)['server']
-
- if server['flavor']['id'] == self.flavor_ref:
- return self.flavor_ref_alt
- else:
- return self.flavor_ref
-
@test.idempotent_id('414e7e93-45b5-44bc-8e03-55159c6bfc97')
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize not available.')
def test_resize_server_from_manual_to_auto(self):
# A server should be resized from manual to auto disk config
- self._update_server_with_disk_config(disk_config='MANUAL')
-
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.addCleanup(self.client.delete_server, server['id'])
+ self._update_server_with_disk_config(server['id'],
+ disk_config='MANUAL')
# Resize with auto option
- flavor_id = self._get_alternative_flavor()
- self.client.resize_server(self.server_id, flavor_id,
+ self.client.resize_server(server['id'], self.flavor_ref_alt,
disk_config='AUTO')
- waiters.wait_for_server_status(self.client, self.server_id,
+ waiters.wait_for_server_status(self.client, server['id'],
'VERIFY_RESIZE')
- self.client.confirm_resize_server(self.server_id)
- waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ self.client.confirm_resize_server(server['id'])
+ waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
- server = self.client.show_server(self.server_id)['server']
+ server = self.client.show_server(server['id'])['server']
self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
@test.idempotent_id('693d16f3-556c-489a-8bac-3d0ca2490bad')
@@ -116,27 +109,31 @@
'Resize not available.')
def test_resize_server_from_auto_to_manual(self):
# A server should be resized from auto to manual disk config
- self._update_server_with_disk_config(disk_config='AUTO')
-
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.addCleanup(self.client.delete_server, server['id'])
+ self._update_server_with_disk_config(server['id'],
+ disk_config='AUTO')
# Resize with manual option
- flavor_id = self._get_alternative_flavor()
- self.client.resize_server(self.server_id, flavor_id,
+ self.client.resize_server(server['id'], self.flavor_ref_alt,
disk_config='MANUAL')
- waiters.wait_for_server_status(self.client, self.server_id,
+ waiters.wait_for_server_status(self.client, server['id'],
'VERIFY_RESIZE')
- self.client.confirm_resize_server(self.server_id)
- waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ self.client.confirm_resize_server(server['id'])
+ waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
- server = self.client.show_server(self.server_id)['server']
+ server = self.client.show_server(server['id'])['server']
self.assertEqual('MANUAL', server['OS-DCF:diskConfig'])
@test.idempotent_id('5ef18867-358d-4de9-b3c9-94d4ba35742f')
def test_update_server_from_auto_to_manual(self):
# A server should be updated from auto to manual disk config
- self._update_server_with_disk_config(disk_config='AUTO')
+ server = self.create_test_server(wait_until='ACTIVE')
+ self.addCleanup(self.client.delete_server, server['id'])
+ self._update_server_with_disk_config(server['id'],
+ disk_config='AUTO')
# Update the disk_config attribute to manual
- server = self.client.update_server(self.server_id,
+ server = self.client.update_server(server['id'],
disk_config='MANUAL')['server']
waiters.wait_for_server_status(self.client, server['id'], 'ACTIVE')
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index 607bebe..bee77df 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -13,10 +13,15 @@
# License for the specific language governing permissions and limitations
# under the License.
+import testtools
+
from tempest.api.identity import base
from tempest.common.utils import data_utils
+from tempest import config
from tempest import test
+CONF = config.CONF
+
class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
@@ -52,6 +57,37 @@
self.assertEqual(project_name, body['name'])
self.assertEqual(self.data.domain['id'], body['domain_id'])
+ @testtools.skipUnless(CONF.identity_feature_enabled.reseller,
+ 'Reseller not available.')
+ @test.idempotent_id('1854f9c0-70bc-4d11-a08a-1c789d339e3d')
+ def test_project_create_with_parent(self):
+ # Create root project without providing a parent_id
+ self.data.setup_test_domain()
+ domain_id = self.data.domain['id']
+
+ root_project_name = data_utils.rand_name('root_project')
+ root_project = self.projects_client.create_project(
+ root_project_name, domain_id=domain_id)['project']
+ self.addCleanup(
+ self.projects_client.delete_project, root_project['id'])
+
+ root_project_id = root_project['id']
+ parent_id = root_project['parent_id']
+ self.assertEqual(root_project_name, root_project['name'])
+ # If not provided, the parent_id must point to the top level
+ # project in the hierarchy, i.e. its domain
+ self.assertEqual(domain_id, parent_id)
+
+ # Create a project using root_project_id as parent_id
+ project_name = data_utils.rand_name('project')
+ project = self.projects_client.create_project(
+ project_name, domain_id=domain_id,
+ parent_id=root_project_id)['project']
+ self.addCleanup(self.projects_client.delete_project, project['id'])
+ parent_id = project['parent_id']
+ self.assertEqual(project_name, project['name'])
+ self.assertEqual(root_project_id, parent_id)
+
@test.idempotent_id('1f66dc76-50cc-4741-a200-af984509e480')
def test_project_create_enabled(self):
# Create a project that is enabled
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 7a1e3a5..df39390 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -218,21 +218,21 @@
def teardown_all(self):
for user in self.users:
test_utils.call_and_ignore_notfound_exc(
- self.users_client.delete_user, user)
+ self.users_client.delete_user, user['id'])
for tenant in self.tenants:
test_utils.call_and_ignore_notfound_exc(
- self.projects_client.delete_tenant, tenant)
+ self.projects_client.delete_tenant, tenant['id'])
for project in reversed(self.projects):
test_utils.call_and_ignore_notfound_exc(
- self.projects_client.delete_project, project)
+ self.projects_client.delete_project, project['id'])
for role in self.roles:
test_utils.call_and_ignore_notfound_exc(
- self.roles_client.delete_role, role)
+ self.roles_client.delete_role, role['id'])
for domain in self.domains:
test_utils.call_and_ignore_notfound_exc(
- self.domains_client.update_domain, domain, enabled=False)
+ self.domains_client.update_domain, domain['id'], enabled=False)
test_utils.call_and_ignore_notfound_exc(
- self.domains_client.delete_domain, domain)
+ self.domains_client.delete_domain, domain['id'])
class DataGeneratorV2(BaseDataGenerator):
diff --git a/tempest/api/network/test_allowed_address_pair.py b/tempest/api/network/test_allowed_address_pair.py
index b2892e5..92dfc56 100644
--- a/tempest/api/network/test_allowed_address_pair.py
+++ b/tempest/api/network/test_allowed_address_pair.py
@@ -14,6 +14,7 @@
# under the License.
import netaddr
+import six
from tempest.api.network import base
from tempest import config
@@ -90,7 +91,8 @@
body = self.ports_client.update_port(
port_id, allowed_address_pairs=allowed_address_pairs)
allowed_address_pair = body['port']['allowed_address_pairs']
- self.assertEqual(allowed_address_pair, allowed_address_pairs)
+ six.assertCountEqual(self, allowed_address_pair,
+ allowed_address_pairs)
@test.idempotent_id('9599b337-272c-47fd-b3cf-509414414ac4')
def test_update_port_with_address_pair(self):
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 5e1c20b..5615cf3 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -63,9 +63,8 @@
extra_specs = {spec_key_with_prefix: backend_name_key}
else:
extra_specs = {spec_key_without_prefix: backend_name_key}
- self.type = self.admin_volume_types_client.create_volume_type(
- name=type_name, extra_specs=extra_specs)['volume_type']
- self.volume_type_id_list.append(self.type['id'])
+ self.type = self.create_volume_type(name=type_name,
+ extra_specs=extra_specs)
params = {self.name_field: vol_name, 'volume_type': type_name}
@@ -92,11 +91,6 @@
cls.admin_volume_client.delete_volume(volume_id)
cls.admin_volume_client.wait_for_resource_deletion(volume_id)
- # volume types deletion
- volume_type_id_list = getattr(cls, 'volume_type_id_list', [])
- for volume_type_id in volume_type_id_list:
- cls.admin_volume_types_client.delete_volume_type(volume_type_id)
-
super(VolumeMultiBackendV2Test, cls).resource_cleanup()
@test.idempotent_id('c1a41f3f-9dad-493e-9f09-3ff197d477cc')
diff --git a/tempest/api/volume/admin/test_qos.py b/tempest/api/volume/admin/test_qos.py
index 68e57f5..9402668 100644
--- a/tempest/api/volume/admin/test_qos.py
+++ b/tempest/api/volume/admin/test_qos.py
@@ -50,14 +50,6 @@
list_qos = self.admin_volume_qos_client.list_qos()['qos_specs']
self.assertNotIn(body, list_qos)
- def _create_test_volume_type(self):
- vol_type_name = utils.rand_name("volume-type")
- vol_type = self.admin_volume_types_client.create_volume_type(
- name=vol_type_name)['volume_type']
- self.addCleanup(self.admin_volume_types_client.delete_volume_type,
- vol_type['id'])
- return vol_type
-
def _test_associate_qos(self, vol_type_id):
self.admin_volume_qos_client.associate_qos(
self.created_qos['id'], vol_type_id)
@@ -146,7 +138,7 @@
# create a test volume-type
vol_type = []
for _ in range(0, 3):
- vol_type.append(self._create_test_volume_type())
+ vol_type.append(self.create_volume_type())
# associate the qos-specs with volume-types
for i in range(0, 3):
diff --git a/tempest/api/volume/admin/test_volume_type_access.py b/tempest/api/volume/admin/test_volume_type_access.py
new file mode 100644
index 0000000..fac71a8
--- /dev/null
+++ b/tempest/api/volume/admin/test_volume_type_access.py
@@ -0,0 +1,94 @@
+# Copyright 2016 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 operator
+
+from tempest.api.volume import base
+from tempest.common import waiters
+from tempest.lib import exceptions as lib_exc
+from tempest import test
+
+
+class VolumeTypesAccessV2Test(base.BaseVolumeAdminTest):
+
+ credentials = ['primary', 'alt', 'admin']
+
+ @classmethod
+ def setup_clients(cls):
+ super(VolumeTypesAccessV2Test, cls).setup_clients()
+ cls.alt_client = cls.os_alt.volumes_client
+
+ @test.idempotent_id('d4dd0027-835f-4554-a6e5-50903fb79184')
+ def test_volume_type_access_add(self):
+ # Creating a NON public volume type
+ params = {'os-volume-type-access:is_public': False}
+ volume_type = self.create_volume_type(**params)
+
+ # Try creating a volume from volume type in primary tenant
+ self.assertRaises(lib_exc.NotFound, self.volumes_client.create_volume,
+ volume_type=volume_type['id'])
+
+ # Adding volume type access for primary tenant
+ self.admin_volume_types_client.add_type_access(
+ volume_type['id'], project=self.volumes_client.tenant_id)
+ self.addCleanup(self.admin_volume_types_client.remove_type_access,
+ volume_type['id'],
+ project=self.volumes_client.tenant_id)
+
+ # Creating a volume from primary tenant
+ volume = self.volumes_client.create_volume(
+ volume_type=volume_type['id'])['volume']
+ self.addCleanup(self.delete_volume, self.volumes_client, volume['id'])
+ waiters.wait_for_volume_status(self.volumes_client, volume['id'],
+ 'available')
+
+ # Validating the created volume is based on the volume type
+ self.assertEqual(volume_type['name'], volume['volume_type'])
+
+ @test.idempotent_id('5220eb28-a435-43ce-baaf-ed46f0e95159')
+ def test_volume_type_access_list(self):
+ # Creating a NON public volume type
+ params = {'os-volume-type-access:is_public': False}
+ volume_type = self.create_volume_type(**params)
+
+ # Adding volume type access for primary tenant
+ self.admin_volume_types_client.add_type_access(
+ volume_type['id'], project=self.volumes_client.tenant_id)
+ self.addCleanup(self.admin_volume_types_client.remove_type_access,
+ volume_type['id'],
+ project=self.volumes_client.tenant_id)
+
+ # Adding volume type access for alt tenant
+ self.admin_volume_types_client.add_type_access(
+ volume_type['id'], project=self.alt_client.tenant_id)
+ self.addCleanup(self.admin_volume_types_client.remove_type_access,
+ volume_type['id'],
+ project=self.alt_client.tenant_id)
+
+ # List tenant access for the given volume type
+ type_access_list = self.admin_volume_types_client.list_type_access(
+ volume_type['id'])['volume_type_access']
+ volume_type_ids = [
+ vol_type['volume_type_id'] for vol_type in type_access_list
+ ]
+
+ # Validating volume type available for only two tenants
+ self.assertEqual(2, volume_type_ids.count(volume_type['id']))
+
+ # Validating the permitted tenants are the expected tenants
+ self.assertIn(self.volumes_client.tenant_id,
+ map(operator.itemgetter('project_id'), type_access_list))
+ self.assertIn(self.alt_client.tenant_id,
+ map(operator.itemgetter('project_id'), type_access_list))
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index 9023037..27f6ccb 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -44,12 +44,10 @@
# Create two volume_types
for i in range(2):
vol_type_name = data_utils.rand_name("volume-type")
- vol_type = self.admin_volume_types_client.create_volume_type(
+ vol_type = self.create_volume_type(
name=vol_type_name,
- extra_specs=extra_specs)['volume_type']
+ extra_specs=extra_specs)
volume_types.append(vol_type)
- self.addCleanup(self.admin_volume_types_client.delete_volume_type,
- vol_type['id'])
params = {self.name_field: vol_name,
'volume_type': volume_types[0]['id']}
@@ -94,12 +92,10 @@
vendor = CONF.volume.vendor_name
extra_specs = {"storage_protocol": proto,
"vendor_name": vendor}
- body = self.admin_volume_types_client.create_volume_type(
+ body = self.create_volume_type(
name=name,
- extra_specs=extra_specs)['volume_type']
+ extra_specs=extra_specs)
self.assertIn('id', body)
- self.addCleanup(self.admin_volume_types_client.delete_volume_type,
- body['id'])
self.assertIn('name', body)
self.assertEqual(body['name'], name,
"The created volume_type name is not equal "
@@ -124,11 +120,7 @@
provider = "LuksEncryptor"
control_location = "front-end"
name = data_utils.rand_name("volume-type")
- body = self.admin_volume_types_client.create_volume_type(
- name=name)['volume_type']
- self.addCleanup(self.admin_volume_types_client.delete_volume_type,
- body['id'])
-
+ body = self.create_volume_type(name=name)
# Create encryption type
encryption_type = \
self.admin_volume_types_client.create_encryption_type(
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs.py b/tempest/api/volume/admin/test_volume_types_extra_specs.py
index b5c5d15..9e49b94 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs.py
@@ -24,14 +24,7 @@
def resource_setup(cls):
super(VolumeTypesExtraSpecsV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type')
- cls.volume_type = \
- cls.admin_volume_types_client.create_volume_type(
- name=vol_type_name)['volume_type']
-
- @classmethod
- def resource_cleanup(cls):
- cls.admin_volume_types_client.delete_volume_type(cls.volume_type['id'])
- super(VolumeTypesExtraSpecsV2Test, cls).resource_cleanup()
+ cls.volume_type = cls.create_volume_type(name=vol_type_name)
@test.idempotent_id('b42923e9-0452-4945-be5b-d362ae533e60')
def test_volume_type_extra_specs_list(self):
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
index c7c3e1a..2193aa6 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
@@ -26,14 +26,8 @@
super(ExtraSpecsNegativeV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type')
cls.extra_specs = {"spec1": "val1"}
- cls.volume_type = cls.admin_volume_types_client.create_volume_type(
- name=vol_type_name,
- extra_specs=cls.extra_specs)['volume_type']
-
- @classmethod
- def resource_cleanup(cls):
- cls.admin_volume_types_client.delete_volume_type(cls.volume_type['id'])
- super(ExtraSpecsNegativeV2Test, cls).resource_cleanup()
+ cls.volume_type = cls.create_volume_type(name=vol_type_name,
+ extra_specs=cls.extra_specs)
@test.idempotent_id('08961d20-5cbb-4910-ac0f-89ad6dbb2da1')
def test_update_no_body(self):
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index 66bab51..b6dc488 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -27,17 +27,17 @@
CONF = config.CONF
-class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
+class VolumesBackupsAdminV2Test(base.BaseVolumeAdminTest):
@classmethod
def skip_checks(cls):
- super(VolumesBackupsV2Test, cls).skip_checks()
+ super(VolumesBackupsAdminV2Test, cls).skip_checks()
if not CONF.volume_feature_enabled.backup:
raise cls.skipException("Cinder backup feature disabled")
@classmethod
def resource_setup(cls):
- super(VolumesBackupsV2Test, cls).resource_setup()
+ super(VolumesBackupsAdminV2Test, cls).resource_setup()
cls.volume = cls.create_volume()
@@ -167,5 +167,5 @@
'available')
-class VolumesBackupsV1Test(VolumesBackupsV2Test):
+class VolumesBackupsAdminV1Test(VolumesBackupsAdminV2Test):
_api_version = 1
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 665036b..087b9a8 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -76,6 +76,7 @@
else:
cls.snapshots_client = cls.os.snapshots_v2_client
cls.volumes_client = cls.os.volumes_v2_client
+ cls.backups_client = cls.os.backups_v2_client
cls.volumes_extension_client = cls.os.volumes_v2_extension_client
cls.availability_zone_client = (
cls.os.volume_v2_availability_zone_client)
@@ -214,11 +215,13 @@
super(BaseVolumeAdminTest, cls).resource_setup()
cls.qos_specs = []
+ cls.volume_types = []
@classmethod
def resource_cleanup(cls):
cls.clear_qos_specs()
super(BaseVolumeAdminTest, cls).resource_cleanup()
+ cls.clear_volume_types()
@classmethod
def create_test_qos_specs(cls, name=None, consumer=None, **kwargs):
@@ -231,6 +234,15 @@
return qos_specs
@classmethod
+ def create_volume_type(cls, name=None, **kwargs):
+ """Create a test volume-type"""
+ name = name or data_utils.rand_name('volume-type')
+ volume_type = cls.admin_volume_types_client.create_volume_type(
+ name=name, **kwargs)['volume_type']
+ cls.volume_types.append(volume_type['id'])
+ return volume_type
+
+ @classmethod
def clear_qos_specs(cls):
for qos_id in cls.qos_specs:
test_utils.call_and_ignore_notfound_exc(
@@ -239,3 +251,17 @@
for qos_id in cls.qos_specs:
test_utils.call_and_ignore_notfound_exc(
cls.admin_volume_qos_client.wait_for_resource_deletion, qos_id)
+
+ @classmethod
+ def clear_volume_types(cls):
+ for vol_type in cls.volume_types:
+ test_utils.call_and_ignore_notfound_exc(
+ cls.admin_volume_types_client.delete_volume_type, vol_type)
+
+ for vol_type in cls.volume_types:
+ # Resource dictionary uses for is_resource_deleted method,
+ # to distinguish between volume-type to encryption-type.
+ resource = {'id': vol_type, 'type': 'volume-type'}
+ test_utils.call_and_ignore_notfound_exc(
+ cls.admin_volume_types_client.wait_for_resource_deletion,
+ resource)
diff --git a/tempest/api/volume/test_volumes_backup.py b/tempest/api/volume/test_volumes_backup.py
new file mode 100644
index 0000000..87146db
--- /dev/null
+++ b/tempest/api/volume/test_volumes_backup.py
@@ -0,0 +1,72 @@
+# Copyright 2016 Red Hat, Inc.
+# 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.volume import base
+from tempest.common.utils import data_utils
+from tempest.common import waiters
+from tempest import config
+from tempest import test
+
+CONF = config.CONF
+
+
+class VolumesBackupsV2Test(base.BaseVolumeTest):
+
+ @classmethod
+ def skip_checks(cls):
+ super(VolumesBackupsV2Test, cls).skip_checks()
+ if not CONF.volume_feature_enabled.backup:
+ raise cls.skipException("Cinder backup feature disabled")
+
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesBackupsV2Test, cls).resource_setup()
+
+ cls.volume = cls.create_volume()
+
+ @test.idempotent_id('07af8f6d-80af-44c9-a5dc-c8427b1b62e6')
+ @test.services('compute')
+ def test_backup_create_attached_volume(self):
+ """Test backup create using force flag.
+
+ Cinder allows to create a volume backup, whether the volume status
+ is "available" or "in-use".
+ """
+ # Create a server
+ server_name = data_utils.rand_name('instance')
+ server = self.create_server(name=server_name, wait_until='ACTIVE')
+ self.addCleanup(self.servers_client.delete_server, server['id'])
+ # Attach volume to instance
+ self.servers_client.attach_volume(server['id'],
+ volumeId=self.volume['id'])
+ waiters.wait_for_volume_status(self.volumes_client,
+ self.volume['id'], 'in-use')
+ self.addCleanup(waiters.wait_for_volume_status, self.volumes_client,
+ self.volume['id'], 'available')
+ self.addCleanup(self.servers_client.detach_volume, server['id'],
+ self.volume['id'])
+ # Create backup using force flag
+ backup_name = data_utils.rand_name('Backup')
+ backup = self.backups_client.create_backup(
+ volume_id=self.volume['id'],
+ name=backup_name, force=True)['backup']
+ self.addCleanup(self.backups_client.delete_backup, backup['id'])
+ self.backups_client.wait_for_backup_status(backup['id'],
+ 'available')
+ self.assertEqual(backup_name, backup['name'])
+
+
+class VolumesBackupsV1Test(VolumesBackupsV2Test):
+ _api_version = 1
diff --git a/tempest/api/volume/test_volumes_clone.py b/tempest/api/volume/test_volumes_clone.py
new file mode 100644
index 0000000..f38a068
--- /dev/null
+++ b/tempest/api/volume/test_volumes_clone.py
@@ -0,0 +1,44 @@
+# Copyright 2016 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.
+
+from tempest.api.volume import base
+from tempest import config
+from tempest import test
+
+
+CONF = config.CONF
+
+
+class VolumesCloneTest(base.BaseVolumeTest):
+
+ @test.idempotent_id('9adae371-a257-43a5-9555-dc7c88e66e0e')
+ def test_create_from_volume(self):
+ # Creates a volume from another volume passing a size different from
+ # the source volume.
+ src_size = CONF.volume.volume_size
+
+ src_vol = self.create_volume(size=src_size)
+ # Destination volume bigger than source
+ dst_vol = self.create_volume(source_volid=src_vol['id'],
+ size=src_size + 1)
+
+ volume = self.volumes_client.show_volume(dst_vol['id'])['volume']
+ # Should allow
+ self.assertEqual(volume['source_volid'], src_vol['id'])
+ self.assertEqual(int(volume['size']), src_size + 1)
+
+
+class VolumesV1CloneTest(VolumesCloneTest):
+ _api_version = 1
diff --git a/tempest/api/volume/test_volumes_clone_negative.py b/tempest/api/volume/test_volumes_clone_negative.py
new file mode 100644
index 0000000..ee51e00
--- /dev/null
+++ b/tempest/api/volume/test_volumes_clone_negative.py
@@ -0,0 +1,42 @@
+# Copyright 2016 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.
+
+from tempest.api.volume import base
+from tempest import config
+from tempest.lib import exceptions
+from tempest import test
+
+
+CONF = config.CONF
+
+
+class VolumesCloneTest(base.BaseVolumeTest):
+
+ @test.idempotent_id('9adae371-a257-43a5-459a-dc7c88e66e0e')
+ def test_create_from_volume_decreasing_size(self):
+ # Creates a volume from another volume passing a size different from
+ # the source volume.
+ src_size = CONF.volume.volume_size + 1
+ src_vol = self.create_volume(size=src_size)
+
+ # Destination volume smaller than source
+ self.assertRaises(exceptions.BadRequest,
+ self.volumes_client.create_volume,
+ size=src_size - 1,
+ source_volid=src_vol['id'])
+
+
+class VolumesV1CloneTest(VolumesCloneTest):
+ _api_version = 1
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 0f7c4f6..c7f1e6e 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -178,16 +178,19 @@
@test.idempotent_id('677863d1-3142-456d-b6ac-9924f667a7f4')
def test_volume_from_snapshot(self):
- # Create a temporary snap using wrapper method from base, then
- # create a snap based volume and deletes it
- snapshot = self.create_snapshot(self.volume_origin['id'])
- # NOTE(gfidente): size is required also when passing snapshot_id
- volume = self.volumes_client.create_volume(
- snapshot_id=snapshot['id'])['volume']
- waiters.wait_for_volume_status(self.volumes_client,
- volume['id'], 'available')
- self.delete_volume(self.volumes_client, volume['id'])
- self.cleanup_snapshot(snapshot)
+ # Creates a volume a snapshot passing a size different from the source
+ src_size = CONF.volume.volume_size
+
+ src_vol = self.create_volume(size=src_size)
+ src_snap = self.create_snapshot(src_vol['id'])
+ # Destination volume bigger than source snapshot
+ dst_vol = self.create_volume(snapshot_id=src_snap['id'],
+ size=src_size + 1)
+
+ volume = self.volumes_client.show_volume(dst_vol['id'])['volume']
+ # Should allow
+ self.assertEqual(volume['snapshot_id'], src_snap['id'])
+ self.assertEqual(int(volume['size']), src_size + 1)
@test.idempotent_id('db4d8e0a-7a2e-41cc-a712-961f6844e896')
def test_snapshot_list_param_limit(self):
diff --git a/tempest/api/volume/test_volumes_snapshots_negative.py b/tempest/api/volume/test_volumes_snapshots_negative.py
index 374979c..2df9523 100644
--- a/tempest/api/volume/test_volumes_snapshots_negative.py
+++ b/tempest/api/volume/test_volumes_snapshots_negative.py
@@ -46,6 +46,20 @@
self.snapshots_client.create_snapshot,
volume_id=None, display_name=s_name)
+ @test.idempotent_id('677863d1-34f9-456d-b6ac-9924f667a7f4')
+ def test_volume_from_snapshot_decreasing_size(self):
+ # Creates a volume a snapshot passing a size different from the source
+ src_size = CONF.volume.volume_size + 1
+
+ src_vol = self.create_volume(size=src_size)
+ src_snap = self.create_snapshot(src_vol['id'])
+
+ # Destination volume smaller than source
+ self.assertRaises(lib_exc.BadRequest,
+ self.volumes_client.create_volume,
+ size=src_size - 1,
+ snapshot_id=src_snap['id'])
+
class VolumesV1SnapshotNegativeTestJSON(VolumesV2SnapshotNegativeTestJSON):
_api_version = 1
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 08ad94f..a9e5167 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -126,15 +126,15 @@
from tempest.lib.services.compute import security_group_rules_client
from tempest.lib.services.compute import security_groups_client
from tempest.lib.services.compute import servers_client
+from tempest.lib.services.identity.v2 import roles_client
+from tempest.lib.services.identity.v2 import tenants_client
+from tempest.lib.services.identity.v2 import users_client
from tempest.lib.services.image.v2 import images_client
from tempest.lib.services.network import networks_client
from tempest.lib.services.network import ports_client
from tempest.lib.services.network import routers_client
from tempest.lib.services.network import subnets_client
from tempest.services.identity.v2.json import identity_client
-from tempest.services.identity.v2.json import roles_client
-from tempest.services.identity.v2.json import tenants_client
-from tempest.services.identity.v2.json import users_client
from tempest.services.object_storage import container_client
from tempest.services.object_storage import object_client
from tempest.services.volume.v1.json import volumes_client
diff --git a/tempest/cmd/run.py b/tempest/cmd/run.py
index 26bd418..2eb122e 100644
--- a/tempest/cmd/run.py
+++ b/tempest/cmd/run.py
@@ -23,6 +23,27 @@
any tests that match on re.match() with the regex
* **--smoke**: Run all the tests tagged as smoke
+There are also the **--blacklist_file** and **--whitelist_file** options that
+let you pass a filepath to tempest run with the file format being a line
+seperated regex, with '#' used to signify the start of a comment on a line.
+For example::
+
+ # Regex file
+ ^regex1 # Match these tests
+ .*regex2 # Match those tests
+
+The blacklist file will be used to construct a negative lookahead regex and
+the whitelist file will simply OR all the regexes in the file. The whitelist
+and blacklist file options are mutually exclusive so you can't use them
+together. However, you can combine either with a normal regex or the *--smoke*
+flag. When used with a blacklist file the generated regex will be combined to
+something like::
+
+ ^((?!black_regex1|black_regex2).)*$cli_regex1
+
+When combined with a whitelist file all the regexes from the file and the CLI
+regexes will be ORed.
+
You can also use the **--list-tests** option in conjunction with selection
arguments to list which tests will be run.
@@ -33,6 +54,24 @@
If you want to adjust the number of workers use the **--concurrency** option
and if you want to run tests serially use **--serial**
+Running with Workspaces
+-----------------------
+Tempest run enables you to run your tempest tests from any setup tempest
+workspace it relies on you having setup a tempest workspace with either the
+``tempest init`` or ``tempest workspace`` commands. Then using the
+``--workspace`` CLI option you can specify which one of your workspaces you
+want to run tempest from. Using this option you don't have to run Tempest
+directly with you current working directory being the workspace, Tempest will
+take care of managing everything to be executed from there.
+
+Running from Anywhere
+---------------------
+Tempest run provides you with an option to execute tempest from anywhere on
+your system. You are required to provide a config file in this case with the
+``--config-file`` option. When run tempest will create a .testrepository
+directory and a .testr.conf file in your current working directory. This way
+you can use testr commands directly to inspect the state of the previous run.
+
Test Output
===========
By default tempest run's output to STDOUT will be generated using the
@@ -47,10 +86,13 @@
import threading
from cliff import command
+from os_testr import regex_builder
from os_testr import subunit_trace
from oslo_log import log as logging
from testrepository.commands import run_argv
+from tempest.cmd import init
+from tempest.cmd import workspace
from tempest import config
@@ -60,7 +102,9 @@
class TempestRun(command.Command):
- def _set_env(self):
+ def _set_env(self, config_file=None):
+ if config_file:
+ CONF.set_config_path(os.path.abspath(config_file))
# NOTE(mtreinish): This is needed so that testr doesn't gobble up any
# stacktraces on failure.
if 'TESTR_PDB' in os.environ:
@@ -68,18 +112,45 @@
else:
os.environ["TESTR_PDB"] = ""
+ def _create_testrepository(self):
+ if not os.path.isdir('.testrepository'):
+ returncode = run_argv(['testr', 'init'], sys.stdin, sys.stdout,
+ sys.stderr)
+ if returncode:
+ sys.exit(returncode)
+
+ def _create_testr_conf(self):
+ top_level_path = os.path.dirname(os.path.dirname(__file__))
+ discover_path = os.path.join(top_level_path, 'test_discover')
+ file_contents = init.TESTR_CONF % (top_level_path, discover_path)
+ with open('.testr.conf', 'w+') as testr_conf_file:
+ testr_conf_file.write(file_contents)
+
def take_action(self, parsed_args):
- self._set_env()
returncode = 0
+ if parsed_args.config_file:
+ self._set_env(parsed_args.config_file)
+ else:
+ self._set_env()
+ # Workspace execution mode
+ if parsed_args.workspace:
+ workspace_mgr = workspace.WorkspaceManager(
+ parsed_args.workspace_path)
+ path = workspace_mgr.get_workspace(parsed_args.workspace)
+ os.chdir(path)
+ # NOTE(mtreinish): tempest init should create a .testrepository dir
+ # but since workspaces can be imported let's sanity check and
+ # ensure that one is created
+ self._create_testrepository()
# Local execution mode
- if os.path.isfile('.testr.conf'):
+ elif os.path.isfile('.testr.conf'):
# If you're running in local execution mode and there is not a
# testrepository dir create one
- if not os.path.isdir('.testrepository'):
- returncode = run_argv(['testr', 'init'], sys.stdin, sys.stdout,
- sys.stderr)
- if returncode:
- sys.exit(returncode)
+ self._create_testrepository()
+ # local execution with config file mode
+ elif parsed_args.config_file:
+ self._create_testr_conf()
+ self._create_testrepository()
else:
print("No .testr.conf file was found for local execution")
sys.exit(2)
@@ -102,6 +173,18 @@
return parser
def _add_args(self, parser):
+ # workspace args
+ parser.add_argument('--workspace', default=None,
+ help='Name of tempest workspace to use for running'
+ ' tests. You can see a list of workspaces '
+ 'with tempest workspace list')
+ parser.add_argument('--workspace-path', default=None,
+ dest='workspace_path',
+ help="The path to the workspace file, the default "
+ "is ~/.tempest/workspace.yaml")
+ # Configuration flags
+ parser.add_argument('--config-file', default=None, dest='config_file',
+ help='Configuration file to run tempest with')
# test selection args
regex = parser.add_mutually_exclusive_group()
regex.add_argument('--smoke', action='store_true',
@@ -109,11 +192,20 @@
regex.add_argument('--regex', '-r', default='',
help='A normal testr selection regex used to '
'specify a subset of tests to run')
+ list_selector = parser.add_mutually_exclusive_group()
+ list_selector.add_argument('--whitelist_file',
+ help="Path to a whitelist file, this file "
+ "contains a seperate regex on each "
+ "newline.")
+ list_selector.add_argument('--blacklist_file',
+ help='Path to a blacklist file, this file '
+ 'contains a separate regex exclude on '
+ 'each newline')
# list only args
parser.add_argument('--list-tests', '-l', action='store_true',
help='List tests',
default=False)
- # exectution args
+ # execution args
parser.add_argument('--concurrency', '-w',
help="The number of workers to use, defaults to "
"the number of cpus")
@@ -138,6 +230,10 @@
regex = 'smoke'
elif parsed_args.regex:
regex = parsed_args.regex
+ if parsed_args.whitelist_file or parsed_args.blacklist_file:
+ regex = regex_builder.construct_regex(parsed_args.blacklist_file,
+ parsed_args.whitelist_file,
+ regex, False)
return regex
def _build_options(self, parsed_args):
diff --git a/tempest/cmd/subunit_describe_calls.py b/tempest/cmd/subunit_describe_calls.py
index c990add..da7f426 100644
--- a/tempest/cmd/subunit_describe_calls.py
+++ b/tempest/cmd/subunit_describe_calls.py
@@ -45,6 +45,7 @@
Ports file JSON structure
^^^^^^^^^^^^^^^^^^^^^^^^^
+::
{
"<port number>": "<name of service>",
@@ -54,6 +55,8 @@
Output file JSON structure
^^^^^^^^^^^^^^^^^^^^^^^^^^
+::
+
{
"full_test_name[with_id_and_tags]": [
{
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
index 7ebc283..c290b57 100644
--- a/tempest/common/compute.py
+++ b/tempest/common/compute.py
@@ -30,7 +30,8 @@
def create_test_server(clients, validatable=False, validation_resources=None,
tenant_network=None, wait_until=None,
volume_backed=False, name=None, flavor=None,
- image_id=None, **kwargs):
+ image_id=None, delete_vol_on_termination=True,
+ **kwargs):
"""Common wrapper utility returning a test server.
This method is a common wrapper returning a test server that can be
@@ -106,7 +107,7 @@
'source_type': 'volume',
'destination_type': 'volume',
'boot_index': 0,
- 'delete_on_termination': True}]
+ 'delete_on_termination': delete_vol_on_termination}]
kwargs['block_device_mapping_v2'] = bd_map_v2
# Since this is boot from volume an image does not need
diff --git a/tempest/common/fixed_network.py b/tempest/common/fixed_network.py
index 5f0685e..f57c18a 100644
--- a/tempest/common/fixed_network.py
+++ b/tempest/common/fixed_network.py
@@ -14,7 +14,7 @@
from oslo_log import log as logging
from tempest import exceptions
-from tempest.lib.common.utils import misc as misc_utils
+from tempest.lib.common.utils import test_utils
LOG = logging.getLogger(__name__)
@@ -31,7 +31,7 @@
list returns a 404, there are no found networks, or the found network
is invalid
"""
- caller = misc_utils.find_test_caller()
+ caller = test_utils.find_test_caller()
if not name:
raise exceptions.InvalidTestResource(type='network', name=name)
@@ -84,7 +84,7 @@
tenant network is available in the creds provider
:returns: a dict with 'id' and 'name' of the network
"""
- caller = misc_utils.find_test_caller()
+ caller = test_utils.find_test_caller()
net_creds = creds_provider.get_primary_creds()
network = getattr(net_creds, 'network', None)
if not network or not network.get('name'):
diff --git a/tempest/common/image.py b/tempest/common/image.py
index 72e3a72..95a7d1a 100644
--- a/tempest/common/image.py
+++ b/tempest/common/image.py
@@ -47,6 +47,11 @@
fields_copy = copy.deepcopy(metadata)
copy_from = fields_copy.pop('copy_from', None)
+ purge = fields_copy.pop('purge_props', None)
+
+ if purge is not None:
+ headers['x-glance-registry-purge-props'] = purge
+
if copy_from is not None:
headers['x-glance-api-copy-from'] = copy_from
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index e083167..df08e30 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -18,7 +18,7 @@
from tempest.common import image as common_image
from tempest import config
from tempest import exceptions
-from tempest.lib.common.utils import misc as misc_utils
+from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.image.v1 import images_client as images_v1_client
@@ -91,7 +91,7 @@
'timeout': timeout})
message += ' Current status: %s.' % server_status
message += ' Current task state: %s.' % task_state
- caller = misc_utils.find_test_caller()
+ caller = test_utils.find_test_caller()
if caller:
message = '(%s) %s' % (caller, message)
raise exceptions.TimeoutException(message)
@@ -162,7 +162,7 @@
'status': status,
'current_status': current_status,
'timeout': client.build_timeout})
- caller = misc_utils.find_test_caller()
+ caller = test_utils.find_test_caller()
if caller:
message = '(%s) %s' % (caller, message)
raise exceptions.TimeoutException(message)
@@ -235,7 +235,7 @@
'status': status,
'timeout': client.build_timeout})
message += ' Current state of %s: %s.' % (attr, status_curr)
- caller = misc_utils.find_test_caller()
+ caller = test_utils.find_test_caller()
if caller:
message = '(%s) %s' % (caller, message)
raise exceptions.TimeoutException(message)
diff --git a/tempest/config.py b/tempest/config.py
index 7f7921a..0c2b913 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -192,7 +192,12 @@
help="A list of enabled identity extensions with a special "
"entry all which indicates every extension is enabled. "
"Empty list indicates all extensions are disabled. "
- "To get the list of extensions run: 'keystone discover'")
+ "To get the list of extensions run: 'keystone discover'"),
+ # TODO(rodrigods): Remove the reseller flag when Kilo and Liberty is end
+ # of life.
+ cfg.BoolOpt('reseller',
+ default=False,
+ help='Does the environment support reseller?')
]
compute_group = cfg.OptGroup(name='compute',
@@ -367,7 +372,7 @@
default=True,
help='Does the test environment have the nova cert running?'),
cfg.BoolOpt('personality',
- default=True,
+ default=False,
help='Does the test environment support server personality'),
cfg.BoolOpt('attach_encrypted_volume',
default=True,
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 3289f04..44497db 100644
--- a/tempest/lib/api_schema/response/compute/v2_1/servers.py
+++ b/tempest/lib/api_schema/response/compute/v2_1/servers.py
@@ -174,7 +174,16 @@
'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']},
- 'os-extended-volumes:volumes_attached': {'type': 'array'},
+ 'os-extended-volumes:volumes_attached': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string'}
+ },
+ 'additionalProperties': False,
+ },
+ },
'config_drive': {'type': 'string'}
})
server_detail['properties']['addresses']['patternProperties'][
diff --git a/tempest/lib/services/compute/aggregates_client.py b/tempest/lib/services/compute/aggregates_client.py
index ae747d8..7ad14bc 100644
--- a/tempest/lib/services/compute/aggregates_client.py
+++ b/tempest/lib/services/compute/aggregates_client.py
@@ -41,7 +41,7 @@
"""Create a new aggregate.
Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#createaggregate
+ api-ref-compute-v2.1.html#createAggregate
"""
post_body = json.dumps({'aggregate': kwargs})
resp, body = self.post('os-aggregates', post_body)
@@ -54,7 +54,7 @@
"""Update an aggregate.
Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#updateaggregate
+ api-ref-compute-v2.1.html#updateAggregate
"""
put_body = json.dumps({'aggregate': kwargs})
resp, body = self.put('os-aggregates/%s' % aggregate_id, put_body)
@@ -85,7 +85,7 @@
"""Add a host to the given aggregate.
Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#addhost
+ api-ref-compute-v2.1.html#addHost
"""
post_body = json.dumps({'add_host': kwargs})
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
@@ -98,7 +98,7 @@
"""Remove a host from the given aggregate.
Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#removehost
+ api-ref-compute-v2.1.html#removeAggregateHost
"""
post_body = json.dumps({'remove_host': kwargs})
resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
diff --git a/tempest/lib/services/compute/flavors_client.py b/tempest/lib/services/compute/flavors_client.py
index 0d80a82..5be8272 100644
--- a/tempest/lib/services/compute/flavors_client.py
+++ b/tempest/lib/services/compute/flavors_client.py
@@ -91,7 +91,7 @@
"""Set extra Specs to the mentioned flavor.
Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#updateFlavorExtraSpec
+ api-ref-compute-v2.1.html#createFlavorExtraSpec
"""
post_body = json.dumps({'extra_specs': kwargs})
resp, body = self.post('flavors/%s/os-extra_specs' % flavor_id,
@@ -123,7 +123,7 @@
"""Update specified extra Specs of the mentioned flavor and key.
Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#updateflavorspec
+ api-ref-compute-v2.1.html#updateFlavorExtraSpec
"""
resp, body = self.put('flavors/%s/os-extra_specs/%s' %
(flavor_id, key), json.dumps(kwargs))
diff --git a/tempest/lib/services/compute/migrations_client.py b/tempest/lib/services/compute/migrations_client.py
index 5eae8aa..62246d3 100644
--- a/tempest/lib/services/compute/migrations_client.py
+++ b/tempest/lib/services/compute/migrations_client.py
@@ -26,7 +26,7 @@
"""List all migrations.
Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#returnmigrations
+ api-ref-compute-v2.1.html#listMigrations
"""
url = 'os-migrations'
diff --git a/tempest/lib/services/compute/quotas_client.py b/tempest/lib/services/compute/quotas_client.py
index 184a3d7..6d41f4b 100644
--- a/tempest/lib/services/compute/quotas_client.py
+++ b/tempest/lib/services/compute/quotas_client.py
@@ -46,7 +46,7 @@
"""Updates the tenant's quota limits for one or more resources.
Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#updatesquotatenant
+ api-ref-compute-v2.1.html#updateQuota
"""
post_body = json.dumps({'quota_set': kwargs})
diff --git a/tempest/services/identity/v2/json/roles_client.py b/tempest/lib/services/identity/v2/roles_client.py
similarity index 100%
rename from tempest/services/identity/v2/json/roles_client.py
rename to tempest/lib/services/identity/v2/roles_client.py
diff --git a/tempest/services/identity/v2/json/services_client.py b/tempest/lib/services/identity/v2/services_client.py
similarity index 100%
rename from tempest/services/identity/v2/json/services_client.py
rename to tempest/lib/services/identity/v2/services_client.py
diff --git a/tempest/services/identity/v2/json/tenants_client.py b/tempest/lib/services/identity/v2/tenants_client.py
similarity index 100%
rename from tempest/services/identity/v2/json/tenants_client.py
rename to tempest/lib/services/identity/v2/tenants_client.py
diff --git a/tempest/services/identity/v2/json/users_client.py b/tempest/lib/services/identity/v2/users_client.py
similarity index 100%
rename from tempest/services/identity/v2/json/users_client.py
rename to tempest/lib/services/identity/v2/users_client.py
diff --git a/tempest/lib/services/image/v2/image_members_client.py b/tempest/lib/services/image/v2/image_members_client.py
index 2ae7516..d0ab165 100644
--- a/tempest/lib/services/image/v2/image_members_client.py
+++ b/tempest/lib/services/image/v2/image_members_client.py
@@ -19,6 +19,11 @@
api_version = "v2"
def list_image_members(self, image_id):
+ """List image members.
+
+ Available params: http://developer.openstack.org/
+ api-ref-image-v2.html#listImageMembers-v2
+ """
url = 'images/%s/members' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
@@ -52,12 +57,22 @@
return rest_client.ResponseBody(resp, body)
def show_image_member(self, image_id, member_id):
+ """Show an image member.
+
+ Available params: http://developer.openstack.org/
+ api-ref-image-v2.html#showImageMember-v2
+ """
url = 'images/%s/members/%s' % (image_id, member_id)
resp, body = self.get(url)
self.expected_success(200, resp.status)
return rest_client.ResponseBody(resp, json.loads(body))
def delete_image_member(self, image_id, member_id):
+ """Delete an image member.
+
+ Available params: http://developer.openstack.org/
+ api-ref-image-v2.html#deleteImageMember-v2
+ """
url = 'images/%s/members/%s' % (image_id, member_id)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
diff --git a/tempest/lib/services/image/v2/images_client.py b/tempest/lib/services/image/v2/images_client.py
index 71e7c6b..4276847 100644
--- a/tempest/lib/services/image/v2/images_client.py
+++ b/tempest/lib/services/image/v2/images_client.py
@@ -115,18 +115,33 @@
return rest_client.ResponseBody(resp, body)
def show_image_file(self, image_id):
+ """Show an image file.
+
+ Available params: http://developer.openstack.org/
+ api-ref-image-v2.html#showImageFile-v2
+ """
url = 'images/%s/file' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
return rest_client.ResponseBodyData(resp, body)
def add_image_tag(self, image_id, tag):
+ """Add an image tag.
+
+ Available params: http://developer.openstack.org/
+ api-ref-image-v2.html#addImageTag-v2
+ """
url = 'images/%s/tags/%s' % (image_id, tag)
resp, body = self.put(url, body=None)
self.expected_success(204, resp.status)
return rest_client.ResponseBody(resp, body)
def delete_image_tag(self, image_id, tag):
+ """Delete an image tag.
+
+ Available params: http://developer.openstack.org/
+ api-ref-image-v2.html#deleteImageTag-v2
+ """
url = 'images/%s/tags/%s' % (image_id, tag)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
diff --git a/tempest/lib/services/image/v2/namespaces_client.py b/tempest/lib/services/image/v2/namespaces_client.py
index 97400e1..5bd096d 100644
--- a/tempest/lib/services/image/v2/namespaces_client.py
+++ b/tempest/lib/services/image/v2/namespaces_client.py
@@ -58,6 +58,11 @@
return rest_client.ResponseBody(resp, body)
def delete_namespace(self, namespace):
+ """Delete a namespace.
+
+ Available params: http://developer.openstack.org/
+ api-ref-image-v2.html#deleteNamespace-v2
+ """
url = 'metadefs/namespaces/%s' % namespace
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
diff --git a/tempest/lib/services/network/networks_client.py b/tempest/lib/services/network/networks_client.py
old mode 100644
new mode 100755
index 24c2ec5..19fa1db
--- a/tempest/lib/services/network/networks_client.py
+++ b/tempest/lib/services/network/networks_client.py
@@ -16,11 +16,21 @@
class NetworksClient(base.BaseNetworkClient):
def create_network(self, **kwargs):
+ """Creates a network.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-networking-v2.html#createNetwork
+ """
uri = '/networks'
post_data = {'network': kwargs}
return self.create_resource(uri, post_data)
def update_network(self, network_id, **kwargs):
+ """Updates a network.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-networking-v2.html#updateNetwork
+ """
uri = '/networks/%s' % network_id
post_data = {'network': kwargs}
return self.update_resource(uri, post_data)
diff --git a/tempest/lib/services/network/routers_client.py b/tempest/lib/services/network/routers_client.py
index 78ffa77..2ba1938 100644
--- a/tempest/lib/services/network/routers_client.py
+++ b/tempest/lib/services/network/routers_client.py
@@ -55,7 +55,7 @@
"""Remove router interface.
Available params: see http://developer.openstack.org/
- api-ref-networking-v2-ext.html#removeRouterInterface
+ api-ref-networking-v2-ext.html#deleteRouterInterface
"""
uri = '/routers/%s/remove_router_interface' % router_id
return self.update_resource(uri, kwargs)
diff --git a/tempest/lib/services/network/subnets_client.py b/tempest/lib/services/network/subnets_client.py
old mode 100644
new mode 100755
index 63ed13e..9de4a33
--- a/tempest/lib/services/network/subnets_client.py
+++ b/tempest/lib/services/network/subnets_client.py
@@ -16,11 +16,21 @@
class SubnetsClient(base.BaseNetworkClient):
def create_subnet(self, **kwargs):
+ """Creates a subnet on a network.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-networking-v2.html#createSubnet
+ """
uri = '/subnets'
post_data = {'subnet': kwargs}
return self.create_resource(uri, post_data)
def update_subnet(self, subnet_id, **kwargs):
+ """Updates a subnet.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-networking-v2.html#updateSubnet
+ """
uri = '/subnets/%s' % subnet_id
post_data = {'subnet': kwargs}
return self.update_resource(uri, post_data)
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index 80728dc..446c87a 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -14,6 +14,7 @@
# under the License.
import json
+import re
from oslo_log import log as logging
@@ -83,9 +84,9 @@
def verify_metadata_on_config_drive(self):
if self.run_ssh and CONF.compute_feature_enabled.config_drive:
# Verify metadata on config_drive
- cmd_blkid = 'blkid -t LABEL=config-2 -o device'
- dev_name = self.ssh_client.exec_command(cmd_blkid)
- dev_name = dev_name.rstrip()
+ cmd_blkid = 'blkid | grep -i config-2'
+ result = self.ssh_client.exec_command(cmd_blkid)
+ dev_name = re.match('([^:]+)', result).group()
self.ssh_client.exec_command('sudo mount %s /mnt' % dev_name)
cmd_md = 'sudo cat /mnt/openstack/latest/meta_data.json'
result = self.ssh_client.exec_command(cmd_md)
diff --git a/tempest/services/identity/v2/__init__.py b/tempest/services/identity/v2/__init__.py
index 6f4ebcf..ac2a874 100644
--- a/tempest/services/identity/v2/__init__.py
+++ b/tempest/services/identity/v2/__init__.py
@@ -13,12 +13,12 @@
# the License.
from tempest.lib.services.identity.v2.endpoints_client import EndpointsClient
+from tempest.lib.services.identity.v2.roles_client import RolesClient
+from tempest.lib.services.identity.v2.services_client import ServicesClient
+from tempest.lib.services.identity.v2.tenants_client import TenantsClient
from tempest.lib.services.identity.v2.token_client import TokenClient
+from tempest.lib.services.identity.v2.users_client import UsersClient
from tempest.services.identity.v2.json.identity_client import IdentityClient
-from tempest.services.identity.v2.json.roles_client import RolesClient
-from tempest.services.identity.v2.json.services_client import ServicesClient
-from tempest.services.identity.v2.json.tenants_client import TenantsClient
-from tempest.services.identity.v2.json.users_client import UsersClient
__all__ = ['EndpointsClient', 'TokenClient', 'IdentityClient', 'RolesClient',
'ServicesClient', 'TenantsClient', 'UsersClient']
diff --git a/tempest/services/volume/base/admin/base_types_client.py b/tempest/services/volume/base/admin/base_types_client.py
index 95ddff6..e4d9014 100644
--- a/tempest/services/volume/base/admin/base_types_client.py
+++ b/tempest/services/volume/base/admin/base_types_client.py
@@ -179,3 +179,37 @@
"/types/%s/encryption/provider" % str(vol_type_id))
self.expected_success(202, resp.status)
return rest_client.ResponseBody(resp, body)
+
+ def add_type_access(self, volume_type_id, **kwargs):
+ """Adds volume type access for the given project.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-blockstorage-v2.html
+ #createVolumeTypeAccessExt
+ """
+ post_body = json.dumps({'addProjectAccess': kwargs})
+ url = 'types/%s/action' % (volume_type_id)
+ resp, body = self.post(url, post_body)
+ self.expected_success(202, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ def remove_type_access(self, volume_type_id, **kwargs):
+ """Removes volume type access for the given project.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-blockstorage-v2.html
+ #removeVolumeTypeAccessExt
+ """
+ post_body = json.dumps({'removeProjectAccess': kwargs})
+ url = 'types/%s/action' % (volume_type_id)
+ resp, body = self.post(url, post_body)
+ self.expected_success(202, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ def list_type_access(self, volume_type_id):
+ """Print access information about the given volume type."""
+ url = 'types/%s/os-volume-type-access' % (volume_type_id)
+ resp, body = self.get(url)
+ body = json.loads(body)
+ self.expected_success(200, resp.status)
+ return rest_client.ResponseBody(resp, body)
diff --git a/tempest/tests/cmd/test_run.py b/tempest/tests/cmd/test_run.py
index dcffd21..772391f 100644
--- a/tempest/tests/cmd/test_run.py
+++ b/tempest/tests/cmd/test_run.py
@@ -46,18 +46,24 @@
args = mock.Mock(spec=argparse.Namespace)
setattr(args, 'smoke', False)
setattr(args, 'regex', '')
+ setattr(args, 'whitelist_file', None)
+ setattr(args, 'blacklist_file', None)
self.assertEqual('', self.run_cmd._build_regex(args))
def test__build_regex_smoke(self):
args = mock.Mock(spec=argparse.Namespace)
setattr(args, "smoke", True)
setattr(args, 'regex', '')
+ setattr(args, 'whitelist_file', None)
+ setattr(args, 'blacklist_file', None)
self.assertEqual('smoke', self.run_cmd._build_regex(args))
def test__build_regex_regex(self):
args = mock.Mock(spec=argparse.Namespace)
setattr(args, 'smoke', False)
setattr(args, "regex", 'i_am_a_fun_little_regex')
+ setattr(args, 'whitelist_file', None)
+ setattr(args, 'blacklist_file', None)
self.assertEqual('i_am_a_fun_little_regex',
self.run_cmd._build_regex(args))
diff --git a/tempest/tests/common/test_dynamic_creds.py b/tempest/tests/common/test_dynamic_creds.py
index 7a8637f..b7cc05d 100644
--- a/tempest/tests/common/test_dynamic_creds.py
+++ b/tempest/tests/common/test_dynamic_creds.py
@@ -22,14 +22,14 @@
from tempest import exceptions
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
+from tempest.lib.services.identity.v2 import roles_client as v2_roles_client
+from tempest.lib.services.identity.v2 import tenants_client as \
+ v2_tenants_client
from tempest.lib.services.identity.v2 import token_client as v2_token_client
+from tempest.lib.services.identity.v2 import users_client as v2_users_client
from tempest.lib.services.identity.v3 import token_client as v3_token_client
from tempest.lib.services.network import routers_client
from tempest.services.identity.v2.json import identity_client as v2_iden_client
-from tempest.services.identity.v2.json import roles_client as v2_roles_client
-from tempest.services.identity.v2.json import tenants_client as \
- v2_tenants_client
-from tempest.services.identity.v2.json import users_client as v2_users_client
from tempest.services.identity.v3.json import domains_client
from tempest.services.identity.v3.json import identity_client as v3_iden_client
from tempest.services.identity.v3.json import projects_client as \
diff --git a/tempest/tests/common/test_image.py b/tempest/tests/common/test_image.py
index 34772a2..240df4d 100644
--- a/tempest/tests/common/test_image.py
+++ b/tempest/tests/common/test_image.py
@@ -46,7 +46,8 @@
disk_format='vhd',
copy_from='http://localhost/images/10',
properties={'foo': 'bar'},
- api={'abc': 'def'})
+ api={'abc': 'def'},
+ purge_props=True)
expected = {
'x-image-meta-name': 'test',
@@ -54,6 +55,7 @@
'x-image-meta-disk_format': 'vhd',
'x-glance-api-copy-from': 'http://localhost/images/10',
'x-image-meta-property-foo': 'bar',
- 'x-glance-api-property-abc': 'def'
+ 'x-glance-api-property-abc': 'def',
+ 'x-glance-registry-purge-props': True
}
self.assertEqual(expected, observed)
diff --git a/tempest/tests/services/identity/v2/test_roles_client.py b/tempest/tests/lib/services/identity/v2/test_roles_client.py
similarity index 98%
rename from tempest/tests/services/identity/v2/test_roles_client.py
rename to tempest/tests/lib/services/identity/v2/test_roles_client.py
index e36ec18..464a715 100644
--- a/tempest/tests/services/identity/v2/test_roles_client.py
+++ b/tempest/tests/lib/services/identity/v2/test_roles_client.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.identity.v2.json import roles_client
+from tempest.lib.services.identity.v2 import roles_client
from tempest.tests.lib import fake_auth_provider
from tempest.tests.lib.services import base
diff --git a/tempest/tests/lib/services/identity/v2/test_services_client.py b/tempest/tests/lib/services/identity/v2/test_services_client.py
new file mode 100644
index 0000000..bafb6b1
--- /dev/null
+++ b/tempest/tests/lib/services/identity/v2/test_services_client.py
@@ -0,0 +1,97 @@
+# 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.lib.services.identity.v2 import services_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestServicesClient(base.BaseServiceTest):
+ FAKE_SERVICE_INFO = {
+ "OS-KSADM:service": {
+ "id": "1",
+ "name": "test",
+ "type": "compute",
+ "description": "test_description"
+ }
+ }
+
+ FAKE_LIST_SERVICES = {
+ "OS-KSADM:services": [
+ {
+ "id": "1",
+ "name": "test",
+ "type": "compute",
+ "description": "test_description"
+ },
+ {
+ "id": "2",
+ "name": "test2",
+ "type": "compute",
+ "description": "test2_description"
+ }
+ ]
+ }
+
+ def setUp(self):
+ super(TestServicesClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = services_client.ServicesClient(fake_auth,
+ 'identity', 'regionOne')
+
+ def _test_create_service(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_service,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ self.FAKE_SERVICE_INFO,
+ bytes_body,
+ id="1",
+ name="test",
+ type="compute",
+ description="test_description")
+
+ def _test_show_service(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_service,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_SERVICE_INFO,
+ bytes_body,
+ service_id="1")
+
+ def _test_list_services(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_services,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_LIST_SERVICES,
+ bytes_body)
+
+ def test_create_service_with_str_body(self):
+ self._test_create_service()
+
+ def test_create_service_with_bytes_body(self):
+ self._test_create_service(bytes_body=True)
+
+ def test_show_service_with_str_body(self):
+ self._test_show_service()
+
+ def test_show_service_with_bytes_body(self):
+ self._test_show_service(bytes_body=True)
+
+ def test_delete_service(self):
+ self.check_service_client_function(
+ self.client.delete_service,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ {},
+ service_id="1",
+ status=204)
diff --git a/tempest/tests/lib/services/identity/v2/test_tenants_client.py b/tempest/tests/lib/services/identity/v2/test_tenants_client.py
new file mode 100644
index 0000000..ae3d13a
--- /dev/null
+++ b/tempest/tests/lib/services/identity/v2/test_tenants_client.py
@@ -0,0 +1,131 @@
+# 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.lib.services.identity.v2 import tenants_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestTenantsClient(base.BaseServiceTest):
+ FAKE_TENANT_INFO = {
+ "tenant": {
+ "id": "1",
+ "name": "test",
+ "description": "test_description",
+ "enabled": True
+ }
+ }
+
+ FAKE_LIST_TENANTS = {
+ "tenants": [
+ {
+ "id": "1",
+ "name": "test",
+ "description": "test_description",
+ "enabled": True
+ },
+ {
+ "id": "2",
+ "name": "test2",
+ "description": "test2_description",
+ "enabled": True
+ }
+ ]
+ }
+
+ def setUp(self):
+ super(TestTenantsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = tenants_client.TenantsClient(fake_auth,
+ 'identity', 'regionOne')
+
+ def _test_create_tenant(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_tenant,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ self.FAKE_TENANT_INFO,
+ bytes_body,
+ name="test",
+ description="test_description")
+
+ def _test_show_tenant(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_tenant,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_TENANT_INFO,
+ bytes_body,
+ tenant_id="1")
+
+ def _test_update_tenant(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_tenant,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ self.FAKE_TENANT_INFO,
+ bytes_body,
+ tenant_id="1",
+ name="test",
+ description="test_description")
+
+ def _test_list_tenants(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_tenants,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_LIST_TENANTS,
+ bytes_body)
+
+ def _test_list_tenant_users(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_tenant_users,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_LIST_TENANTS,
+ bytes_body,
+ tenant_id="1")
+
+ def test_create_tenant_with_str_body(self):
+ self._test_create_tenant()
+
+ def test_create_tenant_with_bytes_body(self):
+ self._test_create_tenant(bytes_body=True)
+
+ def test_show_tenant_with_str_body(self):
+ self._test_show_tenant()
+
+ def test_show_tenant_with_bytes_body(self):
+ self._test_show_tenant(bytes_body=True)
+
+ def test_update_tenant_with_str_body(self):
+ self._test_update_tenant()
+
+ def test_update_tenant_with_bytes_body(self):
+ self._test_update_tenant(bytes_body=True)
+
+ def test_list_tenants_with_str_body(self):
+ self._test_list_tenants()
+
+ def test_list_tenants_with_bytes_body(self):
+ self._test_list_tenants(bytes_body=True)
+
+ def test_delete_tenant(self):
+ self.check_service_client_function(
+ self.client.delete_tenant,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ {},
+ tenant_id="1",
+ status=204)
+
+ def test_list_tenant_users_with_str_body(self):
+ self._test_list_tenant_users()
+
+ def test_list_tenant_users_with_bytes_body(self):
+ self._test_list_tenant_users(bytes_body=True)
diff --git a/tempest/tests/lib/services/identity/v2/test_users_client.py b/tempest/tests/lib/services/identity/v2/test_users_client.py
new file mode 100644
index 0000000..9534e44
--- /dev/null
+++ b/tempest/tests/lib/services/identity/v2/test_users_client.py
@@ -0,0 +1,243 @@
+# 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.lib.services.identity.v2 import users_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestUsersClient(base.BaseServiceTest):
+ FAKE_USER_INFO = {
+ "user": {
+ "id": "1",
+ "name": "test",
+ "email": "john.smith@example.org",
+ "enabled": True
+ }
+ }
+
+ FAKE_LIST_USERS = {
+ "users": [
+ {
+ "id": "1",
+ "name": "test",
+ "email": "john.smith@example.org",
+ "enabled": True
+ },
+ {
+ "id": "2",
+ "name": "test2",
+ "email": "john.smith@example.org",
+ "enabled": True
+ }
+ ]
+ }
+
+ FAKE_USER_EC2_CREDENTIAL_INFO = {
+ "credential": {
+ 'user_id': '9beb0e12f3e5416db8d7cccfc785db3b',
+ 'access': '79abf59acc77492a86170cbe2f1feafa',
+ 'secret': 'c4e7d3a691fd4563873d381a40320f46',
+ 'trust_id': None,
+ 'tenant_id': '596557269d7b4dd78631a602eb9f151d'
+ }
+ }
+
+ FAKE_LIST_USER_EC2_CREDENTIALS = {
+ "credentials": [
+ {
+ 'user_id': '9beb0e12f3e5416db8d7cccfc785db3b',
+ 'access': '79abf59acc77492a86170cbe2f1feafa',
+ 'secret': 'c4e7d3a691fd4563873d381a40320f46',
+ 'trust_id': None,
+ 'tenant_id': '596557269d7b4dd78631a602eb9f151d'
+ },
+ {
+ 'user_id': '3beb0e12f3e5416db8d7cccfc785de4r',
+ 'access': '45abf59acc77492a86170cbe2f1fesde',
+ 'secret': 'g4e7d3a691fd4563873d381a40320e45',
+ 'trust_id': None,
+ 'tenant_id': '123557269d7b4dd78631a602eb9f112f'
+ }
+ ]
+ }
+
+ def setUp(self):
+ super(TestUsersClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = users_client.UsersClient(fake_auth,
+ 'identity', 'regionOne')
+
+ def _test_create_user(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_user,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ self.FAKE_USER_INFO,
+ bytes_body,
+ name="test",
+ email="john.smith@example.org")
+
+ def _test_update_user(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_user,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_USER_INFO,
+ bytes_body,
+ user_id="1",
+ name="test")
+
+ def _test_show_user(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_user,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_USER_INFO,
+ bytes_body,
+ user_id="1")
+
+ def _test_list_users(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_users,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_LIST_USERS,
+ bytes_body)
+
+ def _test_update_user_enabled(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_user_enabled,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_USER_INFO,
+ bytes_body,
+ user_id="1",
+ enabled=True)
+
+ def _test_update_user_password(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_user_password,
+ 'tempest.lib.common.rest_client.RestClient.put',
+ self.FAKE_USER_INFO,
+ bytes_body,
+ user_id="1",
+ password="pass")
+
+ def _test_update_user_own_password(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.update_user_own_password,
+ 'tempest.lib.common.rest_client.RestClient.patch',
+ self.FAKE_USER_INFO,
+ bytes_body,
+ user_id="1",
+ password="pass")
+
+ def _test_create_user_ec2_credential(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_user_ec2_credential,
+ 'tempest.lib.common.rest_client.RestClient.post',
+ self.FAKE_USER_EC2_CREDENTIAL_INFO,
+ bytes_body,
+ user_id="1",
+ tenant_id="123")
+
+ def _test_show_user_ec2_credential(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_user_ec2_credential,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_USER_EC2_CREDENTIAL_INFO,
+ bytes_body,
+ user_id="1",
+ access="123")
+
+ def _test_list_user_ec2_credentials(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_user_ec2_credentials,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_LIST_USER_EC2_CREDENTIALS,
+ bytes_body,
+ user_id="1")
+
+ def test_create_user_with_str_body(self):
+ self._test_create_user()
+
+ def test_create_user_with_bytes_body(self):
+ self._test_create_user(bytes_body=True)
+
+ def test_update_user_with_str_body(self):
+ self._test_update_user()
+
+ def test_update_user_with_bytes_body(self):
+ self._test_update_user(bytes_body=True)
+
+ def test_show_user_with_str_body(self):
+ self._test_show_user()
+
+ def test_show_user_with_bytes_body(self):
+ self._test_show_user(bytes_body=True)
+
+ def test_list_users_with_str_body(self):
+ self._test_list_users()
+
+ def test_list_users_with_bytes_body(self):
+ self._test_list_users(bytes_body=True)
+
+ def test_delete_user(self):
+ self.check_service_client_function(
+ self.client.delete_user,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ {},
+ user_id="1",
+ status=204)
+
+ def test_update_user_enabled_with_str_body(self):
+ self._test_update_user_enabled()
+
+ def test_update_user_enabled_with_bytes_body(self):
+ self._test_update_user_enabled(bytes_body=True)
+
+ def test_update_user_password_with_str_body(self):
+ self._test_update_user_password()
+
+ def test_update_user_password_with_bytes_body(self):
+ self._test_update_user_password(bytes_body=True)
+
+ def test_update_user_own_password_with_str_body(self):
+ self._test_update_user_own_password()
+
+ def test_update_user_own_password_with_bytes_body(self):
+ self._test_update_user_own_password(bytes_body=True)
+
+ def test_create_user_ec2_credential_with_str_body(self):
+ self._test_create_user_ec2_credential()
+
+ def test_create_user_ec2_credential_with_bytes_body(self):
+ self._test_create_user_ec2_credential(bytes_body=True)
+
+ def test_show_user_ec2_credential_with_str_body(self):
+ self._test_show_user_ec2_credential()
+
+ def test_show_user_ec2_credential_with_bytes_body(self):
+ self._test_show_user_ec2_credential(bytes_body=True)
+
+ def test_list_user_ec2_credentials_with_str_body(self):
+ self._test_list_user_ec2_credentials()
+
+ def test_list_user_ec2_credentials_with_bytes_body(self):
+ self._test_list_user_ec2_credentials(bytes_body=True)
+
+ def test_delete_user_ec2_credential(self):
+ self.check_service_client_function(
+ self.client.delete_user_ec2_credential,
+ 'tempest.lib.common.rest_client.RestClient.delete',
+ {},
+ user_id="123",
+ access="1234",
+ status=204)
diff --git a/tempest/tests/services/identity/__init__.py b/tempest/tests/services/identity/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/tests/services/identity/__init__.py
+++ /dev/null
diff --git a/tempest/tests/services/identity/v2/__init__.py b/tempest/tests/services/identity/v2/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/tests/services/identity/v2/__init__.py
+++ /dev/null
diff --git a/test-requirements.txt b/test-requirements.txt
index 763f0ba..04c3d6d 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,12 +1,12 @@
# 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.
-hacking<0.11,>=0.10.0
+hacking<0.12,>=0.11.0 # Apache-2.0
# needed for doc build
-sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD
+sphinx!=1.3b1,<1.3,>=1.2.1 # BSD
python-subunit>=0.0.18 # Apache-2.0/BSD
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
-reno>=1.6.2 # Apache2
+reno>=1.8.0 # Apache2
mock>=2.0 # BSD
coverage>=3.6 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0