Merge "API tests for neutron router gateway"
diff --git a/doc/source/conf.py b/doc/source/conf.py
index cf838c0..e5444ae 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -51,17 +51,6 @@
project = u'Tempest'
copyright = u'2013, OpenStack QA Team'
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-import pbr.version
-version_info = pbr.version.VersionInfo('tempest')
-version = version_info.version_string()
-# The full version, including alpha/beta/rc tags.
-release = version_info.release_string()
-
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 115a2b5..87bf758 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -2,7 +2,7 @@
#log_config = /opt/stack/tempest/etc/logging.conf.sample
# disable logging to the stderr
-use_stderr = False
+use_stderr = false
# log file
log_file = tempest.log
@@ -23,7 +23,7 @@
catalog_type = identity
# Ignore SSL certificate validation failures? Use when in testing
# environments that have self-signed SSL certs.
-disable_ssl_certificate_validation = False
+disable_ssl_certificate_validation = false
# URL for where to find the OpenStack Identity API endpoint (Keystone)
uri = http://127.0.0.1:5000/v2.0/
# URL for where to find the OpenStack V3 Identity API endpoint (Keystone)
@@ -131,7 +131,7 @@
ssh_channel_timeout = 60
# Dose the SSH uses Floating IP?
-use_floatingip_for_ssh = True
+use_floatingip_for_ssh = true
# The type of endpoint for a Compute API service. Unless you have a
# custom Keystone service catalog implementation, you probably want to leave
@@ -143,36 +143,37 @@
# catalog, the first found one is used.
#region = RegionOne
+# Expected first device name when a volume is attached to an instance
+volume_device_name = vdb
+
+[compute-feature-enabled]
# Does the Compute API support creation of images?
-create_image_enabled = true
+create_image = true
# For resize to work with libvirt/kvm, one of the following must be true:
-# Single node: allow_resize_to_same_host=True must be set in nova.conf
+# Single node: allow_resize_to_same_host=true must be set in nova.conf
# Cluster: the 'nova' user must have scp access between cluster nodes
-resize_available = true
+resize = true
# Does the compute API support changing the admin password?
-change_password_available=true
+change_password = false
# Run live migration tests (requires 2 hosts)
-live_migration_available = false
+live_migration = false
# Use block live migration (Otherwise, non-block migration will be
# performed, which requires XenServer pools in case of using XS)
-use_block_migration_for_live_migration = false
+block_migration_for_live_migration = false
# Supports iSCSI block migration - depends on a XAPI supporting
# relax-xsm-sr-check
-block_migrate_supports_cinder_iscsi = false
+block_migrate_cinder_iscsi = false
# When set to false, disk config tests are forced to skip
-disk_config_enabled = true
+disk_config = true
# When set to false, flavor extra data tests are forced to skip
-flavor_extra_enabled = true
-
-# Expected first device name when a volume is attached to an instance
-volume_device_name = vdb
+flavor_extra = true
[compute-admin]
# This should be the username of a user WITH administrative privileges
@@ -197,12 +198,15 @@
# catalog, the first found one is used.
#region = RegionOne
-# The version of the OpenStack Images API to use
-api_version = 1
-
# HTTP image to use for glance http image testing
http_image = http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz
+[image-feature-enabled]
+# Is the image api_v1 enabled
+api_v1 = True
+# Is the image api_v2 enabled
+api_v2 = True
+
[network]
# This section contains configuration options used when executing tests
# against the OpenStack Network API.
@@ -258,10 +262,8 @@
# Number of seconds to time out on waiting for a volume
# to be available or reach an expected status
build_timeout = 300
-# Runs Cinder multi-backend tests (requires 2 backends declared in cinder.conf)
-# They must have different volume_backend_name (backend1_name and backend2_name
-# have to be different)
-multi_backend_enabled = false
+# If multi_backend is enabled there must be 2 volume_backend_names (
+# backend1_name and backend2_name) which have to be different)
backend1_name = BACKEND_1
backend2_name = BACKEND_2
# Protocol and vendor of volume backend to target when testing volume-types.
@@ -269,6 +271,10 @@
storage_protocol = iSCSI
vendor_name = Open Source
+[volume-feature-enabled]
+#Runs Cinder multi-backend tests (requires 2 backends declared in cinder.conf)
+multi_backend = false
+
[object-storage]
# This section contains configuration options used when executing tests
# against the OpenStack Object Storage API.
@@ -291,14 +297,16 @@
# Number of seconds to wait while looping to check the status of a
# container to container synchronization
container_sync_interval = 5
-# Set to True if the Account Quota middleware is enabled
-accounts_quotas_available = True
-# Set to True if the Container Quota middleware is enabled
-container_quotas_available = True
# Set operator role for tests that require creating a container
operator_role = Member
+[object-feature-enabled]
+# Set to True if the Account Quota middleware is enabled
+accounts_quotas = True
+# Set to True if the Container Quota middleware is enabled
+container_quotas = True
+
[boto]
# This section contains configuration options used when executing tests
# with boto.
@@ -403,7 +411,7 @@
[cli]
# Enable cli tests
-enabled = True
+enabled = true
# directory where python client binaries are located
cli_dir = /usr/local/bin
# Number of seconds to wait on a CLI timeout
@@ -411,19 +419,21 @@
[service_available]
# Whether or not cinder is expected to be available
-cinder = True
+cinder = true
# Whether or not neutron is expected to be available
neutron = false
# Whether or not glance is expected to be available
-glance = True
+glance = true
# Whether or not swift is expected to be available
-swift = True
+swift = true
# Whether or not nova is expected to be available
-nova = True
+nova = true
# Whether or not Heat is expected to be available
heat = false
+# Whether or not Ceilometer is expected to be available
+ceilometer = True
# Whether or not horizon is expected to be available
-horizon = True
+horizon = true
[stress]
# Maximum number of instances to create during test
@@ -431,8 +441,8 @@
# Time (in seconds) between log file error checks
log_check_interval = 60
# The default number of threads created while stress test
-default_thread_number_per_action=4
+default_thread_number_per_action = 4
[debug]
# Enable diagnostic commands
-enable = True
+enable = true
diff --git a/etc/whitelist.yaml b/etc/whitelist.yaml
index 6762f9f..e6d28f5 100644
--- a/etc/whitelist.yaml
+++ b/etc/whitelist.yaml
@@ -21,6 +21,16 @@
message: "Instance failed to spawn"
- module: "nova.compute.manager"
message: "Error: Unexpected error while running command"
+ - module: "nova.virt.libvirt.driver"
+ message: "Error from libvirt during destroy"
+ - module: "nova.virt.libvirt.vif"
+ message: "Failed while unplugging vif"
+ - module: "nova.openstack.common.loopingcal"
+ message: "in fixed duration looping call"
+ - module: "nova.virt.libvirt.driver"
+ message: "Getting disk size of instance"
+ - module: "nova.virt.libvirt.driver"
+ message: "No such file or directory: '/opt/stack/data/nova/instances"
g-api:
- module: "glance.store.sheepdog"
@@ -34,6 +44,12 @@
message: "Requested operation is not valid: domain is not running"
- module: "ceilometer.compute.pollsters.disk"
message: "Domain not found: no domain with matching uuid"
+ - module: "ceilometer.compute.pollsters.net"
+ message: "No module named libvirt"
+
+ceilometer-alarm-evaluator:
+ - module: "ceilometer.alarm.service"
+ message: "alarm evaluation cycle failed"
h-api:
- module: "root"
@@ -63,6 +79,8 @@
message: "ServersTest"
- module: "nova.compute.api"
message: "\\{u'kernel_id'.*u'ramdisk_id':"
+ - module: "nova.api.openstack.wsgi"
+ message: "takes exactly 4 arguments"
n-cond:
- module: "nova.notifications"
@@ -75,6 +93,16 @@
c-api:
- module: "cinder.api.middleware.fault"
message: "Caught error: Volume .* could not be found"
+ - module: "cinder.api.middleware.fault"
+ message: "Caught error: Snapshot .* could not be found"
+
+c-vol:
+ - module: "cinder.brick.iscsi.iscsi"
+ message: "Failed to create iscsi target for volume id"
+ - module: "cinder.brick.local_dev.lvm"
+ message: "/dev/dm-1: stat failed: No such file or directory"
+ - module: "cinder.brick.local_dev.lvm"
+ message: "Can't remove open logical volume"
q-dhpc:
- module: "neutron.common.legacy"
@@ -89,6 +117,8 @@
message: ".*"
- module: "ceilometer.collector.dispatcher.database"
message: "duplicate key value violates unique constraint"
+ - module: "ceilometer.collector.dispatcher.database"
+ message: "Failed to record metering data: QueuePool limit"
q-agt:
- module: "neutron.agent.linux.ovs_lib"
@@ -108,6 +138,9 @@
- module: "neutron.agent.l3_agent"
message: "Failed synchronizing routers"
+q-vpn:
+ - module: "neutron.common.legacy"
+ message: "Skipping unknown group key: firewall_driver"
q-lbaas:
- module: "neutron.common.legacy"
@@ -123,9 +156,7 @@
- module: "neutron.openstack.common.rpc.amqp"
message: "Exception during message handling"
- module: "neutron.openstack.common.rpc.common"
- message: "Network .* could not be found"
- - module: "neutron.openstack.common.rpc.common"
- message: "Pool .* could not be found"
+ message: "(Network|Pool|Subnet|Agent|Port) .* could not be found"
- module: "neutron.api.v2.resource"
- message: "show failed"
+ message: ".* failed"
diff --git a/openstack-common.conf b/openstack-common.conf
index ff84404..dabf5a0 100644
--- a/openstack-common.conf
+++ b/openstack-common.conf
@@ -5,6 +5,7 @@
module=lockutils
module=log
module=importlib
+module=fixture
# The base module to hold the copy of openstack.common
base=tempest
diff --git a/requirements.txt b/requirements.txt
index 3b9ec44..4f6a1d3 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,20 +5,20 @@
jsonschema>=1.3.0,!=1.4.0
testtools>=0.9.32
lxml>=2.3
-boto>=2.4.0
+boto>=2.4.0,!=2.13.0
paramiko>=1.8.0
netaddr
python-glanceclient>=0.9.0
-python-keystoneclient>=0.3.0
-python-novaclient>=2.12.0
-python-neutronclient>=2.2.3,<3
-python-cinderclient>=1.0.4
+python-keystoneclient>=0.4.1
+python-novaclient>=2.15.0
+python-neutronclient>=2.3.0,<3
+python-cinderclient>=1.0.6
python-heatclient>=0.2.3
testresources>=0.2.4
-keyring>=1.6.1
+keyring>=1.6.1,<2.0
testrepository>=0.0.17
oslo.config>=1.2.0
eventlet>=0.13.0
-six<1.4.0
+six>=1.4.1
iso8601>=0.1.4
fixtures>=0.3.14
diff --git a/setup.cfg b/setup.cfg
index a4cf118..23a97ff 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = tempest
-version = 2013.2
+version = 2014.1
summary = OpenStack Integration Testing
description-file =
README.rst
@@ -17,20 +17,7 @@
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
-[global]
-setup-hooks =
- pbr.hooks.setup_hook
-
[build_sphinx]
all_files = 1
build-dir = doc/build
source-dir = doc/source
-
-[nosetests]
-# NOTE(jkoelker) To run the test suite under nose install the following
-# coverage http://pypi.python.org/pypi/coverage
-# openstack-nose https://github.com/openstack-dev/openstack-nose
-verbosity=2
-
-[pbr]
-autodoc_tree_index_modules=true
diff --git a/setup.py b/setup.py
index 59a0090..70c2b3f 100755
--- a/setup.py
+++ b/setup.py
@@ -14,8 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
setuptools.setup(
- setup_requires=['d2to1', 'pbr'],
- d2to1=True)
+ setup_requires=['pbr'],
+ pbr=True)
diff --git a/tempest/api/compute/__init__.py b/tempest/api/compute/__init__.py
index 2c21740..a528754 100644
--- a/tempest/api/compute/__init__.py
+++ b/tempest/api/compute/__init__.py
@@ -22,11 +22,11 @@
LOG = logging.getLogger(__name__)
CONFIG = config.TempestConfig()
-CREATE_IMAGE_ENABLED = CONFIG.compute.create_image_enabled
-RESIZE_AVAILABLE = CONFIG.compute.resize_available
-CHANGE_PASSWORD_AVAILABLE = CONFIG.compute.change_password_available
-DISK_CONFIG_ENABLED = CONFIG.compute.disk_config_enabled
-FLAVOR_EXTRA_DATA_ENABLED = CONFIG.compute.flavor_extra_enabled
+CREATE_IMAGE_ENABLED = CONFIG.compute_feature_enabled.create_image
+RESIZE_AVAILABLE = CONFIG.compute_feature_enabled.resize
+CHANGE_PASSWORD_AVAILABLE = CONFIG.compute_feature_enabled.change_password
+DISK_CONFIG_ENABLED = CONFIG.compute_feature_enabled.disk_config
+FLAVOR_EXTRA_DATA_ENABLED = CONFIG.compute_feature_enabled.flavor_extra
MULTI_USER = True
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 14ab236..4ff6b07 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -22,7 +22,7 @@
from tempest.test import attr
-class AggregatesAdminTestJSON(base.BaseComputeAdminTest):
+class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests Aggregates API that require admin privileges
@@ -85,7 +85,7 @@
aggregates))
@attr(type='gate')
- def test_aggregate_create_get_details(self):
+ def test_aggregate_create_update_metadata_get_details(self):
# Create an aggregate and ensure its details are returned.
aggregate_name = rand_name(self.aggregate_name_prefix)
resp, aggregate = self.client.create_aggregate(aggregate_name)
@@ -96,6 +96,18 @@
self.assertEqual(aggregate['name'], body['name'])
self.assertEqual(aggregate['availability_zone'],
body['availability_zone'])
+ self.assertEqual({}, body["metadata"])
+
+ # set the metadata of the aggregate
+ meta = {"key": "value"}
+ resp, body = self.client.set_metadata(aggregate['id'], meta)
+ self.assertEqual(200, resp.status)
+ self.assertEqual(meta, body["metadata"])
+
+ # verify the metadata has been set
+ resp, body = self.client.get_aggregate(aggregate['id'])
+ self.assertEqual(200, resp.status)
+ self.assertEqual(meta, body["metadata"])
@attr(type='gate')
def test_aggregate_create_update_with_az(self):
diff --git a/tempest/api/compute/admin/test_availability_zone.py b/tempest/api/compute/admin/test_availability_zone.py
index d1e1be6..d6488c4 100644
--- a/tempest/api/compute/admin/test_availability_zone.py
+++ b/tempest/api/compute/admin/test_availability_zone.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class AvailabilityZoneAdminTestJSON(base.BaseComputeAdminTest):
+class AvailabilityZoneAdminTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests Availability Zone API List that require admin privileges
diff --git a/tempest/api/compute/admin/test_fixed_ips.py b/tempest/api/compute/admin/test_fixed_ips.py
index ee262df..766589e 100644
--- a/tempest/api/compute/admin/test_fixed_ips.py
+++ b/tempest/api/compute/admin/test_fixed_ips.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class FixedIPsTestJson(base.BaseComputeAdminTest):
+class FixedIPsTestJson(base.BaseV2ComputeAdminTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py
index 004268e..75b8dad 100644
--- a/tempest/api/compute/admin/test_flavors.py
+++ b/tempest/api/compute/admin/test_flavors.py
@@ -24,7 +24,7 @@
from tempest.test import skip_because
-class FlavorsAdminTestJSON(base.BaseComputeAdminTest):
+class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests Flavors API Create and Delete that require admin privileges
diff --git a/tempest/api/compute/admin/test_flavors_access.py b/tempest/api/compute/admin/test_flavors_access.py
index 5495778..e8ae3b4 100644
--- a/tempest/api/compute/admin/test_flavors_access.py
+++ b/tempest/api/compute/admin/test_flavors_access.py
@@ -25,7 +25,7 @@
from tempest.test import attr
-class FlavorsAccessTestJSON(base.BaseComputeAdminTest):
+class FlavorsAccessTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests Flavor Access API extension.
diff --git a/tempest/api/compute/admin/test_flavors_extra_specs.py b/tempest/api/compute/admin/test_flavors_extra_specs.py
index fb6a463..0fd4d11 100644
--- a/tempest/api/compute/admin/test_flavors_extra_specs.py
+++ b/tempest/api/compute/admin/test_flavors_extra_specs.py
@@ -23,7 +23,7 @@
from tempest.test import attr
-class FlavorsExtraSpecsTestJSON(base.BaseComputeAdminTest):
+class FlavorsExtraSpecsTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests Flavor Extra Spec API extension.
@@ -79,6 +79,12 @@
self.client.get_flavor_extra_spec(self.flavor['id'])
self.assertEqual(get_resp.status, 200)
self.assertEqual(get_body, specs)
+ # GET a key value and verify
+ get_resp, get_body = \
+ self.client.get_flavor_extra_spec_with_key(self.flavor['id'],
+ "key2")
+ self.assertEqual(get_resp.status, 200)
+ self.assertEqual(get_body, specs['key2'])
# UNSET extra specs that were set in this test
unset_resp, _ = \
self.client.unset_flavor_extra_spec(self.flavor['id'], "key1")
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index bf09428..8e451a0 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -16,12 +16,10 @@
from tempest.api.compute import base
from tempest.common import tempest_fixtures as fixtures
-from tempest.common.utils.data_utils import rand_name
-from tempest import exceptions
from tempest.test import attr
-class HostsAdminTestJSON(base.BaseComputeAdminTest):
+class HostsAdminTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests hosts API using admin privileges.
@@ -33,7 +31,13 @@
def setUpClass(cls):
super(HostsAdminTestJSON, cls).setUpClass()
cls.client = cls.os_adm.hosts_client
- cls.non_admin_client = cls.os.hosts_client
+
+ def _get_host_name(self):
+ resp, hosts = self.client.list_hosts()
+ self.assertEqual(200, resp.status)
+ self.assertTrue(len(hosts) >= 1)
+ hostname = hosts[0]['host_name']
+ return hostname
@attr(type='gate')
def test_list_hosts(self):
@@ -53,14 +57,7 @@
self.assertTrue(len(hosts) >= 1)
self.assertIn(host, hosts)
- @attr(type='negative')
- def test_list_hosts_with_non_existent_zone(self):
- params = {'zone': 'xxx'}
- resp, hosts = self.client.list_hosts(params)
- self.assertEqual(0, len(hosts))
- self.assertEqual(200, resp.status)
-
- @attr(type='negative')
+ @attr(type='gate')
def test_list_hosts_with_a_blank_zone(self):
# If send the request with a blank zone, the request will be successful
# and it will return all the hosts list
@@ -69,17 +66,18 @@
self.assertNotEqual(0, len(hosts))
self.assertEqual(200, resp.status)
- @attr(type=['negative', 'gate'])
- def test_list_hosts_with_non_admin_user(self):
- self.assertRaises(exceptions.Unauthorized,
- self.non_admin_client.list_hosts)
+ @attr(type='gate')
+ def test_list_hosts_with_nonexistent_zone(self):
+ # If send the request with a nonexistent zone, the request will be
+ # successful and no hosts will be retured
+ params = {'zone': 'xxx'}
+ resp, hosts = self.client.list_hosts(params)
+ self.assertEqual(0, len(hosts))
+ self.assertEqual(200, resp.status)
@attr(type='gate')
def test_show_host_detail(self):
- resp, hosts = self.client.list_hosts()
- self.assertEqual(200, resp.status)
- self.assertTrue(len(hosts) >= 1)
- hostname = hosts[0]['host_name']
+ hostname = self._get_host_name()
resp, resources = self.client.show_host_detail(hostname)
self.assertEqual(200, resp.status)
@@ -92,12 +90,6 @@
self.assertIsNotNone(host_resource['project'])
self.assertEqual(hostname, host_resource['host'])
- @attr(type='negative')
- def test_show_host_detail_with_nonexist_hostname(self):
- hostname = rand_name('rand_hostname')
- self.assertRaises(exceptions.NotFound,
- self.client.show_host_detail, hostname)
-
class HostsAdminTestXML(HostsAdminTestJSON):
_interface = 'xml'
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
new file mode 100644
index 0000000..6b24e72
--- /dev/null
+++ b/tempest/api/compute/admin/test_hosts_negative.py
@@ -0,0 +1,174 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 Huawei Technologies Co.,LTD.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest.test import attr
+
+
+class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
+
+ """
+ Tests hosts API using admin privileges.
+ """
+
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(HostsAdminNegativeTestJSON, cls).setUpClass()
+ cls.client = cls.os_adm.hosts_client
+ cls.non_admin_client = cls.os.hosts_client
+
+ def _get_host_name(self):
+ resp, hosts = self.client.list_hosts()
+ self.assertEqual(200, resp.status)
+ self.assertTrue(len(hosts) >= 1)
+ hostname = hosts[0]['host_name']
+ return hostname
+
+ @attr(type=['negative', 'gate'])
+ def test_list_hosts_with_non_admin_user(self):
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_admin_client.list_hosts)
+
+ @attr(type=['negative', 'gate'])
+ def test_show_host_detail_with_nonexistent_hostname(self):
+ nonexitent_hostname = data_utils.rand_name('rand_hostname')
+ self.assertRaises(exceptions.NotFound,
+ self.client.show_host_detail, nonexitent_hostname)
+
+ @attr(type=['negative', 'gate'])
+ def test_show_host_detail_with_non_admin_user(self):
+ hostname = self._get_host_name()
+
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_admin_client.show_host_detail,
+ hostname)
+
+ @attr(type=['negative', 'gate'])
+ def test_update_host_with_non_admin_user(self):
+ hostname = self._get_host_name()
+
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_admin_client.update_host,
+ hostname)
+
+ @attr(type=['negative', 'gate'])
+ def test_update_host_with_extra_param(self):
+ # only 'status' and 'maintenance_mode' are the valid params.
+ hostname = self._get_host_name()
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.update_host,
+ hostname,
+ status='enable',
+ maintenance_mode='enable',
+ param='XXX')
+
+ @attr(type=['negative', 'gate'])
+ def test_update_host_with_invalid_status(self):
+ # 'status' can only be 'enable' or 'disable'
+ hostname = self._get_host_name()
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.update_host,
+ hostname,
+ status='invalid',
+ maintenance_mode='enable')
+
+ @attr(type=['negative', 'gate'])
+ def test_update_host_with_invalid_maintenance_mode(self):
+ # 'maintenance_mode' can only be 'enable' or 'disable'
+ hostname = self._get_host_name()
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.update_host,
+ hostname,
+ status='enable',
+ maintenance_mode='invalid')
+
+ @attr(type=['negative', 'gate'])
+ def test_update_host_without_param(self):
+ # 'status' or 'maintenance_mode' needed for host update
+ hostname = self._get_host_name()
+
+ self.assertRaises(exceptions.BadRequest,
+ self.client.update_host,
+ hostname)
+
+ @attr(type=['negative', 'gate'])
+ def test_update_nonexistent_host(self):
+ nonexitent_hostname = data_utils.rand_name('rand_hostname')
+
+ self.assertRaises(exceptions.NotFound,
+ self.client.update_host,
+ nonexitent_hostname,
+ status='enable',
+ maintenance_mode='enable')
+
+ @attr(type=['negative', 'gate'])
+ def test_startup_nonexistent_host(self):
+ nonexitent_hostname = data_utils.rand_name('rand_hostname')
+
+ self.assertRaises(exceptions.NotFound,
+ self.client.startup_host,
+ nonexitent_hostname)
+
+ @attr(type=['negative', 'gate'])
+ def test_startup_host_with_non_admin_user(self):
+ hostname = self._get_host_name()
+
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_admin_client.startup_host,
+ hostname)
+
+ @attr(type=['negative', 'gate'])
+ def test_shutdown_nonexistent_host(self):
+ nonexitent_hostname = data_utils.rand_name('rand_hostname')
+
+ self.assertRaises(exceptions.NotFound,
+ self.client.shutdown_host,
+ nonexitent_hostname)
+
+ @attr(type=['negative', 'gate'])
+ def test_shutdown_host_with_non_admin_user(self):
+ hostname = self._get_host_name()
+
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_admin_client.shutdown_host,
+ hostname)
+
+ @attr(type=['negative', 'gate'])
+ def test_reboot_nonexistent_host(self):
+ nonexitent_hostname = data_utils.rand_name('rand_hostname')
+
+ self.assertRaises(exceptions.NotFound,
+ self.client.reboot_host,
+ nonexitent_hostname)
+
+ @attr(type=['negative', 'gate'])
+ def test_reboot_host_with_non_admin_user(self):
+ hostname = self._get_host_name()
+
+ self.assertRaises(exceptions.Unauthorized,
+ self.non_admin_client.reboot_host,
+ hostname)
+
+
+class HostsAdminNegativeTestXML(HostsAdminNegativeTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/compute/admin/test_hypervisor.py b/tempest/api/compute/admin/test_hypervisor.py
index 5ca16f4..ef4f51f 100644
--- a/tempest/api/compute/admin/test_hypervisor.py
+++ b/tempest/api/compute/admin/test_hypervisor.py
@@ -16,11 +16,10 @@
# under the License.
from tempest.api.compute import base
-from tempest import exceptions
from tempest.test import attr
-class HypervisorAdminTestJSON(base.BaseComputeAdminTest):
+class HypervisorAdminTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests Hypervisors API that require admin privileges
@@ -32,7 +31,6 @@
def setUpClass(cls):
super(HypervisorAdminTestJSON, cls).setUpClass()
cls.client = cls.os_adm.hypervisor_client
- cls.non_adm_client = cls.hypervisor_client
def _list_hypervisors(self):
# List of hypervisors
@@ -93,19 +91,14 @@
self.assertEqual(200, resp.status)
self.assertTrue(len(uptime) > 0)
- @attr(type=['negative', 'gate'])
- def test_get_hypervisor_list_with_non_admin_user(self):
- # List of hypervisor and available services with non admin user
- self.assertRaises(
- exceptions.Unauthorized,
- self.non_adm_client.get_hypervisor_list)
-
- @attr(type=['negative', 'gate'])
- def test_get_hypervisor_list_details_with_non_admin_user(self):
- # List of hypervisor details and available services with non admin user
- self.assertRaises(
- exceptions.Unauthorized,
- self.non_adm_client.get_hypervisor_list_details)
+ @attr(type='gate')
+ def test_search_hypervisor(self):
+ hypers = self._list_hypervisors()
+ self.assertTrue(len(hypers) > 0)
+ resp, hypers = self.client.search_hypervisor(
+ hypers[0]['hypervisor_hostname'])
+ self.assertEqual(200, resp.status)
+ self.assertTrue(len(hypers) > 0)
class HypervisorAdminTestXML(HypervisorAdminTestJSON):
diff --git a/tempest/api/compute/admin/test_hypervisor_negative.py b/tempest/api/compute/admin/test_hypervisor_negative.py
new file mode 100644
index 0000000..c6455b5
--- /dev/null
+++ b/tempest/api/compute/admin/test_hypervisor_negative.py
@@ -0,0 +1,144 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 Huawei Technologies Co.,LTD.
+# 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 uuid
+
+from tempest.api.compute import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest.test import attr
+
+
+class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
+
+ """
+ Tests Hypervisors API that require admin privileges
+ """
+
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(HypervisorAdminNegativeTestJSON, cls).setUpClass()
+ cls.client = cls.os_adm.hypervisor_client
+ cls.non_adm_client = cls.hypervisor_client
+
+ def _list_hypervisors(self):
+ # List of hypervisors
+ resp, hypers = self.client.get_hypervisor_list()
+ self.assertEqual(200, resp.status)
+ return hypers
+
+ @attr(type=['negative', 'gate'])
+ def test_show_nonexistent_hypervisor(self):
+ nonexistent_hypervisor_id = str(uuid.uuid4())
+
+ self.assertRaises(
+ exceptions.NotFound,
+ self.client.get_hypervisor_show_details,
+ nonexistent_hypervisor_id)
+
+ @attr(type=['negative', 'gate'])
+ def test_show_hypervisor_with_non_admin_user(self):
+ hypers = self._list_hypervisors()
+ self.assertTrue(len(hypers) > 0)
+
+ self.assertRaises(
+ exceptions.Unauthorized,
+ self.non_adm_client.get_hypervisor_show_details,
+ hypers[0]['id'])
+
+ @attr(type=['negative', 'gate'])
+ def test_show_servers_with_non_admin_user(self):
+ hypers = self._list_hypervisors()
+ self.assertTrue(len(hypers) > 0)
+
+ self.assertRaises(
+ exceptions.Unauthorized,
+ self.non_adm_client.get_hypervisor_servers,
+ hypers[0]['id'])
+
+ @attr(type=['negative', 'gate'])
+ def test_show_servers_with_nonexistent_hypervisor(self):
+ nonexistent_hypervisor_id = str(uuid.uuid4())
+
+ self.assertRaises(
+ exceptions.NotFound,
+ self.client.get_hypervisor_servers,
+ nonexistent_hypervisor_id)
+
+ @attr(type=['negative', 'gate'])
+ def test_get_hypervisor_stats_with_non_admin_user(self):
+ self.assertRaises(
+ exceptions.Unauthorized,
+ self.non_adm_client.get_hypervisor_stats)
+
+ @attr(type=['negative', 'gate'])
+ def test_get_nonexistent_hypervisor_uptime(self):
+ nonexistent_hypervisor_id = str(uuid.uuid4())
+
+ self.assertRaises(
+ exceptions.NotFound,
+ self.client.get_hypervisor_uptime,
+ nonexistent_hypervisor_id)
+
+ @attr(type=['negative', 'gate'])
+ def test_get_hypervisor_uptime_with_non_admin_user(self):
+ hypers = self._list_hypervisors()
+ self.assertTrue(len(hypers) > 0)
+
+ self.assertRaises(
+ exceptions.Unauthorized,
+ self.non_adm_client.get_hypervisor_uptime,
+ hypers[0]['id'])
+
+ @attr(type=['negative', 'gate'])
+ def test_get_hypervisor_list_with_non_admin_user(self):
+ # List of hypervisor and available services with non admin user
+ self.assertRaises(
+ exceptions.Unauthorized,
+ self.non_adm_client.get_hypervisor_list)
+
+ @attr(type=['negative', 'gate'])
+ def test_get_hypervisor_list_details_with_non_admin_user(self):
+ # List of hypervisor details and available services with non admin user
+ self.assertRaises(
+ exceptions.Unauthorized,
+ self.non_adm_client.get_hypervisor_list_details)
+
+ @attr(type=['negative', 'gate'])
+ def test_search_nonexistent_hypervisor(self):
+ nonexistent_hypervisor_name = data_utils.rand_name('test_hypervisor')
+
+ self.assertRaises(
+ exceptions.NotFound,
+ self.client.search_hypervisor,
+ nonexistent_hypervisor_name)
+
+ @attr(type=['negative', 'gate'])
+ def test_search_hypervisor_with_non_admin_user(self):
+ hypers = self._list_hypervisors()
+ self.assertTrue(len(hypers) > 0)
+
+ self.assertRaises(
+ exceptions.Unauthorized,
+ self.non_adm_client.search_hypervisor,
+ hypers[0]['hypervisor_hostname'])
+
+
+class HypervisorAdminNegativeTestXML(HypervisorAdminNegativeTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py
index 757dfc0..6c4d350 100644
--- a/tempest/api/compute/admin/test_quotas.py
+++ b/tempest/api/compute/admin/test_quotas.py
@@ -23,8 +23,9 @@
from tempest.test import skip_because
-class QuotasAdminTestJSON(base.BaseComputeAdminTest):
+class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
_interface = 'json'
+ force_tenant_isolation = True
@classmethod
def setUpClass(cls):
@@ -39,12 +40,8 @@
# NOTE(afazekas): these test cases should always create and use a new
# tenant most of them should be skipped if we can't do that
- if cls.config.compute.allow_tenant_isolation:
- cls.demo_tenant_id = cls.isolated_creds.get_primary_user().get(
- 'tenantId')
- else:
- cls.demo_tenant_id = [tnt['id'] for tnt in tenants if tnt['name']
- == cls.config.identity.tenant_name][0]
+ cls.demo_tenant_id = cls.isolated_creds.get_primary_user().get(
+ 'tenantId')
cls.default_quota_set = set(('injected_file_content_bytes',
'metadata_items', 'injected_files',
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index 97e0e69..ebc661c 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -22,7 +22,7 @@
from tempest.test import skip_because
-class ServersAdminTestJSON(base.BaseComputeAdminTest):
+class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests Servers API using admin privileges
diff --git a/tempest/api/compute/admin/test_services.py b/tempest/api/compute/admin/test_services.py
index 434ea2f..327d8b8 100644
--- a/tempest/api/compute/admin/test_services.py
+++ b/tempest/api/compute/admin/test_services.py
@@ -21,7 +21,7 @@
from tempest.test import attr
-class ServicesAdminTestJSON(base.BaseComputeAdminTest):
+class ServicesAdminTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests Services API. List and Enable/Disable require admin privileges.
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage.py b/tempest/api/compute/admin/test_simple_tenant_usage.py
index ce05899..3178ead 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage.py
@@ -23,7 +23,7 @@
import time
-class TenantUsagesTestJSON(base.BaseComputeAdminTest):
+class TenantUsagesTestJSON(base.BaseV2ComputeAdminTest):
_interface = 'json'
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 885adcf..5679a45 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -19,7 +19,6 @@
from tempest.api import compute
from tempest import clients
-from tempest.common import isolated_creds
from tempest.common.utils.data_utils import parse_image_id
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
@@ -34,6 +33,7 @@
"""Base test case class for all Compute API tests."""
conclusion = compute.generic_setup_package()
+ force_tenant_isolation = False
@classmethod
def setUpClass(cls):
@@ -41,50 +41,22 @@
if not cls.config.service_available.nova:
skip_msg = ("%s skipped as nova is not available" % cls.__name__)
raise cls.skipException(skip_msg)
- cls.isolated_creds = isolated_creds.IsolatedCreds(cls.__name__)
- if cls.config.compute.allow_tenant_isolation:
- creds = cls.isolated_creds.get_primary_creds()
- username, tenant_name, password = creds
- os = clients.Manager(username=username,
- password=password,
- tenant_name=tenant_name,
- interface=cls._interface)
- else:
- os = clients.Manager(interface=cls._interface)
+ os = cls.get_client_manager()
cls.os = os
- cls.servers_client = os.servers_client
- cls.flavors_client = os.flavors_client
- cls.images_client = os.images_client
- cls.extensions_client = os.extensions_client
- cls.floating_ips_client = os.floating_ips_client
- cls.keypairs_client = os.keypairs_client
- cls.security_groups_client = os.security_groups_client
- cls.quotas_client = os.quotas_client
- cls.limits_client = os.limits_client
- cls.volumes_extensions_client = os.volumes_extensions_client
- cls.volumes_client = os.volumes_client
- cls.interfaces_client = os.interfaces_client
- cls.fixed_ips_client = os.fixed_ips_client
- cls.availability_zone_client = os.availability_zone_client
- cls.aggregates_client = os.aggregates_client
- cls.services_client = os.services_client
- cls.hypervisor_client = os.hypervisor_client
cls.build_interval = cls.config.compute.build_interval
cls.build_timeout = cls.config.compute.build_timeout
cls.ssh_user = cls.config.compute.ssh_user
- cls.image_ssh_user = cls.config.compute.image_ssh_user
- cls.image_ssh_password = cls.config.compute.image_ssh_password
cls.image_ref = cls.config.compute.image_ref
cls.image_ref_alt = cls.config.compute.image_ref_alt
cls.flavor_ref = cls.config.compute.flavor_ref
cls.flavor_ref_alt = cls.config.compute.flavor_ref_alt
+ cls.image_ssh_user = cls.config.compute.image_ssh_user
+ cls.image_ssh_password = cls.config.compute.image_ssh_password
cls.servers = []
cls.images = []
- cls.servers_client_v3_auth = os.servers_client_v3_auth
-
@classmethod
def clear_servers(cls):
for server in cls.servers:
@@ -129,7 +101,7 @@
def tearDownClass(cls):
cls.clear_images()
cls.clear_servers()
- cls.isolated_creds.clear_isolated_creds()
+ cls.clear_isolated_creds()
super(BaseComputeTest, cls).tearDownClass()
@classmethod
@@ -162,7 +134,7 @@
@classmethod
def create_image_from_server(cls, server_id, **kwargs):
- """Wrapper utility that returns a test server."""
+ """Wrapper utility that returns an image created from the server."""
name = rand_name(cls.__name__ + "-image")
if 'name' in kwargs:
name = kwargs.pop('name')
@@ -195,12 +167,37 @@
time.sleep(self.build_interval)
-class BaseComputeAdminTest(BaseComputeTest):
- """Base test case class for all Compute Admin API tests."""
+class BaseV2ComputeTest(BaseComputeTest):
@classmethod
def setUpClass(cls):
- super(BaseComputeAdminTest, cls).setUpClass()
+ super(BaseV2ComputeTest, cls).setUpClass()
+ cls.servers_client = cls.os.servers_client
+ cls.flavors_client = cls.os.flavors_client
+ cls.images_client = cls.os.images_client
+ cls.extensions_client = cls.os.extensions_client
+ cls.floating_ips_client = cls.os.floating_ips_client
+ cls.keypairs_client = cls.os.keypairs_client
+ cls.security_groups_client = cls.os.security_groups_client
+ cls.quotas_client = cls.os.quotas_client
+ cls.limits_client = cls.os.limits_client
+ cls.volumes_extensions_client = cls.os.volumes_extensions_client
+ cls.volumes_client = cls.os.volumes_client
+ cls.interfaces_client = cls.os.interfaces_client
+ cls.fixed_ips_client = cls.os.fixed_ips_client
+ cls.availability_zone_client = cls.os.availability_zone_client
+ cls.aggregates_client = cls.os.aggregates_client
+ cls.services_client = cls.os.services_client
+ cls.hypervisor_client = cls.os.hypervisor_client
+ cls.servers_client_v3_auth = cls.os.servers_client_v3_auth
+
+
+class BaseV2ComputeAdminTest(BaseV2ComputeTest):
+ """Base test case class for Compute Admin V2 API tests."""
+
+ @classmethod
+ def setUpClass(cls):
+ super(BaseV2ComputeAdminTest, cls).setUpClass()
admin_username = cls.config.compute_admin.username
admin_password = cls.config.compute_admin.password
admin_tenant = cls.config.compute_admin.tenant_name
@@ -208,7 +205,8 @@
msg = ("Missing Compute Admin API credentials "
"in configuration.")
raise cls.skipException(msg)
- if cls.config.compute.allow_tenant_isolation:
+ if (cls.config.compute.allow_tenant_isolation or
+ cls.force_tenant_isolation is True):
creds = cls.isolated_creds.get_admin_creds()
admin_username, admin_tenant_name, admin_password = creds
cls.os_adm = clients.Manager(username=admin_username,
diff --git a/tempest/api/compute/flavors/test_flavors.py b/tempest/api/compute/flavors/test_flavors.py
index cea13a0..eac98ea 100644
--- a/tempest/api/compute/flavors/test_flavors.py
+++ b/tempest/api/compute/flavors/test_flavors.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class FlavorsTestJSON(base.BaseComputeTest):
+class FlavorsTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index a5a361e..ff7188b 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -23,7 +23,7 @@
from tempest.test import attr
-class FloatingIPsTestJSON(base.BaseComputeTest):
+class FloatingIPsTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
server_id = None
floating_ip = None
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index fb9610a..7fec2d1 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -23,7 +23,7 @@
from tempest.test import attr
-class FloatingIPDetailsTestJSON(base.BaseComputeTest):
+class FloatingIPDetailsTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index 8f19514..df857bf 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -21,7 +21,7 @@
from tempest.test import attr
-class ImagesMetadataTestJSON(base.BaseComputeTest):
+class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/images/test_images.py b/tempest/api/compute/images/test_images.py
index 57f26f8..383ea1d 100644
--- a/tempest/api/compute/images/test_images.py
+++ b/tempest/api/compute/images/test_images.py
@@ -23,7 +23,7 @@
from tempest.test import attr
-class ImagesTestJSON(base.BaseComputeTest):
+class ImagesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index accfc35..bec5ea4 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -30,7 +30,7 @@
LOG = logging.getLogger(__name__)
-class ImagesOneServerTestJSON(base.BaseComputeTest):
+class ImagesOneServerTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
def tearDown(self):
@@ -46,7 +46,8 @@
super(ImagesOneServerTestJSON, self).setUp()
# Check if the server is in a clean state after test
try:
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
+ self.servers_client.wait_for_server_status(self.server_id,
+ 'ACTIVE')
except Exception as exc:
LOG.exception(exc)
# Rebuild server if cannot reach the ACTIVE state
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index 8a8d5bd..8d4e47b 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -25,7 +25,7 @@
LOG = logging.getLogger(__name__)
-class ListImageFiltersTestJSON(base.BaseComputeTest):
+class ListImageFiltersTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/images/test_list_images.py b/tempest/api/compute/images/test_list_images.py
index 0647f86..a6726b6 100644
--- a/tempest/api/compute/images/test_list_images.py
+++ b/tempest/api/compute/images/test_list_images.py
@@ -19,7 +19,7 @@
from tempest.test import attr
-class ListImagesTestJSON(base.BaseComputeTest):
+class ListImagesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 9b2a1de..d059994 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -21,7 +21,7 @@
from tempest.test import attr
-class KeyPairsTestJSON(base.BaseComputeTest):
+class KeyPairsTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/limits/test_absolute_limits.py b/tempest/api/compute/limits/test_absolute_limits.py
index d2430df..2809244 100644
--- a/tempest/api/compute/limits/test_absolute_limits.py
+++ b/tempest/api/compute/limits/test_absolute_limits.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class AbsoluteLimitsTestJSON(base.BaseComputeTest):
+class AbsoluteLimitsTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/security_groups/test_security_group_rules.py b/tempest/api/compute/security_groups/test_security_group_rules.py
index 5faa9a4..9dc164d 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -23,7 +23,7 @@
from tempest.test import skip_because
-class SecurityGroupRulesTestJSON(base.BaseComputeTest):
+class SecurityGroupRulesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 2d9c62d..6e08700 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -25,7 +25,7 @@
from tempest.test import skip_because
-class SecurityGroupsTestJSON(base.BaseComputeTest):
+class SecurityGroupsTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index 9f66a6c..c554dc2 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -19,7 +19,7 @@
import time
-class AttachInterfacesTestJSON(base.BaseComputeTest):
+class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 31ca387..adbc048 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -28,7 +28,7 @@
from tempest.test import attr
-class ServersTestJSON(base.BaseComputeTest):
+class ServersTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
run_ssh = tempest.config.TempestConfig().compute.run_ssh
disk_config = 'AUTO'
diff --git a/tempest/api/compute/servers/test_disk_config.py b/tempest/api/compute/servers/test_disk_config.py
index 9abb86a..76a7117 100644
--- a/tempest/api/compute/servers/test_disk_config.py
+++ b/tempest/api/compute/servers/test_disk_config.py
@@ -22,7 +22,7 @@
from tempest.test import attr
-class ServerDiskConfigTestJSON(base.BaseComputeTest):
+class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
@@ -38,6 +38,7 @@
# A server should be rebuilt using the manual disk config option
resp, server = self.create_server(disk_config='AUTO',
wait_until='ACTIVE')
+ self.addCleanup(self.client.delete_server, server['id'])
# Verify the specified attributes are set correctly
resp, server = self.client.get_server(server['id'])
@@ -54,14 +55,12 @@
resp, server = self.client.get_server(server['id'])
self.assertEqual('MANUAL', server['OS-DCF:diskConfig'])
- # Delete the server
- resp, body = self.client.delete_server(server['id'])
-
@attr(type='gate')
def test_rebuild_server_with_auto_disk_config(self):
# A server should be rebuilt using the auto disk config option
resp, server = self.create_server(disk_config='MANUAL',
wait_until='ACTIVE')
+ self.addCleanup(self.client.delete_server, server['id'])
# Verify the specified attributes are set correctly
resp, server = self.client.get_server(server['id'])
@@ -78,16 +77,13 @@
resp, server = self.client.get_server(server['id'])
self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
- # Delete the server
- resp, body = self.client.delete_server(server['id'])
-
@testtools.skipUnless(compute.RESIZE_AVAILABLE, 'Resize not available.')
@attr(type='gate')
def test_resize_server_from_manual_to_auto(self):
# A server should be resized from manual to auto disk config
resp, server = self.create_server(disk_config='MANUAL',
wait_until='ACTIVE')
-
+ self.addCleanup(self.client.delete_server, server['id'])
# Resize with auto option
self.client.resize(server['id'], self.flavor_ref_alt,
disk_config='AUTO')
@@ -98,15 +94,13 @@
resp, server = self.client.get_server(server['id'])
self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
- # Delete the server
- resp, body = self.client.delete_server(server['id'])
-
@testtools.skipUnless(compute.RESIZE_AVAILABLE, 'Resize not available.')
@attr(type='gate')
def test_resize_server_from_auto_to_manual(self):
# A server should be resized from auto to manual disk config
resp, server = self.create_server(disk_config='AUTO',
wait_until='ACTIVE')
+ self.addCleanup(self.client.delete_server, server['id'])
# Resize with manual option
self.client.resize(server['id'], self.flavor_ref_alt,
@@ -118,8 +112,26 @@
resp, server = self.client.get_server(server['id'])
self.assertEqual('MANUAL', server['OS-DCF:diskConfig'])
- # Delete the server
- resp, body = self.client.delete_server(server['id'])
+ @attr(type='gate')
+ def test_update_server_from_auto_to_manual(self):
+ # A server should be updated from auto to manual disk config
+ resp, server = self.create_server(disk_config='AUTO',
+ wait_until='ACTIVE')
+ self.addCleanup(self.client.delete_server, server['id'])
+
+ # Verify the disk_config attribute is set correctly
+ resp, server = self.client.get_server(server['id'])
+ self.assertEqual('AUTO', server['OS-DCF:diskConfig'])
+
+ # Update the disk_config attribute to manual
+ resp, server = self.client.update_server(server['id'],
+ disk_config='MANUAL')
+ self.assertEqual(200, resp.status)
+ self.client.wait_for_server_status(server['id'], 'ACTIVE')
+
+ # Verify the disk_config attribute is set correctly
+ resp, server = self.client.get_server(server['id'])
+ self.assertEqual('MANUAL', server['OS-DCF:diskConfig'])
class ServerDiskConfigTestXML(ServerDiskConfigTestJSON):
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index f13e51e..61be50a 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class InstanceActionsTestJSON(base.BaseComputeTest):
+class InstanceActionsTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index 8e95671..778b8ec 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -24,7 +24,7 @@
from tempest.test import skip_because
-class ListServerFiltersTestJSON(base.BaseComputeTest):
+class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/servers/test_list_servers_negative.py b/tempest/api/compute/servers/test_list_servers_negative.py
index 9dd2e27..bef45a7 100644
--- a/tempest/api/compute/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/servers/test_list_servers_negative.py
@@ -24,7 +24,7 @@
from tempest.test import attr
-class ListServersNegativeTestJSON(base.BaseComputeTest):
+class ListServersNegativeTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/servers/test_multiple_create.py b/tempest/api/compute/servers/test_multiple_create.py
index 7e4a70b..d582894 100644
--- a/tempest/api/compute/servers/test_multiple_create.py
+++ b/tempest/api/compute/servers/test_multiple_create.py
@@ -21,7 +21,7 @@
from tempest.test import attr
-class MultipleCreateTestJSON(base.BaseComputeTest):
+class MultipleCreateTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
_name = 'multiple-create-test'
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index f073ebc..fc4a5e0 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -30,9 +30,10 @@
from tempest.test import skip_because
-class ServerActionsTestJSON(base.BaseComputeTest):
+class ServerActionsTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
- resize_available = tempest.config.TempestConfig().compute.resize_available
+ resize_available = tempest.config.TempestConfig().\
+ compute_feature_enabled.resize
run_ssh = tempest.config.TempestConfig().compute.run_ssh
def setUp(self):
diff --git a/tempest/api/compute/servers/test_server_addresses.py b/tempest/api/compute/servers/test_server_addresses.py
index b1b9253..a594f6c 100644
--- a/tempest/api/compute/servers/test_server_addresses.py
+++ b/tempest/api/compute/servers/test_server_addresses.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class ServerAddressesTest(base.BaseComputeTest):
+class ServerAddressesTest(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/servers/test_server_metadata.py b/tempest/api/compute/servers/test_server_metadata.py
index 15c3e6b..4e45e4b 100644
--- a/tempest/api/compute/servers/test_server_metadata.py
+++ b/tempest/api/compute/servers/test_server_metadata.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class ServerMetadataTestJSON(base.BaseComputeTest):
+class ServerMetadataTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/servers/test_server_personality.py b/tempest/api/compute/servers/test_server_personality.py
index 2019732..ba5c0df 100644
--- a/tempest/api/compute/servers/test_server_personality.py
+++ b/tempest/api/compute/servers/test_server_personality.py
@@ -22,7 +22,7 @@
from tempest.test import attr
-class ServerPersonalityTestJSON(base.BaseComputeTest):
+class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 3cbae56..f72d36e 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -22,7 +22,7 @@
from tempest.test import attr
-class ServerRescueTestJSON(base.BaseComputeTest):
+class ServerRescueTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
run_ssh = tempest.config.TempestConfig().compute.run_ssh
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index 5ce51c0..5f68201 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class ServersTestJSON(base.BaseComputeTest):
+class ServersTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
@@ -119,6 +119,15 @@
resp, _ = self.client.delete_server(server['id'])
self.assertEqual('204', resp['status'])
+ @attr(type='gate')
+ def test_create_server_with_ipv6_addr_only(self):
+ # Create a server without an IPv4 address(only IPv6 address).
+ resp, server = self.create_server(accessIPv6='2001:2001::3')
+ self.assertEqual('202', resp['status'])
+ self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ resp, server = self.client.get_server(server['id'])
+ self.assertEqual('2001:2001::3', server['accessIPv6'])
+
class ServersTestXML(ServersTestJSON):
_interface = 'xml'
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index d2088fa..0f753a0 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -26,7 +26,7 @@
from tempest.test import attr
-class ServersNegativeTestJSON(base.BaseComputeTest):
+class ServersNegativeTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
def setUp(self):
diff --git a/tempest/api/compute/servers/test_virtual_interfaces.py b/tempest/api/compute/servers/test_virtual_interfaces.py
index 2c7ff32..a00e8ed 100644
--- a/tempest/api/compute/servers/test_virtual_interfaces.py
+++ b/tempest/api/compute/servers/test_virtual_interfaces.py
@@ -25,7 +25,7 @@
from tempest.test import skip_because
-class VirtualInterfacesTestJSON(base.BaseComputeTest):
+class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
CONF = config.TempestConfig()
diff --git a/tempest/api/compute/test_auth_token.py b/tempest/api/compute/test_auth_token.py
index bbe92ef..ffeede8 100644
--- a/tempest/api/compute/test_auth_token.py
+++ b/tempest/api/compute/test_auth_token.py
@@ -19,7 +19,7 @@
import tempest.config as config
-class AuthTokenTestJSON(base.BaseComputeTest):
+class AuthTokenTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 0a8595f..a7d9310 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -27,7 +27,7 @@
LOG = logging.getLogger(__name__)
-class AuthorizationTestJSON(base.BaseComputeTest):
+class AuthorizationTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py
index c1b7aa5..8f1e446 100644
--- a/tempest/api/compute/test_extensions.py
+++ b/tempest/api/compute/test_extensions.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class ExtensionsTestJSON(base.BaseComputeTest):
+class ExtensionsTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@attr(type='gate')
diff --git a/tempest/api/compute/test_live_block_migration.py b/tempest/api/compute/test_live_block_migration.py
index 65daee0..7f68ab5 100644
--- a/tempest/api/compute/test_live_block_migration.py
+++ b/tempest/api/compute/test_live_block_migration.py
@@ -26,7 +26,7 @@
from tempest.test import attr
-class LiveBlockMigrationTestJSON(base.BaseComputeAdminTest):
+class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
_host_key = 'OS-EXT-SRV-ATTR:host'
_interface = 'json'
@@ -59,7 +59,8 @@
def _migrate_server_to(self, server_id, dest_host):
_resp, body = self.admin_servers_client.live_migrate_server(
server_id, dest_host,
- self.config.compute.use_block_migration_for_live_migration)
+ self.config.compute_feature_enabled.
+ block_migration_for_live_migration)
return body
def _get_host_other_than(self, host):
@@ -97,7 +98,7 @@
self.volumes_client.wait_for_volume_status(volume_id, 'available')
self.volumes_client.delete_volume(volume_id)
- @testtools.skipIf(not CONF.compute.live_migration_available,
+ @testtools.skipIf(not CONF.compute_feature_enabled.live_migration,
'Live migration not available')
@attr(type='gate')
def test_live_block_migration(self):
@@ -112,7 +113,7 @@
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
self.assertEqual(target_host, self._get_host_for_server(server_id))
- @testtools.skipIf(not CONF.compute.live_migration_available,
+ @testtools.skipIf(not CONF.compute_feature_enabled.live_migration,
'Live migration not available')
@attr(type='gate')
def test_invalid_host_for_migration(self):
@@ -124,10 +125,12 @@
server_id, target_host)
self.assertEqual('ACTIVE', self._get_server_status(server_id))
- @testtools.skipIf(not CONF.compute.live_migration_available or
- not CONF.compute.use_block_migration_for_live_migration,
+ @testtools.skipIf(not CONF.compute_feature_enabled.live_migration or not
+ CONF.compute_feature_enabled.
+ block_migration_for_live_migration,
'Block Live migration not available')
- @testtools.skipIf(not CONF.compute.block_migrate_supports_cinder_iscsi,
+ @testtools.skipIf(not CONF.compute_feature_enabled.
+ block_migrate_cinder_iscsi,
'Block Live migration not configured for iSCSI')
@attr(type='gate')
def test_iscsi_volume(self):
diff --git a/tempest/api/compute/test_quotas.py b/tempest/api/compute/test_quotas.py
index 6453cf4..475d055 100644
--- a/tempest/api/compute/test_quotas.py
+++ b/tempest/api/compute/test_quotas.py
@@ -19,7 +19,7 @@
from tempest.test import attr
-class QuotasTestJSON(base.BaseComputeTest):
+class QuotasTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
@@ -58,6 +58,16 @@
sorted(quota_set.keys()))
self.assertEqual(quota_set['id'], self.tenant_id)
+ @attr(type='smoke')
+ def test_compare_tenant_quotas_with_default_quotas(self):
+ # Tenants are created with the default quota values
+ resp, defualt_quota_set = \
+ self.client.get_default_quota_set(self.tenant_id)
+ self.assertEqual(200, resp.status)
+ resp, tenant_quota_set = self.client.get_quota_set(self.tenant_id)
+ self.assertEqual(200, resp.status)
+ self.assertEqual(defualt_quota_set, tenant_quota_set)
+
class QuotasTestXML(QuotasTestJSON):
_interface = 'xml'
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index ee1ad9e..a993077 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -23,7 +23,7 @@
from tempest.test import attr
-class AttachVolumeTestJSON(base.BaseComputeTest):
+class AttachVolumeTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
run_ssh = tempest.config.TempestConfig().compute.run_ssh
diff --git a/tempest/api/compute/volumes/test_volumes_get.py b/tempest/api/compute/volumes/test_volumes_get.py
index fba8347..192d81e 100644
--- a/tempest/api/compute/volumes/test_volumes_get.py
+++ b/tempest/api/compute/volumes/test_volumes_get.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class VolumesGetTestJSON(base.BaseComputeTest):
+class VolumesGetTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
diff --git a/tempest/api/compute/volumes/test_volumes_list.py b/tempest/api/compute/volumes/test_volumes_list.py
index 956abdf..b4e00f9 100644
--- a/tempest/api/compute/volumes/test_volumes_list.py
+++ b/tempest/api/compute/volumes/test_volumes_list.py
@@ -20,7 +20,7 @@
from tempest.test import attr
-class VolumesTestJSON(base.BaseComputeTest):
+class VolumesTestJSON(base.BaseV2ComputeTest):
"""
This test creates a number of 1G volumes. To run successfully,
diff --git a/tempest/api/compute/volumes/test_volumes_negative.py b/tempest/api/compute/volumes/test_volumes_negative.py
index 90e6946..785902e 100644
--- a/tempest/api/compute/volumes/test_volumes_negative.py
+++ b/tempest/api/compute/volumes/test_volumes_negative.py
@@ -23,7 +23,7 @@
from tempest.test import attr
-class VolumesNegativeTest(base.BaseComputeTest):
+class VolumesNegativeTest(base.BaseV2ComputeTest):
_interface = 'json'
@classmethod
diff --git a/tempest/api/identity/admin/test_tokens.py b/tempest/api/identity/admin/test_tokens.py
new file mode 100644
index 0000000..334a5aa
--- /dev/null
+++ b/tempest/api/identity/admin/test_tokens.py
@@ -0,0 +1,58 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 Huawei Technologies Co.,LTD.
+# 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 json
+
+from tempest.api.identity import base
+from tempest.common.utils import data_utils
+from tempest.test import attr
+
+
+class TokensTestJSON(base.BaseIdentityAdminTest):
+ _interface = 'json'
+
+ @attr(type='gate')
+ def test_create_delete_token(self):
+ # get a token by username and password
+ user_name = data_utils.rand_name(name='user-')
+ user_password = data_utils.rand_name(name='pass-')
+ # first:create a tenant
+ tenant_name = data_utils.rand_name(name='tenant-')
+ resp, tenant = self.client.create_tenant(tenant_name)
+ self.assertEqual(200, resp.status)
+ self.data.tenants.append(tenant)
+ # second:create a user
+ resp, user = self.client.create_user(user_name, user_password,
+ tenant['id'], '')
+ self.assertEqual(200, resp.status)
+ self.data.users.append(user)
+ # then get a token for the user
+ rsp, body = self.token_client.auth(user_name,
+ user_password,
+ tenant['name'])
+ access_data = json.loads(body)['access']
+ self.assertEqual(rsp['status'], '200')
+ self.assertEqual(access_data['token']['tenant']['name'],
+ tenant['name'])
+ # then delete the token
+ token_id = access_data['token']['id']
+ resp, body = self.client.delete_token(token_id)
+ self.assertEqual(resp['status'], '204')
+
+
+class TokensTestXML(TokensTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 4f54a15..ab0cb00 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -74,17 +74,6 @@
cls.created_images.append(image['id'])
return resp, image
- @classmethod
- def _check_version(cls, version):
- __, versions = cls.client.get_versions()
- if version == 'v2.0':
- if 'v2.0' in versions:
- return True
- elif version == 'v1.0':
- if 'v1.1' in versions or 'v1.0' in versions:
- return True
- return False
-
class BaseV1ImageTest(BaseImageTest):
@@ -92,7 +81,7 @@
def setUpClass(cls):
super(BaseV1ImageTest, cls).setUpClass()
cls.client = cls.os.image_client
- if not cls._check_version('v1.0'):
+ if not cls.config.image_feature_enabled.api_v1:
msg = "Glance API v1 not supported"
raise cls.skipException(msg)
@@ -103,6 +92,6 @@
def setUpClass(cls):
super(BaseV2ImageTest, cls).setUpClass()
cls.client = cls.os.image_client_v2
- if not cls._check_version('v2.0'):
+ if not cls.config.image_feature_enabled.api_v2:
msg = "Glance API v2 not supported"
raise cls.skipException(msg)
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index eb3535f..ee6d656 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -20,6 +20,7 @@
import random
from tempest.api.image import base
+from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
@@ -42,29 +43,46 @@
'test', 'bare', 'wrong')
@attr(type='gate')
- def test_register_then_upload(self):
- # Register, then upload an image
- resp, body = self.create_image(name='New Name',
+ def test_register_upload_get_image_file(self):
+
+ """
+ Here we test these functionalities - Register image,
+ upload the image file, get image and get image file api's
+ """
+
+ image_name = data_utils.rand_name('image')
+ resp, body = self.create_image(name=image_name,
container_format='bare',
disk_format='raw',
visibility='public')
self.assertIn('id', body)
image_id = body.get('id')
self.assertIn('name', body)
- self.assertEqual('New Name', body.get('name'))
+ self.assertEqual(image_name, body['name'])
self.assertIn('visibility', body)
- self.assertTrue(body.get('visibility') == 'public')
+ self.assertEqual('public', body['visibility'])
self.assertIn('status', body)
- self.assertEqual('queued', body.get('status'))
+ self.assertEqual('queued', body['status'])
# Now try uploading an image file
- image_file = StringIO.StringIO(('*' * 1024))
+ file_content = '*' * 1024
+ image_file = StringIO.StringIO(file_content)
resp, body = self.client.store_image(image_id, image_file)
self.assertEqual(resp.status, 204)
- resp, body = self.client.get_image_metadata(image_id)
+
+ # Now try to get image details
+ resp, body = self.client.get_image(image_id)
+ self.assertEqual(200, resp.status)
+ self.assertEqual(image_id, body['id'])
+ self.assertEqual(image_name, body['name'])
self.assertIn('size', body)
self.assertEqual(1024, body.get('size'))
+ # Now try get image file
+ resp, body = self.client.get_image_file(image_id)
+ self.assertEqual(200, resp.status)
+ self.assertEqual(file_content, body)
+
class ListImagesTest(base.BaseV2ImageTest):
@@ -107,6 +125,6 @@
self.assertIn(image, image_list)
@attr(type=['negative', 'gate'])
- def test_get_image_meta_by_null_id(self):
+ def test_get_image_by_null_id(self):
self.assertRaises(exceptions.NotFound,
- self.client.get_image_metadata, '')
+ self.client.get_image, '')
diff --git a/tempest/api/image/v2/test_images_tags.py b/tempest/api/image/v2/test_images_tags.py
new file mode 100644
index 0000000..e37e462
--- /dev/null
+++ b/tempest/api/image/v2/test_images_tags.py
@@ -0,0 +1,45 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# 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.image import base
+from tempest.common.utils import data_utils
+from tempest.test import attr
+
+
+class ImagesTagsTest(base.BaseV2ImageTest):
+
+ @attr(type='gate')
+ def test_update_delete_tags_for_image(self):
+ resp, body = self.create_image(container_format='bare',
+ disk_format='raw',
+ visibility='public')
+ image_id = body['id']
+ tag = data_utils.rand_name('tag-')
+ self.addCleanup(self.client.delete_image, image_id)
+
+ # Creating image tag and verify it.
+ resp, body = self.client.add_image_tag(image_id, tag)
+ self.assertEqual(resp.status, 204)
+ resp, body = self.client.get_image(image_id)
+ self.assertEqual(resp.status, 200)
+ self.assertIn(tag, body['tags'])
+
+ # Deleting image tag and verify it.
+ resp = self.client.delete_image_tag(image_id, tag)
+ self.assertEqual(resp.status, 204)
+ resp, body = self.client.get_image(image_id)
+ self.assertEqual(resp.status, 200)
+ self.assertNotIn(tag, body['tags'])
diff --git a/tempest/api/image/v2/test_images_tags_negative.py b/tempest/api/image/v2/test_images_tags_negative.py
new file mode 100644
index 0000000..e0d84de
--- /dev/null
+++ b/tempest/api/image/v2/test_images_tags_negative.py
@@ -0,0 +1,46 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# 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 uuid
+
+from tempest.api.image import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest.test import attr
+
+
+class ImagesTagsNegativeTest(base.BaseV2ImageTest):
+
+ @attr(type=['negative', 'gate'])
+ def test_update_tags_for_non_existing_image(self):
+ # Update tag with non existing image.
+ tag = data_utils.rand_name('tag-')
+ non_exist_image = str(uuid.uuid4())
+ self.assertRaises(exceptions.NotFound, self.client.add_image_tag,
+ non_exist_image, tag)
+
+ @attr(type=['negative', 'gate'])
+ def test_delete_non_existing_tag(self):
+ # Delete non existing tag.
+ resp, body = self.create_image(container_format='bare',
+ disk_format='raw',
+ is_public=True,
+ )
+ image_id = body['id']
+ tag = data_utils.rand_name('non-exist-tag-')
+ self.addCleanup(self.client.delete_image, image_id)
+ self.assertRaises(exceptions.NotFound, self.client.delete_image_tag,
+ image_id, tag)
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 8eefb1a..ed915c1 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -68,75 +68,39 @@
@classmethod
def tearDownClass(cls):
- has_exception = False
+ # Clean up vpn services
for vpnservice in cls.vpnservices:
- try:
- cls.client.delete_vpn_service(vpnservice['id'])
- except Exception as exc:
- LOG.exception(exc)
- has_exception = True
-
+ cls.client.delete_vpn_service(vpnservice['id'])
+ # Clean up routers
for router in cls.routers:
- try:
- resp, body = cls.client.list_router_interfaces(router['id'])
- interfaces = body['ports']
- for i in interfaces:
- cls.client.remove_router_interface_with_subnet_id(
- router['id'], i['fixed_ips'][0]['subnet_id'])
- except Exception as exc:
- LOG.exception(exc)
- has_exception = True
- try:
- cls.client.delete_router(router['id'])
- except Exception as exc:
- LOG.exception(exc)
- has_exception = True
-
+ resp, body = cls.client.list_router_interfaces(router['id'])
+ interfaces = body['ports']
+ for i in interfaces:
+ cls.client.remove_router_interface_with_subnet_id(
+ router['id'], i['fixed_ips'][0]['subnet_id'])
+ cls.client.delete_router(router['id'])
+ # Clean up health monitors
for health_monitor in cls.health_monitors:
- try:
- cls.client.delete_health_monitor(health_monitor['id'])
- except Exception as exc:
- LOG.exception(exc)
- has_exception = True
+ cls.client.delete_health_monitor(health_monitor['id'])
+ # Clean up members
for member in cls.members:
- try:
- cls.client.delete_member(member['id'])
- except Exception as exc:
- LOG.exception(exc)
- has_exception = True
+ cls.client.delete_member(member['id'])
+ # Clean up vips
for vip in cls.vips:
- try:
- cls.client.delete_vip(vip['id'])
- except Exception as exc:
- LOG.exception(exc)
- has_exception = True
+ cls.client.delete_vip(vip['id'])
+ # Clean up pools
for pool in cls.pools:
- try:
- cls.client.delete_pool(pool['id'])
- except Exception as exc:
- LOG.exception(exc)
- has_exception = True
+ cls.client.delete_pool(pool['id'])
+ # Clean up ports
for port in cls.ports:
- try:
- cls.client.delete_port(port['id'])
- except Exception as exc:
- LOG.exception(exc)
- has_exception = True
+ cls.client.delete_port(port['id'])
+ # Clean up subnets
for subnet in cls.subnets:
- try:
- cls.client.delete_subnet(subnet['id'])
- except Exception as exc:
- LOG.exception(exc)
- has_exception = True
+ cls.client.delete_subnet(subnet['id'])
+ # Clean up networks
for network in cls.networks:
- try:
- cls.client.delete_network(network['id'])
- except Exception as exc:
- LOG.exception(exc)
- has_exception = True
+ cls.client.delete_network(network['id'])
super(BaseNetworkTest, cls).tearDownClass()
- if has_exception:
- raise exceptions.TearDownException()
@classmethod
def create_network(cls, network_name=None):
diff --git a/tempest/api/network/common.py b/tempest/api/network/common.py
index c3fb821..43e7f68 100644
--- a/tempest/api/network/common.py
+++ b/tempest/api/network/common.py
@@ -56,7 +56,9 @@
class DeletableSubnet(DeletableResource):
- _router_ids = set()
+ def __init__(self, *args, **kwargs):
+ super(DeletableSubnet, self).__init__(*args, **kwargs)
+ self._router_ids = set()
def add_to_router(self, router_id):
self._router_ids.add(router_id)
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index d321e23..daeb89f 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -16,6 +16,7 @@
# under the License.
from tempest.api.network import test_security_groups as base
+from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
import uuid
@@ -37,6 +38,54 @@
self.client.show_security_group_rule,
non_exist_id)
+ @attr(type=['negative', 'smoke'])
+ def test_delete_non_existent_security_group(self):
+ non_exist_id = 'fictional-id'
+ self.assertRaises(exceptions.NotFound,
+ self.client.delete_security_group,
+ non_exist_id
+ )
+
+ @attr(type=['negative', 'smoke'])
+ def test_create_security_group_rule_with_bad_protocol(self):
+ # Create a security group
+ name = data_utils.rand_name('secgroup-')
+ resp, group_create_body = self.client.create_security_group(name)
+ self.assertEqual('201', resp['status'])
+ self.addCleanup(self._delete_security_group,
+ group_create_body['security_group']['id'])
+ self.assertEqual(group_create_body['security_group']['name'], name)
+
+ #Create rule with bad protocol name
+ pname = 'bad_protocol_name'
+ self.assertRaises(exceptions.BadRequest,
+ self.client.create_security_group_rule,
+ group_create_body['security_group']['id'],
+ protocol=pname)
+
+ @attr(type=['negative', 'smoke'])
+ def test_create_security_group_rule_with_invalid_ports(self):
+ # Create a security group
+ name = data_utils.rand_name('secgroup-')
+ resp, group_create_body = self.client.create_security_group(name)
+ self.assertEqual('201', resp['status'])
+ self.addCleanup(self._delete_security_group,
+ group_create_body['security_group']['id'])
+ self.assertEqual(group_create_body['security_group']['name'], name)
+
+ #Create rule with invalid ports
+ states = [(-16, 80, 'Invalid value for port -16'),
+ (80, 79, 'port_range_min must be <= port_range_max'),
+ (80, 65536, 'Invalid value for port 65536')]
+ for pmin, pmax, msg in states:
+ ex = self.assertRaises(exceptions.BadRequest,
+ self.client.create_security_group_rule,
+ group_create_body['security_group']['id'],
+ protocol='tcp',
+ port_range_min=pmin,
+ port_range_max=pmax)
+ self.assertIn(msg, str(ex))
+
class NegativeSecGroupTestXML(NegativeSecGroupTest):
_interface = 'xml'
diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py
index 65fe1ac..a90d3f4 100644
--- a/tempest/api/object_storage/test_account_quotas.py
+++ b/tempest/api/object_storage/test_account_quotas.py
@@ -20,14 +20,14 @@
from tempest import clients
from tempest.common.utils.data_utils import arbitrary_string
from tempest.common.utils.data_utils import rand_name
-import tempest.config
+from tempest import config
from tempest import exceptions
from tempest.test import attr
class AccountQuotasTest(base.BaseObjectTest):
accounts_quotas_available = \
- tempest.config.TempestConfig().object_storage.accounts_quotas_available
+ config.TempestConfig().object_storage_feature_enabled.accounts_quotas
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/object_storage/test_account_services.py b/tempest/api/object_storage/test_account_services.py
index 1a3f775..90b0914 100644
--- a/tempest/api/object_storage/test_account_services.py
+++ b/tempest/api/object_storage/test_account_services.py
@@ -101,7 +101,7 @@
'limit': limit}
resp, container_list = \
self.account_client.list_account_containers(params=params)
- self.assertLessEqual(len(container_list), limit)
+ self.assertTrue(len(container_list) <= limit, str(container_list))
@attr(type='smoke')
def test_list_account_metadata(self):
diff --git a/tempest/api/object_storage/test_container_quotas.py b/tempest/api/object_storage/test_container_quotas.py
index 31fe711..2e0d76a 100644
--- a/tempest/api/object_storage/test_container_quotas.py
+++ b/tempest/api/object_storage/test_container_quotas.py
@@ -33,7 +33,7 @@
class ContainerQuotasTest(base.BaseObjectTest):
"""Attemps to test the perfect behavior of quotas in a container."""
container_quotas_available = \
- config.TempestConfig().object_storage.container_quotas_available
+ config.TempestConfig().object_storage_feature_enabled.container_quotas
def setUp(self):
"""Creates and sets a container with quotas.
diff --git a/tempest/api/object_storage/test_healthcheck.py b/tempest/api/object_storage/test_healthcheck.py
new file mode 100644
index 0000000..798ea4f
--- /dev/null
+++ b/tempest/api/object_storage/test_healthcheck.py
@@ -0,0 +1,65 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
+#
+# Author: Joe H. Rahme <joe.hakim.rahme@enovance.com>
+#
+# 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.object_storage import base
+from tempest import clients
+from tempest.test import attr
+from tempest.test import HTTP_SUCCESS
+
+
+class HealthcheckTest(base.BaseObjectTest):
+
+ @classmethod
+ def setUpClass(cls):
+ super(HealthcheckTest, cls).setUpClass()
+
+ # creates a test user. The test user will set its base_url to the Swift
+ # endpoint and test the healthcheck feature.
+ cls.data.setup_test_user()
+
+ cls.os_test_user = clients.Manager(
+ cls.data.test_user,
+ cls.data.test_password,
+ cls.data.test_tenant)
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.data.teardown_all()
+ super(HealthcheckTest, cls).tearDownClass()
+
+ def setUp(self):
+ super(HealthcheckTest, self).setUp()
+ client = self.os_test_user.account_client
+ client._set_auth()
+
+ # Turning http://.../v1/foobar into http://.../
+ client.base_url = "/".join(client.base_url.split("/")[:-2])
+
+ def tearDown(self):
+ # clear the base_url for subsequent requests
+ self.os_test_user.account_client.base_url = None
+ super(HealthcheckTest, self).tearDown()
+
+ @attr('gate')
+ def test_get_healthcheck(self):
+
+ resp, _ = self.os_test_user.account_client.get("healthcheck", {})
+
+ # The status is expected to be 200
+ self.assertIn(int(resp['status']), HTTP_SUCCESS)
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 797aa71..eada639 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -28,7 +28,7 @@
@classmethod
def setUpClass(cls):
super(VolumeMultiBackendTest, cls).setUpClass()
- if not cls.config.volume.multi_backend_enabled:
+ if not cls.config.volume_feature_enabled.multi_backend:
raise cls.skipException("Cinder multi-backend feature disabled")
cls.backend1_name = cls.config.volume.backend1_name
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 98694c5..cdf8638 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -18,7 +18,6 @@
import time
from tempest import clients
-from tempest.common import isolated_creds
from tempest.openstack.common import log as logging
import tempest.test
@@ -32,21 +31,12 @@
@classmethod
def setUpClass(cls):
super(BaseVolumeTest, cls).setUpClass()
- cls.isolated_creds = isolated_creds.IsolatedCreds(cls.__name__)
if not cls.config.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
- if cls.config.compute.allow_tenant_isolation:
- creds = cls.isolated_creds.get_primary_creds()
- username, tenant_name, password = creds
- os = clients.Manager(username=username,
- password=password,
- tenant_name=tenant_name,
- interface=cls._interface)
- else:
- os = clients.Manager(interface=cls._interface)
+ os = cls.get_client_manager()
cls.os = os
cls.volumes_client = os.volumes_client
@@ -69,7 +59,7 @@
def tearDownClass(cls):
cls.clear_snapshots()
cls.clear_volumes()
- cls.isolated_creds.clear_isolated_creds()
+ cls.clear_isolated_creds()
super(BaseVolumeTest, cls).tearDownClass()
@classmethod
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 09131e2..f12d4bb 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -16,7 +16,7 @@
# under the License.
from tempest.api.volume.base import BaseVolumeTest
-from tempest.common.utils.data_utils import rand_name
+from tempest.common.utils import data_utils
from tempest.test import attr
from tempest.test import services
from tempest.test import stresstest
@@ -32,8 +32,8 @@
cls.image_client = cls.os.image_client
# Create a test shared instance and volume for attach/detach tests
- srv_name = rand_name(cls.__name__ + '-Instance-')
- vol_name = rand_name(cls.__name__ + '-Volume-')
+ srv_name = data_utils.rand_name(cls.__name__ + '-Instance-')
+ vol_name = data_utils.rand_name(cls.__name__ + '-Volume-')
resp, cls.server = cls.servers_client.create_server(srv_name,
cls.image_ref,
cls.flavor_ref)
@@ -102,7 +102,7 @@
# it is shared with the other tests. After it is uploaded in Glance,
# there is no way to delete it from Cinder, so we delete it from Glance
# using the Glance image_client and from Cinder via tearDownClass.
- image_name = rand_name('Image-')
+ image_name = data_utils.rand_name('Image-')
resp, body = self.client.upload_volume(self.volume['id'],
image_name,
self.config.volume.disk_format)
@@ -112,6 +112,17 @@
self.image_client.wait_for_image_status(image_id, 'active')
self.client.wait_for_volume_status(self.volume['id'], 'available')
+ @attr(type='gate')
+ def test_volume_extend(self):
+ # Extend Volume Test.
+ extend_size = int(self.volume['size']) + 1
+ resp, body = self.client.extend_volume(self.volume['id'], extend_size)
+ self.assertEqual(202, resp.status)
+ self.client.wait_for_volume_status(self.volume['id'], 'available')
+ resp, volume = self.client.get_volume(self.volume['id'])
+ self.assertEqual(200, resp.status)
+ self.assertEqual(int(volume['size']), extend_size)
+
class VolumesActionsTestXML(VolumesActionsTest):
_interface = "xml"
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 3e2b6ad..9bab9a0 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -85,6 +85,33 @@
size='-1', display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
+ def test_create_volume_with_nonexistant_volume_type(self):
+ # Should not be able to create volume with non-existant volume type
+ v_name = rand_name('Volume-')
+ metadata = {'Type': 'work'}
+ self.assertRaises(exceptions.NotFound, self.client.create_volume,
+ size='1', volume_type=str(uuid.uuid4()),
+ display_name=v_name, metadata=metadata)
+
+ @attr(type=['negative', 'gate'])
+ def test_create_volume_with_nonexistant_snapshot_id(self):
+ # Should not be able to create volume with non-existant snapshot
+ v_name = rand_name('Volume-')
+ metadata = {'Type': 'work'}
+ self.assertRaises(exceptions.NotFound, self.client.create_volume,
+ size='1', snapshot_id=str(uuid.uuid4()),
+ display_name=v_name, metadata=metadata)
+
+ @attr(type=['negative', 'gate'])
+ def test_create_volume_with_nonexistant_source_volid(self):
+ # Should not be able to create volume with non-existant source volume
+ v_name = rand_name('Volume-')
+ metadata = {'Type': 'work'}
+ self.assertRaises(exceptions.NotFound, self.client.create_volume,
+ size='1', source_volid=str(uuid.uuid4()),
+ display_name=v_name, metadata=metadata)
+
+ @attr(type=['negative', 'gate'])
def test_update_volume_with_nonexistant_volume_id(self):
v_name = rand_name('Volume-')
metadata = {'Type': 'work'}
@@ -150,6 +177,41 @@
self.client.detach_volume,
'xxx')
+ @attr(type=['negative', 'gate'])
+ def test_volume_extend_with_size_smaller_than_original_size(self):
+ # Extend volume with smaller size than original size.
+ extend_size = 0
+ self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
+ self.volume['id'], extend_size)
+
+ @attr(type=['negative', 'gate'])
+ def test_volume_extend_with_non_number_size(self):
+ # Extend volume when size is non number.
+ extend_size = 'abc'
+ self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
+ self.volume['id'], extend_size)
+
+ @attr(type=['negative', 'gate'])
+ def test_volume_extend_with_None_size(self):
+ # Extend volume with None size.
+ extend_size = None
+ self.assertRaises(exceptions.BadRequest, self.client.extend_volume,
+ self.volume['id'], extend_size)
+
+ @attr(type=['negative', 'gate'])
+ def test_volume_extend_with_nonexistent_volume_id(self):
+ # Extend volume size when volume is nonexistent.
+ extend_size = int(self.volume['size']) + 1
+ self.assertRaises(exceptions.NotFound, self.client.extend_volume,
+ str(uuid.uuid4()), extend_size)
+
+ @attr(type=['negative', 'gate'])
+ def test_volume_extend_without_passing_volume_id(self):
+ # Extend volume size when passing volume id is None.
+ extend_size = int(self.volume['size']) + 1
+ self.assertRaises(exceptions.NotFound, self.client.extend_volume,
+ None, extend_size)
+
class VolumesNegativeTestXML(VolumesNegativeTest):
_interface = 'xml'
diff --git a/tempest/api/volume/test_volumes_snapshots_negative.py b/tempest/api/volume/test_volumes_snapshots_negative.py
new file mode 100644
index 0000000..04a4774
--- /dev/null
+++ b/tempest/api/volume/test_volumes_snapshots_negative.py
@@ -0,0 +1,44 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# 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 uuid
+
+from tempest.api.volume import base
+from tempest.common.utils import data_utils
+from tempest import exceptions
+from tempest.test import attr
+
+
+class VolumesSnapshotNegativeTest(base.BaseVolumeTest):
+ _interface = "json"
+
+ @attr(type=['negative', 'gate'])
+ def test_create_snapshot_with_nonexistent_volume_id(self):
+ # Create a snapshot with nonexistent volume id
+ s_name = data_utils.rand_name('snap')
+ self.assertRaises(exceptions.NotFound,
+ self.snapshots_client.create_snapshot,
+ str(uuid.uuid4()), display_name=s_name)
+
+ @attr(type=['negative', 'gate'])
+ def test_create_snapshot_without_passing_volume_id(self):
+ # Create a snapshot without passing volume id
+ s_name = data_utils.rand_name('snap')
+ self.assertRaises(exceptions.NotFound,
+ self.snapshots_client.create_snapshot,
+ None, display_name=s_name)
+
+
+class VolumesSnapshotNegativeTestXML(VolumesSnapshotNegativeTest):
+ _interface = "xml"
diff --git a/tempest/cli/__init__.py b/tempest/cli/__init__.py
index b082b1e..bd1b44f 100644
--- a/tempest/cli/__init__.py
+++ b/tempest/cli/__init__.py
@@ -33,7 +33,7 @@
default=True,
help="enable cli tests"),
cfg.StrOpt('cli_dir',
- default='/usr/local/bin/',
+ default='/usr/local/bin',
help="directory where python client binaries are located"),
cfg.IntOpt('timeout',
default=15,
@@ -80,6 +80,12 @@
return self.cmd_with_auth(
'glance', action, flags, params, admin, fail_ok)
+ def ceilometer(self, action, flags='', params='', admin=True,
+ fail_ok=False):
+ """Executes ceilometer command for the given action."""
+ return self.cmd_with_auth(
+ 'ceilometer', action, flags, params, admin, fail_ok)
+
def cinder(self, action, flags='', params='', admin=True, fail_ok=False):
"""Executes cinder command for the given action."""
return self.cmd_with_auth(
diff --git a/tempest/cli/simple_read_only/test_ceilometer.py b/tempest/cli/simple_read_only/test_ceilometer.py
new file mode 100644
index 0000000..7f2864f
--- /dev/null
+++ b/tempest/cli/simple_read_only/test_ceilometer.py
@@ -0,0 +1,51 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from oslo.config import cfg
+
+import tempest.cli
+from tempest.openstack.common import log as logging
+
+CONF = cfg.CONF
+
+LOG = logging.getLogger(__name__)
+
+
+class SimpleReadOnlyCeilometerClientTest(tempest.cli.ClientTestBase):
+ """Basic, read-only tests for Ceilometer CLI client.
+
+ Checks return values and output of read-only commands.
+ These tests do not presume any content, nor do they create
+ their own. They only verify the structure of output if present.
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ if (not CONF.service_available.ceilometer):
+ msg = ("Skiping all Ceilometer cli tests because it is"
+ "not available")
+ raise cls.skipException(msg)
+ super(SimpleReadOnlyCeilometerClientTest, cls).setUpClass()
+
+ def test_ceilometer_meter_list(self):
+ self.ceilometer('meter-list')
+
+ def test_ceilometer_resource_list(self):
+ self.ceilometer('resource-list')
+
+ def test_ceilometermeter_alarm_list(self):
+ self.ceilometer('alarm-list')
diff --git a/tempest/cli/simple_read_only/test_glance.py b/tempest/cli/simple_read_only/test_glance.py
index d02c60b..a5a229c 100644
--- a/tempest/cli/simple_read_only/test_glance.py
+++ b/tempest/cli/simple_read_only/test_glance.py
@@ -18,9 +18,13 @@
import re
import subprocess
+from oslo.config import cfg
+
import tempest.cli
from tempest.openstack.common import log as logging
+CONF = cfg.CONF
+
LOG = logging.getLogger(__name__)
@@ -45,6 +49,14 @@
'ID', 'Name', 'Disk Format', 'Container Format',
'Size', 'Status'])
+ def test_glance_member_list(self):
+ tenant_name = '--tenant-id %s' % self.identity.admin_tenant_name
+ out = self.glance('member-list',
+ params=tenant_name)
+ endpoints = self.parser.listing(out)
+ self.assertTableStruct(endpoints,
+ ['Image ID', 'Member ID', 'Can Share'])
+
def test_glance_help(self):
help_text = self.glance('help')
lines = help_text.split('\n')
@@ -64,3 +76,14 @@
'member-add', 'member-create', 'member-delete',
'member-list'))
self.assertFalse(wanted_commands - commands)
+
+ # Optional arguments:
+
+ def test_glance_version(self):
+ self.glance('', flags='--version')
+
+ def test_glance_debug_list(self):
+ self.glance('image-list', flags='--debug')
+
+ def test_glance_timeout(self):
+ self.glance('image-list', flags='--timeout %d' % CONF.cli.timeout)
diff --git a/tempest/cli/simple_read_only/test_nova.py b/tempest/cli/simple_read_only/test_nova.py
index 94415f0..1aa8f2c 100644
--- a/tempest/cli/simple_read_only/test_nova.py
+++ b/tempest/cli/simple_read_only/test_nova.py
@@ -22,6 +22,7 @@
import tempest.cli
from tempest.openstack.common import log as logging
+import tempest.test
CONF = cfg.CONF
@@ -73,7 +74,7 @@
def test_admin_dns_domains(self):
self.nova('dns-domains')
- @testtools.skip("Test needs parameters, Bug #1157349")
+ @tempest.test.skip_because(bug="1157349")
def test_admin_dns_list(self):
self.nova('dns-list')
@@ -111,7 +112,7 @@
def test_admin_image_list(self):
self.nova('image-list')
- @testtools.skip("Test needs parameters, Bug #1157349")
+ @tempest.test.skip_because(bug="1157349")
def test_admin_interface_list(self):
self.nova('interface-list')
@@ -136,7 +137,7 @@
def test_admin_secgroup_list(self):
self.nova('secgroup-list')
- @testtools.skip("Test needs parameters, Bug #1157349")
+ @tempest.test.skip_because(bug="1157349")
def test_admin_secgroup_list_rules(self):
self.nova('secgroup-list-rules')
diff --git a/tempest/clients.py b/tempest/clients.py
index 63ce1ba..dd104a7 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -116,151 +116,6 @@
LOG = logging.getLogger(__name__)
-IMAGES_CLIENTS = {
- "json": ImagesClientJSON,
- "xml": ImagesClientXML,
-}
-
-NETWORKS_CLIENTS = {
- "json": NetworkClientJSON,
- "xml": NetworkClientXML,
-}
-
-KEYPAIRS_CLIENTS = {
- "json": KeyPairsClientJSON,
- "xml": KeyPairsClientXML,
-}
-
-QUOTAS_CLIENTS = {
- "json": QuotasClientJSON,
- "xml": QuotasClientXML,
-}
-
-SERVERS_CLIENTS = {
- "json": ServersClientJSON,
- "xml": ServersClientXML,
-}
-
-LIMITS_CLIENTS = {
- "json": LimitsClientJSON,
- "xml": LimitsClientXML,
-}
-
-FLAVORS_CLIENTS = {
- "json": FlavorsClientJSON,
- "xml": FlavorsClientXML
-}
-
-EXTENSIONS_CLIENTS = {
- "json": ExtensionsClientJSON,
- "xml": ExtensionsClientXML
-}
-
-VOLUMES_EXTENSIONS_CLIENTS = {
- "json": VolumesExtensionsClientJSON,
- "xml": VolumesExtensionsClientXML,
-}
-
-FLOAT_CLIENTS = {
- "json": FloatingIPsClientJSON,
- "xml": FloatingIPsClientXML,
-}
-
-SNAPSHOTS_CLIENTS = {
- "json": SnapshotsClientJSON,
- "xml": SnapshotsClientXML,
-}
-
-VOLUMES_CLIENTS = {
- "json": VolumesClientJSON,
- "xml": VolumesClientXML,
-}
-
-VOLUME_TYPES_CLIENTS = {
- "json": VolumeTypesClientJSON,
- "xml": VolumeTypesClientXML,
-}
-
-IDENTITY_CLIENT = {
- "json": IdentityClientJSON,
- "xml": IdentityClientXML,
-}
-
-IDENTITY_V3_CLIENT = {
- "json": IdentityV3ClientJSON,
- "xml": IdentityV3ClientXML,
-}
-
-TOKEN_CLIENT = {
- "json": TokenClientJSON,
- "xml": TokenClientXML,
-}
-
-SECURITY_GROUPS_CLIENT = {
- "json": SecurityGroupsClientJSON,
- "xml": SecurityGroupsClientXML,
-}
-
-INTERFACES_CLIENT = {
- "json": InterfacesClientJSON,
- "xml": InterfacesClientXML,
-}
-
-ENDPOINT_CLIENT = {
- "json": EndPointClientJSON,
- "xml": EndPointClientXML,
-}
-
-FIXED_IPS_CLIENT = {
- "json": FixedIPsClientJSON,
- "xml": FixedIPsClientXML
-}
-
-AVAILABILITY_ZONE_CLIENT = {
- "json": AvailabilityZoneClientJSON,
- "xml": AvailabilityZoneClientXML,
-}
-
-SERVICE_CLIENT = {
- "json": ServiceClientJSON,
- "xml": ServiceClientXML,
-}
-
-AGGREGATES_CLIENT = {
- "json": AggregatesClientJSON,
- "xml": AggregatesClientXML,
-}
-
-SERVICES_CLIENT = {
- "json": ServicesClientJSON,
- "xml": ServicesClientXML,
-}
-
-TENANT_USAGES_CLIENT = {
- "json": TenantUsagesClientJSON,
- "xml": TenantUsagesClientXML,
-}
-
-POLICY_CLIENT = {
- "json": PolicyClientJSON,
- "xml": PolicyClientXML,
-}
-
-HYPERVISOR_CLIENT = {
- "json": HypervisorClientJSON,
- "xml": HypervisorClientXML,
-}
-
-V3_TOKEN_CLIENT = {
- "json": V3TokenClientJSON,
- "xml": V3TokenClientXML,
-}
-
-CREDENTIALS_CLIENT = {
- "json": CredentialsClientJSON,
- "xml": CredentialsClientXML,
-}
-
class Manager(object):
@@ -308,55 +163,88 @@
else:
client_args_v3_auth = None
- try:
- self.servers_client = SERVERS_CLIENTS[interface](*client_args)
- self.network_client = NETWORKS_CLIENTS[interface](*client_args)
- self.limits_client = LIMITS_CLIENTS[interface](*client_args)
- if self.config.service_available.glance:
- self.images_client = IMAGES_CLIENTS[interface](*client_args)
- self.keypairs_client = KEYPAIRS_CLIENTS[interface](*client_args)
- self.quotas_client = QUOTAS_CLIENTS[interface](*client_args)
- self.flavors_client = FLAVORS_CLIENTS[interface](*client_args)
- ext_cli = EXTENSIONS_CLIENTS[interface](*client_args)
- self.extensions_client = ext_cli
- vol_ext_cli = VOLUMES_EXTENSIONS_CLIENTS[interface](*client_args)
- self.volumes_extensions_client = vol_ext_cli
- self.floating_ips_client = FLOAT_CLIENTS[interface](*client_args)
- self.snapshots_client = SNAPSHOTS_CLIENTS[interface](*client_args)
- self.volumes_client = VOLUMES_CLIENTS[interface](*client_args)
- self.volume_types_client = \
- VOLUME_TYPES_CLIENTS[interface](*client_args)
- self.identity_client = IDENTITY_CLIENT[interface](*client_args)
- self.identity_v3_client = \
- IDENTITY_V3_CLIENT[interface](*client_args)
- self.token_client = TOKEN_CLIENT[interface](self.config)
- self.security_groups_client = \
- SECURITY_GROUPS_CLIENT[interface](*client_args)
- self.interfaces_client = INTERFACES_CLIENT[interface](*client_args)
- self.endpoints_client = ENDPOINT_CLIENT[interface](*client_args)
- self.fixed_ips_client = FIXED_IPS_CLIENT[interface](*client_args)
- self.availability_zone_client = \
- AVAILABILITY_ZONE_CLIENT[interface](*client_args)
- self.service_client = SERVICE_CLIENT[interface](*client_args)
- self.aggregates_client = AGGREGATES_CLIENT[interface](*client_args)
- self.services_client = SERVICES_CLIENT[interface](*client_args)
- self.tenant_usages_client = \
- TENANT_USAGES_CLIENT[interface](*client_args)
- self.policy_client = POLICY_CLIENT[interface](*client_args)
- self.hypervisor_client = HYPERVISOR_CLIENT[interface](*client_args)
- self.token_v3_client = V3_TOKEN_CLIENT[interface](*client_args)
- self.credentials_client = \
- CREDENTIALS_CLIENT[interface](*client_args)
+ self.servers_client_v3_auth = None
+
+ if interface == 'xml':
+ self.servers_client = ServersClientXML(*client_args)
+ self.limits_client = LimitsClientXML(*client_args)
+ self.images_client = ImagesClientXML(*client_args)
+ self.keypairs_client = KeyPairsClientXML(*client_args)
+ self.quotas_client = QuotasClientXML(*client_args)
+ self.flavors_client = FlavorsClientXML(*client_args)
+ self.extensions_client = ExtensionsClientXML(*client_args)
+ self.volumes_extensions_client = VolumesExtensionsClientXML(
+ *client_args)
+ self.floating_ips_client = FloatingIPsClientXML(*client_args)
+ self.snapshots_client = SnapshotsClientXML(*client_args)
+ self.volumes_client = VolumesClientXML(*client_args)
+ self.volume_types_client = VolumeTypesClientXML(*client_args)
+ self.identity_client = IdentityClientXML(*client_args)
+ self.identity_v3_client = IdentityV3ClientXML(*client_args)
+ self.token_client = TokenClientXML(self.config)
+ self.security_groups_client = SecurityGroupsClientXML(
+ *client_args)
+ self.interfaces_client = InterfacesClientXML(*client_args)
+ self.endpoints_client = EndPointClientXML(*client_args)
+ self.fixed_ips_client = FixedIPsClientXML(*client_args)
+ self.availability_zone_client = AvailabilityZoneClientXML(
+ *client_args)
+ self.service_client = ServiceClientXML(*client_args)
+ self.aggregates_client = AggregatesClientXML(*client_args)
+ self.services_client = ServicesClientXML(*client_args)
+ self.tenant_usages_client = TenantUsagesClientXML(*client_args)
+ self.policy_client = PolicyClientXML(*client_args)
+ self.hypervisor_client = HypervisorClientXML(*client_args)
+ self.token_v3_client = V3TokenClientXML(*client_args)
+ self.network_client = NetworkClientXML(*client_args)
+ self.credentials_client = CredentialsClientXML(*client_args)
if client_args_v3_auth:
- self.servers_client_v3_auth = SERVERS_CLIENTS[interface](
+ self.servers_client_v3_auth = ServersClientXML(
*client_args_v3_auth)
- else:
- self.servers_client_v3_auth = None
- except KeyError:
+ elif interface == 'json':
+ self.servers_client = ServersClientJSON(*client_args)
+ self.limits_client = LimitsClientJSON(*client_args)
+ self.images_client = ImagesClientJSON(*client_args)
+ self.keypairs_client = KeyPairsClientJSON(*client_args)
+ self.quotas_client = QuotasClientJSON(*client_args)
+ self.flavors_client = FlavorsClientJSON(*client_args)
+ self.extensions_client = ExtensionsClientJSON(*client_args)
+ self.volumes_extensions_client = VolumesExtensionsClientJSON(
+ *client_args)
+ self.floating_ips_client = FloatingIPsClientJSON(*client_args)
+ self.snapshots_client = SnapshotsClientJSON(*client_args)
+ self.volumes_client = VolumesClientJSON(*client_args)
+ self.volume_types_client = VolumeTypesClientJSON(*client_args)
+ self.identity_client = IdentityClientJSON(*client_args)
+ self.identity_v3_client = IdentityV3ClientJSON(*client_args)
+ self.token_client = TokenClientJSON(self.config)
+ self.security_groups_client = SecurityGroupsClientJSON(
+ *client_args)
+ self.interfaces_client = InterfacesClientJSON(*client_args)
+ self.endpoints_client = EndPointClientJSON(*client_args)
+ self.fixed_ips_client = FixedIPsClientJSON(*client_args)
+ self.availability_zone_client = AvailabilityZoneClientJSON(
+ *client_args)
+ self.service_client = ServiceClientJSON(*client_args)
+ self.aggregates_client = AggregatesClientJSON(*client_args)
+ self.services_client = ServicesClientJSON(*client_args)
+ self.tenant_usages_client = TenantUsagesClientJSON(*client_args)
+ self.policy_client = PolicyClientJSON(*client_args)
+ self.hypervisor_client = HypervisorClientJSON(*client_args)
+ self.token_v3_client = V3TokenClientJSON(*client_args)
+ self.network_client = NetworkClientJSON(*client_args)
+ self.credentials_client = CredentialsClientJSON(*client_args)
+
+ if client_args_v3_auth:
+ self.servers_client_v3_auth = ServersClientJSON(
+ *client_args_v3_auth)
+ else:
msg = "Unsupported interface type `%s'" % interface
raise exceptions.InvalidConfiguration(msg)
+
+ # common clients
self.hosts_client = HostsClientJSON(*client_args)
self.account_client = AccountClient(*client_args)
if self.config.service_available.glance:
diff --git a/tempest/common/tempest_fixtures.py b/tempest/common/tempest_fixtures.py
index ebc9ad3..73c02e8 100644
--- a/tempest/common/tempest_fixtures.py
+++ b/tempest/common/tempest_fixtures.py
@@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.openstack.common import lockutils
+from tempest.openstack.common.fixture import lockutils
class LockFixture(lockutils.LockFixture):
diff --git a/tempest/config.py b/tempest/config.py
index db923e9..925c4bd 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -137,28 +137,6 @@
default="password",
help="Password used to authenticate to an instance using "
"the alternate image."),
- cfg.BoolOpt('resize_available',
- default=False,
- help="Does the test environment support resizing?"),
- cfg.BoolOpt('live_migration_available',
- default=False,
- help="Does the test environment support live migration "
- "available?"),
- cfg.BoolOpt('use_block_migration_for_live_migration',
- default=False,
- help="Does the test environment use block devices for live "
- "migration"),
- cfg.BoolOpt('block_migrate_supports_cinder_iscsi',
- default=False,
- help="Does the test environment block migration support "
- "cinder iSCSI volumes"),
- cfg.BoolOpt('change_password_available',
- default=False,
- help="Does the test environment support changing the admin "
- "password?"),
- cfg.BoolOpt('create_image_enabled',
- default=False,
- help="Does the test environment support snapshots?"),
cfg.IntOpt('build_interval',
default=10,
help="Time in seconds between build status checks."),
@@ -212,18 +190,47 @@
default=None,
help="Path to a private key file for SSH access to remote "
"hosts"),
- cfg.BoolOpt('disk_config_enabled',
- default=True,
- help="If false, skip disk config tests"),
- cfg.BoolOpt('flavor_extra_enabled',
- default=True,
- help="If false, skip flavor extra data test"),
cfg.StrOpt('volume_device_name',
default='vdb',
help="Expected device name when a volume is attached to "
"an instance")
]
+compute_features_group = cfg.OptGroup(name='compute-feature-enabled',
+ title="Enabled Compute Service Features")
+
+ComputeFeaturesGroup = [
+ cfg.BoolOpt('disk_config',
+ default=True,
+ help="If false, skip disk config tests"),
+ cfg.BoolOpt('flavor_extra',
+ default=True,
+ help="If false, skip flavor extra data test"),
+ cfg.BoolOpt('change_password',
+ default=False,
+ help="Does the test environment support changing the admin "
+ "password?"),
+ cfg.BoolOpt('create_image',
+ default=False,
+ help="Does the test environment support snapshots?"),
+ cfg.BoolOpt('resize',
+ default=False,
+ help="Does the test environment support resizing?"),
+ cfg.BoolOpt('live_migration',
+ default=False,
+ help="Does the test environment support live migration "
+ "available?"),
+ cfg.BoolOpt('block_migration_for_live_migration',
+ default=False,
+ help="Does the test environment use block devices for live "
+ "migration"),
+ cfg.BoolOpt('block_migrate_cinder_iscsi',
+ default=False,
+ help="Does the test environment block migration support "
+ "cinder iSCSI volumes")
+]
+
+
compute_admin_group = cfg.OptGroup(name='compute-admin',
title="Compute Admin Options")
@@ -245,9 +252,6 @@
title="Image Service Options")
ImageGroup = [
- cfg.StrOpt('api_version',
- default='1',
- help="Version of the API"),
cfg.StrOpt('catalog_type',
default='image',
help='Catalog type of the Image service.'),
@@ -263,6 +267,17 @@
help='http accessible image')
]
+image_feature_group = cfg.OptGroup(name='image-feature-enabled',
+ title='Enabled image service features')
+
+ImageFeaturesGroup = [
+ cfg.BoolOpt('api_v2',
+ default=True,
+ help="Is the v2 image API enabled"),
+ cfg.BoolOpt('api_v1',
+ default=True,
+ help="Is the v1 image API enabled"),
+]
network_group = cfg.OptGroup(name='network',
title='Network Service Options')
@@ -309,7 +324,7 @@
help='Timeout in seconds to wait for a volume to become'
'available.'),
cfg.StrOpt('catalog_type',
- default='Volume',
+ default='volume',
help="Catalog type of the Volume Service"),
cfg.StrOpt('region',
default='',
@@ -317,9 +332,6 @@
"of identity.region is used instead. If no such region "
"is found in the service catalog, the first found one is "
"used."),
- cfg.BoolOpt('multi_backend_enabled',
- default=False,
- help="Runs Cinder multi-backend test (requires 2 backends)"),
cfg.StrOpt('backend1_name',
default='BACKEND_1',
help="Name of the backend1 (must be declared in cinder.conf)"),
@@ -337,6 +349,15 @@
help='Disk format to use when copying a volume to image'),
]
+volume_feature_group = cfg.OptGroup(name='volume-feature-enabled',
+ title='Enabled Cinder Features')
+
+VolumeFeaturesGroup = [
+ cfg.BoolOpt('multi_backend',
+ default=False,
+ help="Runs Cinder multi-backend test (requires 2 backends)")
+]
+
object_storage_group = cfg.OptGroup(name='object-storage',
title='Object Storage Service Options')
@@ -351,27 +372,34 @@
"value of identity.region is used instead. If no such "
"region is found in the service catalog, the first found "
"one is used."),
- cfg.StrOpt('container_sync_timeout',
+ cfg.IntOpt('container_sync_timeout',
default=120,
help="Number of seconds to time on waiting for a container"
"to container synchronization complete."),
- cfg.StrOpt('container_sync_interval',
+ cfg.IntOpt('container_sync_interval',
default=5,
help="Number of seconds to wait while looping to check the"
"status of a container to container synchronization"),
- cfg.BoolOpt('accounts_quotas_available',
- default=True,
- help="Set to True if the Account Quota middleware is enabled"),
- cfg.BoolOpt('container_quotas_available',
- default=True,
- help="Set to True if the container quota middleware "
- "is enabled"),
cfg.StrOpt('operator_role',
default='Member',
help="Role to add to users created for swift tests to "
"enable creating containers"),
]
+object_storage_feature_group = cfg.OptGroup(
+ name='object-storage-feature-enabled',
+ title='Enabled object-storage features')
+
+ObjectStoreFeaturesGroup = [
+ cfg.BoolOpt('container_quotas',
+ default=True,
+ help="Set to True if the container quota middleware "
+ "is enabled"),
+ cfg.BoolOpt('accounts_quotas',
+ default=True,
+ help="Set to True if the Account Quota middleware is enabled"),
+]
+
orchestration_group = cfg.OptGroup(name='orchestration',
title='Orchestration Service Options')
@@ -410,7 +438,7 @@
default=None,
help="Name of existing keypair to launch servers with."),
cfg.IntOpt('max_template_size',
- default=32768,
+ default=524288,
help="Value must match heat configuration of the same name."),
]
@@ -499,10 +527,10 @@
cfg.StrOpt('target_logfiles',
default=None,
help='regexp for list of log files.'),
- cfg.StrOpt('log_check_interval',
+ cfg.IntOpt('log_check_interval',
default=60,
help='time (in seconds) between log file error checks.'),
- cfg.StrOpt('default_thread_number_per_action',
+ cfg.IntOpt('default_thread_number_per_action',
default=4,
help='The number of threads created while stress test.')
]
@@ -557,6 +585,9 @@
cfg.BoolOpt('heat',
default=False,
help="Whether or not Heat is expected to be available"),
+ cfg.BoolOpt('ceilometer',
+ default=True,
+ help="Whether or not Ceilometer is expected to be available"),
cfg.BoolOpt('horizon',
default=True,
help="Whether or not Horizon is expected to be available"),
@@ -611,11 +642,18 @@
LOG.info("Using tempest config file %s" % path)
register_opt_group(cfg.CONF, compute_group, ComputeGroup)
+ register_opt_group(cfg.CONF, compute_features_group,
+ ComputeFeaturesGroup)
register_opt_group(cfg.CONF, identity_group, IdentityGroup)
register_opt_group(cfg.CONF, image_group, ImageGroup)
+ register_opt_group(cfg.CONF, image_feature_group, ImageFeaturesGroup)
register_opt_group(cfg.CONF, network_group, NetworkGroup)
register_opt_group(cfg.CONF, volume_group, VolumeGroup)
+ register_opt_group(cfg.CONF, volume_feature_group,
+ VolumeFeaturesGroup)
register_opt_group(cfg.CONF, object_storage_group, ObjectStoreGroup)
+ register_opt_group(cfg.CONF, object_storage_feature_group,
+ ObjectStoreFeaturesGroup)
register_opt_group(cfg.CONF, orchestration_group, OrchestrationGroup)
register_opt_group(cfg.CONF, dashboard_group, DashboardGroup)
register_opt_group(cfg.CONF, boto_group, BotoGroup)
@@ -626,11 +664,16 @@
ServiceAvailableGroup)
register_opt_group(cfg.CONF, debug_group, DebugGroup)
self.compute = cfg.CONF.compute
+ self.compute_feature_enabled = cfg.CONF['compute-feature-enabled']
self.identity = cfg.CONF.identity
self.images = cfg.CONF.image
+ self.image_feature_enabled = cfg.CONF['image-feature-enabled']
self.network = cfg.CONF.network
self.volume = cfg.CONF.volume
+ self.volume_feature_enabled = cfg.CONF['volume-feature-enabled']
self.object_storage = cfg.CONF['object-storage']
+ self.object_storage_feature_enabled = cfg.CONF[
+ 'object-storage-feature-enabled']
self.orchestration = cfg.CONF.orchestration
self.dashboard = cfg.CONF.dashboard
self.boto = cfg.CONF.boto
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 8d05fd8..67406b0 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -81,6 +81,10 @@
message = "Server %(server_id)s failed to build and is in ERROR status"
+class ImageKilledException(TempestException):
+ message = "Image %(image_id)s 'killed' while waiting for %(status)s"
+
+
class AddImageException(TempestException):
message = "Image %(image_id)s failed to become ACTIVE in the allotted time"
diff --git a/tempest/openstack/common/fixture/__init__.py b/tempest/openstack/common/fixture/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/openstack/common/fixture/__init__.py
diff --git a/tempest/openstack/common/fixture/config.py b/tempest/openstack/common/fixture/config.py
new file mode 100644
index 0000000..7b044ef
--- /dev/null
+++ b/tempest/openstack/common/fixture/config.py
@@ -0,0 +1,46 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+#
+# Copyright 2013 Mirantis, Inc.
+# Copyright 2013 OpenStack Foundation
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+import fixtures
+from oslo.config import cfg
+import six
+
+
+class Config(fixtures.Fixture):
+ """Override some configuration values.
+
+ The keyword arguments are the names of configuration options to
+ override and their values.
+
+ If a group argument is supplied, the overrides are applied to
+ the specified configuration option group.
+
+ All overrides are automatically cleared at the end of the current
+ test by the reset() method, which is registred by addCleanup().
+ """
+
+ def __init__(self, conf=cfg.CONF):
+ self.conf = conf
+
+ def setUp(self):
+ super(Config, self).setUp()
+ self.addCleanup(self.conf.reset)
+
+ def config(self, **kw):
+ group = kw.pop('group', None)
+ for k, v in six.iteritems(kw):
+ self.conf.set_override(k, v, group)
diff --git a/tempest/openstack/common/fixture/lockutils.py b/tempest/openstack/common/fixture/lockutils.py
new file mode 100644
index 0000000..21b4a48
--- /dev/null
+++ b/tempest/openstack/common/fixture/lockutils.py
@@ -0,0 +1,53 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2011 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 fixtures
+
+from tempest.openstack.common.lockutils import lock
+
+
+class LockFixture(fixtures.Fixture):
+ """External locking fixture.
+
+ This fixture is basically an alternative to the synchronized decorator with
+ the external flag so that tearDowns and addCleanups will be included in
+ the lock context for locking between tests. The fixture is recommended to
+ be the first line in a test method, like so::
+
+ def test_method(self):
+ self.useFixture(LockFixture)
+ ...
+
+ or the first line in setUp if all the test methods in the class are
+ required to be serialized. Something like::
+
+ class TestCase(testtools.testcase):
+ def setUp(self):
+ self.useFixture(LockFixture)
+ super(TestCase, self).setUp()
+ ...
+
+ This is because addCleanups are put on a LIFO queue that gets run after the
+ test method exits. (either by completing or raising an exception)
+ """
+ def __init__(self, name, lock_file_prefix=None):
+ self.mgr = lock(name, lock_file_prefix, True)
+
+ def setUp(self):
+ super(LockFixture, self).setUp()
+ self.addCleanup(self.mgr.__exit__, None, None, None)
+ self.mgr.__enter__()
diff --git a/tempest/openstack/common/fixture/mockpatch.py b/tempest/openstack/common/fixture/mockpatch.py
new file mode 100644
index 0000000..cd0d6ca
--- /dev/null
+++ b/tempest/openstack/common/fixture/mockpatch.py
@@ -0,0 +1,51 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2010 United States Government as represented by the
+# Administrator of the National Aeronautics and Space Administration.
+# Copyright 2013 Hewlett-Packard Development Company, L.P.
+# 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 fixtures
+import mock
+
+
+class PatchObject(fixtures.Fixture):
+ """Deal with code around mock."""
+
+ def __init__(self, obj, attr, **kwargs):
+ self.obj = obj
+ self.attr = attr
+ self.kwargs = kwargs
+
+ def setUp(self):
+ super(PatchObject, self).setUp()
+ _p = mock.patch.object(self.obj, self.attr, **self.kwargs)
+ self.mock = _p.start()
+ self.addCleanup(_p.stop)
+
+
+class Patch(fixtures.Fixture):
+
+ """Deal with code around mock.patch."""
+
+ def __init__(self, obj, **kwargs):
+ self.obj = obj
+ self.kwargs = kwargs
+
+ def setUp(self):
+ super(Patch, self).setUp()
+ _p = mock.patch(self.obj, **self.kwargs)
+ self.mock = _p.start()
+ self.addCleanup(_p.stop)
diff --git a/tempest/openstack/common/fixture/moxstubout.py b/tempest/openstack/common/fixture/moxstubout.py
new file mode 100644
index 0000000..a0e74fd
--- /dev/null
+++ b/tempest/openstack/common/fixture/moxstubout.py
@@ -0,0 +1,34 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2010 United States Government as represented by the
+# Administrator of the National Aeronautics and Space Administration.
+# Copyright 2013 Hewlett-Packard Development Company, L.P.
+# 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 fixtures
+import mox
+
+
+class MoxStubout(fixtures.Fixture):
+ """Deal with code around mox and stubout as a fixture."""
+
+ def setUp(self):
+ super(MoxStubout, self).setUp()
+ # emulate some of the mox stuff, we can't use the metaclass
+ # because it screws with our generators
+ self.mox = mox.Mox()
+ self.stubs = self.mox.stubs
+ self.addCleanup(self.mox.UnsetStubs)
+ self.addCleanup(self.mox.VerifyAll)
diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py
index 853b1ba..112c8a2 100644
--- a/tempest/scenario/test_server_advanced_ops.py
+++ b/tempest/scenario/test_server_advanced_ops.py
@@ -35,7 +35,7 @@
def setUpClass(cls):
super(TestServerAdvancedOps, cls).setUpClass()
- if not cls.config.compute.resize_available:
+ if not cls.config.compute_feature_enabled.resize:
msg = "Skipping test - resize not available on this host"
raise cls.skipException(msg)
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index 4f49d65..6812d64 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -18,7 +18,6 @@
import time
from cinderclient import exceptions as cinder_exceptions
-import testtools
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
@@ -142,7 +141,7 @@
got_timestamp = ssh_client.exec_command('sudo cat /mnt/timestamp')
self.assertEqual(self.timestamp, got_timestamp)
- @testtools.skip("Skipped until the Bug #1205344 is resolved.")
+ @tempest.test.skip_because(bug="1205344")
@tempest.test.services('compute', 'network', 'volume', 'image')
def test_stamp_pattern(self):
# prepare for booting a instance
diff --git a/tempest/services/compute/json/aggregates_client.py b/tempest/services/compute/json/aggregates_client.py
index 75ce9ff..b7c6bf1 100644
--- a/tempest/services/compute/json/aggregates_client.py
+++ b/tempest/services/compute/json/aggregates_client.py
@@ -97,3 +97,14 @@
post_body, self.headers)
body = json.loads(body)
return resp, body['aggregate']
+
+ def set_metadata(self, aggregate_id, meta):
+ """Replaces the aggregate's existing metadata with new metadata."""
+ post_body = {
+ 'metadata': meta,
+ }
+ post_body = json.dumps({'set_metadata': post_body})
+ resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
+ post_body, self.headers)
+ body = json.loads(body)
+ return resp, body['aggregate']
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index c3b568d..dc05e3e 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -102,6 +102,13 @@
body = json.loads(body)
return resp, body['extra_specs']
+ def get_flavor_extra_spec_with_key(self, flavor_id, key):
+ """Gets a specified key value for the mentioned flavor."""
+ resp, body = self.get('flavors/%s/os-extra_specs/%s' % (str(flavor_id),
+ key))
+ body = json.loads(body)
+ return resp, body[key]
+
def unset_flavor_extra_spec(self, flavor_id, key):
"""Unsets extra Specs from the mentioned flavor."""
return self.delete('flavors/%s/os-extra_specs/%s' % (str(flavor_id),
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index 30a3f7b..f51879d 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -44,3 +44,39 @@
resp, body = self.get("os-hosts/%s" % str(hostname))
body = json.loads(body)
return resp, body['host']
+
+ def update_host(self, hostname, **kwargs):
+ """Update a host."""
+
+ request_body = {
+ 'status': None,
+ 'maintenance_mode': None,
+ }
+ request_body.update(**kwargs)
+ request_body = json.dumps(request_body)
+
+ resp, body = self.put("os-hosts/%s" % str(hostname), request_body,
+ self.headers)
+ body = json.loads(body)
+ return resp, body
+
+ def startup_host(self, hostname):
+ """Startup a host."""
+
+ resp, body = self.get("os-hosts/%s/startup" % str(hostname))
+ body = json.loads(body)
+ return resp, body['host']
+
+ def shutdown_host(self, hostname):
+ """Shutdown a host."""
+
+ resp, body = self.get("os-hosts/%s/shutdown" % str(hostname))
+ body = json.loads(body)
+ return resp, body['host']
+
+ def reboot_host(self, hostname):
+ """reboot a host."""
+
+ resp, body = self.get("os-hosts/%s/reboot" % str(hostname))
+ body = json.loads(body)
+ return resp, body['host']
diff --git a/tempest/services/compute/json/hypervisor_client.py b/tempest/services/compute/json/hypervisor_client.py
index e2e5c7b..fba5acb 100644
--- a/tempest/services/compute/json/hypervisor_client.py
+++ b/tempest/services/compute/json/hypervisor_client.py
@@ -63,3 +63,9 @@
resp, body = self.get('os-hypervisors/%s/uptime' % hyper_id)
body = json.loads(body)
return resp, body['hypervisor']
+
+ def search_hypervisor(self, hyper_name):
+ """Search specified hypervisor."""
+ resp, body = self.get('os-hypervisors/%s/search' % hyper_name)
+ body = json.loads(body)
+ return resp, body['hypervisors']
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index dfbc01c..07bb6ce 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -89,7 +89,7 @@
return resp, body['server']
def update_server(self, server_id, name=None, meta=None, accessIPv4=None,
- accessIPv6=None):
+ accessIPv6=None, disk_config=None):
"""
Updates the properties of an existing server.
server_id: The id of an existing server.
@@ -113,6 +113,9 @@
if accessIPv6 is not None:
post_body['accessIPv6'] = accessIPv6
+ if disk_config is not None:
+ post_body['OS-DCF:diskConfig'] = disk_config
+
post_body = json.dumps({'server': post_body})
resp, body = self.put("servers/%s" % str(server_id),
post_body, self.headers)
diff --git a/tempest/services/compute/xml/aggregates_client.py b/tempest/services/compute/xml/aggregates_client.py
index 8ef0af6..5faaff5 100644
--- a/tempest/services/compute/xml/aggregates_client.py
+++ b/tempest/services/compute/xml/aggregates_client.py
@@ -21,6 +21,7 @@
from tempest import exceptions
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
+from tempest.services.compute.xml.common import Text
from tempest.services.compute.xml.common import xml_to_json
@@ -112,3 +113,18 @@
self.headers)
aggregate = self._format_aggregate(etree.fromstring(body))
return resp, aggregate
+
+ def set_metadata(self, aggregate_id, meta):
+ """Replaces the aggregate's existing metadata with new metadata."""
+ post_body = Element("set_metadata")
+ metadata = Element("metadata")
+ post_body.append(metadata)
+ for k, v in meta.items():
+ meta = Element(k)
+ meta.append(Text(v))
+ metadata.append(meta)
+ resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
+ str(Document(post_body)),
+ self.headers)
+ aggregate = self._format_aggregate(etree.fromstring(body))
+ return resp, aggregate
diff --git a/tempest/services/compute/xml/common.py b/tempest/services/compute/xml/common.py
index 84b56c2..ad79ed6 100644
--- a/tempest/services/compute/xml/common.py
+++ b/tempest/services/compute/xml/common.py
@@ -36,7 +36,9 @@
self._elements.append(element)
def __str__(self):
- args = " ".join(['%s="%s"' % (k, v) for k, v in self._attrs.items()])
+ args = " ".join(['%s="%s"' %
+ (k, v if v is not None else "")
+ for k, v in self._attrs.items()])
string = '<%s %s' % (self.element_name, args)
if not self._elements:
string += '/>'
@@ -78,7 +80,9 @@
Element.__init__(self, '?xml', *args, **kwargs)
def __str__(self):
- args = " ".join(['%s="%s"' % (k, v) for k, v in self._attrs.items()])
+ args = " ".join(['%s="%s"' %
+ (k, v if v is not None else "")
+ for k, v in self._attrs.items()])
string = '<?xml %s?>\n' % args
for element in self._elements:
string += str(element)
diff --git a/tempest/services/compute/xml/flavors_client.py b/tempest/services/compute/xml/flavors_client.py
index c5886ee..c7ed044 100644
--- a/tempest/services/compute/xml/flavors_client.py
+++ b/tempest/services/compute/xml/flavors_client.py
@@ -148,6 +148,13 @@
body = xml_to_json(etree.fromstring(body))
return resp, body
+ def get_flavor_extra_spec_with_key(self, flavor_id, key):
+ """Gets a specified key detail for the mentioned flavor."""
+ resp, body = self.get('flavors/%s/os-extra_specs/%s' % (str(flavor_id),
+ key), self.headers)
+ body = xml_to_json(etree.fromstring(body))
+ return resp, body
+
def unset_flavor_extra_spec(self, flavor_id, key):
"""Unsets an extra spec based on the mentioned flavor and key."""
return self.delete('flavors/%s/os-extra_specs/%s' % (str(flavor_id),
diff --git a/tempest/services/compute/xml/hosts_client.py b/tempest/services/compute/xml/hosts_client.py
index 9743143..f7d7b0a 100644
--- a/tempest/services/compute/xml/hosts_client.py
+++ b/tempest/services/compute/xml/hosts_client.py
@@ -18,6 +18,8 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
+from tempest.services.compute.xml.common import Document
+from tempest.services.compute.xml.common import Element
from tempest.services.compute.xml.common import xml_to_json
@@ -47,3 +49,46 @@
node = etree.fromstring(body)
body = [xml_to_json(x) for x in node.getchildren()]
return resp, body
+
+ def update_host(self, hostname, status=None, maintenance_mode=None,
+ **kwargs):
+ """Update a host."""
+
+ request_body = Element(status=status,
+ maintenance_mode=maintenance_mode)
+ if kwargs:
+ for k, v in kwargs.iteritem():
+ request_body.add_attr(k, v)
+ resp, body = self.put("os-hosts/%s" % str(hostname),
+ str(Document(request_body)),
+ self.headers)
+ node = etree.fromstring(body)
+ body = [xml_to_json(x) for x in node.getchildren()]
+ return resp, body
+
+ def startup_host(self, hostname):
+ """Startup a host."""
+
+ resp, body = self.get("os-hosts/%s/startup" % str(hostname),
+ self.headers)
+ node = etree.fromstring(body)
+ body = [xml_to_json(x) for x in node.getchildren()]
+ return resp, body
+
+ def shutdown_host(self, hostname):
+ """Shutdown a host."""
+
+ resp, body = self.get("os-hosts/%s/shutdown" % str(hostname),
+ self.headers)
+ node = etree.fromstring(body)
+ body = [xml_to_json(x) for x in node.getchildren()]
+ return resp, body
+
+ def reboot_host(self, hostname):
+ """Reboot a host."""
+
+ resp, body = self.get("os-hosts/%s/reboot" % str(hostname),
+ self.headers)
+ node = etree.fromstring(body)
+ body = [xml_to_json(x) for x in node.getchildren()]
+ return resp, body
diff --git a/tempest/services/compute/xml/hypervisor_client.py b/tempest/services/compute/xml/hypervisor_client.py
index 3c4f2b8..c10fed9 100644
--- a/tempest/services/compute/xml/hypervisor_client.py
+++ b/tempest/services/compute/xml/hypervisor_client.py
@@ -70,3 +70,10 @@
self.headers)
uptime = xml_to_json(etree.fromstring(body))
return resp, uptime
+
+ def search_hypervisor(self, hyper_name):
+ """Search specified hypervisor."""
+ resp, body = self.get('os-hypervisors/%s/search' % hyper_name,
+ self.headers)
+ hypervisors = self._parse_array(etree.fromstring(body))
+ return resp, hypervisors
diff --git a/tempest/services/compute/xml/servers_client.py b/tempest/services/compute/xml/servers_client.py
index ada0398..43de4ef 100644
--- a/tempest/services/compute/xml/servers_client.py
+++ b/tempest/services/compute/xml/servers_client.py
@@ -250,7 +250,7 @@
return resp, {"servers": servers}
def update_server(self, server_id, name=None, meta=None, accessIPv4=None,
- accessIPv6=None):
+ accessIPv6=None, disk_config=None):
doc = Document()
server = Element("server")
doc.append(server)
@@ -261,6 +261,10 @@
server.add_attr("accessIPv4", accessIPv4)
if accessIPv6 is not None:
server.add_attr("accessIPv6", accessIPv6)
+ if disk_config is not None:
+ server.add_attr('xmlns:OS-DCF', "http://docs.openstack.org/"
+ "compute/ext/disk_config/api/v1.1")
+ server.add_attr("OS-DCF:diskConfig", disk_config)
if meta is not None:
metadata = Element("metadata")
server.append(metadata)
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index 1921d78..41b9e81 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -265,9 +265,12 @@
LOG.info('Value transition from "%s" to "%s"'
'in %d second(s).', old_value,
value, dtime)
- if (value == status):
+ if value == status:
return value
+ if value == 'killed':
+ raise exceptions.ImageKilledException(image_id=image_id,
+ status=value)
if dtime > self.build_timeout:
message = ('Time Limit Exceeded! (%ds)'
'while waiting for %s, '
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index f0531ec..342a09c 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -100,7 +100,7 @@
self._validate_schema(body, type='images')
return resp, body['images']
- def get_image_metadata(self, image_id):
+ def get_image(self, image_id):
url = 'v2/images/%s' % image_id
resp, body = self.get(url)
body = json.loads(body)
@@ -108,7 +108,7 @@
def is_resource_deleted(self, id):
try:
- self.get_image_metadata(id)
+ self.get_image(id)
except exceptions.NotFound:
return True
return False
@@ -124,3 +124,13 @@
url = 'v2/images/%s/file' % image_id
resp, body = self.get(url)
return resp, body
+
+ def add_image_tag(self, image_id, tag):
+ url = 'v2/images/%s/tags/%s' % (image_id, tag)
+ resp, body = self.put(url, body=None, headers=self.headers)
+ return resp, body
+
+ def delete_image_tag(self, image_id, tag):
+ url = 'v2/images/%s/tags/%s' % (image_id, tag)
+ resp, _ = self.delete(url)
+ return resp
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index 62a6e24..f054a2b 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -154,3 +154,13 @@
except exceptions.NotFound:
return True
return False
+
+ def extend_volume(self, volume_id, extend_size):
+ """Extend a volume."""
+ post_body = {
+ 'new_size': extend_size
+ }
+ post_body = json.dumps({'os-extend': post_body})
+ url = 'volumes/%s/action' % (volume_id)
+ resp, body = self.post(url, post_body, self.headers)
+ return resp, body
diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py
index b59ec03..f5d8beb 100644
--- a/tempest/services/volume/xml/volumes_client.py
+++ b/tempest/services/volume/xml/volumes_client.py
@@ -227,3 +227,13 @@
resp, body = self.post(url, str(Document(post_body)), self.headers)
volume = xml_to_json(etree.fromstring(body))
return resp, volume
+
+ def extend_volume(self, volume_id, extend_size):
+ """Extend a volume."""
+ post_body = Element("os-extend",
+ new_size=extend_size)
+ url = 'volumes/%s/action' % str(volume_id)
+ resp, body = self.post(url, str(Document(post_body)), self.headers)
+ if body:
+ body = xml_to_json(etree.fromstring(body))
+ return resp, body
diff --git a/tempest/test.py b/tempest/test.py
index 8ce7af8..6ae7925 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -26,6 +26,7 @@
import testtools
from tempest import clients
+from tempest.common import isolated_creds
from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
@@ -164,7 +165,11 @@
if at_exit_set:
raise RuntimeError("tearDownClass does not calls the super's "
"tearDownClass in these classes: "
- + str(at_exit_set))
+ + str(at_exit_set) + "\n"
+ "If you see the exception, with another "
+ "exception please do not report this one!"
+ "If you are changing tempest code, make sure you",
+ "are calling the super class's tearDownClass!")
atexit.register(validate_tearDownClass)
@@ -216,7 +221,36 @@
os.environ.get('OS_LOG_CAPTURE') != '0'):
log_format = '%(asctime)-15s %(message)s'
self.useFixture(fixtures.LoggerFixture(nuke_handlers=False,
- format=log_format))
+ format=log_format,
+ level=None))
+
+ @classmethod
+ def get_client_manager(cls):
+ """
+ Returns an Openstack client manager
+ """
+ cls.isolated_creds = isolated_creds.IsolatedCreds(cls.__name__)
+
+ force_tenant_isolation = getattr(cls, 'force_tenant_isolation', None)
+ if (cls.config.compute.allow_tenant_isolation or
+ force_tenant_isolation):
+ creds = cls.isolated_creds.get_primary_creds()
+ username, tenant_name, password = creds
+ os = clients.Manager(username=username,
+ password=password,
+ tenant_name=tenant_name,
+ interface=cls._interface)
+ else:
+ os = clients.Manager(interface=cls._interface)
+ return os
+
+ @classmethod
+ def clear_isolated_creds(cls):
+ """
+ Clears isolated creds if set
+ """
+ if getattr(cls, 'isolated_creds'):
+ cls.isolated_creds.clear_isolated_creds()
@classmethod
def _get_identity_admin_client(cls):
diff --git a/tempest/tests/base.py b/tempest/tests/base.py
new file mode 100644
index 0000000..12c1c25
--- /dev/null
+++ b/tempest/tests/base.py
@@ -0,0 +1,55 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 IBM Corp.
+#
+# 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 os
+
+import fixtures
+import mox
+import stubout
+import testtools
+
+
+class MoxStubout(fixtures.Fixture):
+ """Deal with code around mox and stubout as a fixture."""
+
+ def setUp(self):
+ super(MoxStubout, self).setUp()
+ # emulate some of the mox stuff, we can't use the metaclass
+ # because it screws with our generators
+ self.mox = mox.Mox()
+ self.stubs = stubout.StubOutForTesting()
+ self.addCleanup(self.stubs.UnsetAll)
+ self.addCleanup(self.stubs.SmartUnsetAll)
+ self.addCleanup(self.mox.UnsetStubs)
+ self.addCleanup(self.mox.VerifyAll)
+
+
+class TestCase(testtools.TestCase):
+
+ def setUp(self):
+ super(TestCase, self).setUp()
+ if (os.environ.get('OS_STDOUT_CAPTURE') == 'True' or
+ os.environ.get('OS_STDOUT_CAPTURE') == '1'):
+ stdout = self.useFixture(fixtures.StringStream('stdout')).stream
+ self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
+ if (os.environ.get('OS_STDERR_CAPTURE') == 'True' or
+ os.environ.get('OS_STDERR_CAPTURE') == '1'):
+ stderr = self.useFixture(fixtures.StringStream('stderr')).stream
+ self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
+
+ mox_fixture = self.useFixture(MoxStubout())
+ self.mox = mox_fixture.mox
+ self.stubs = mox_fixture.stubs
diff --git a/tempest/tests/test_wrappers.py b/tempest/tests/test_wrappers.py
index dbe3420..dbf1809 100644
--- a/tempest/tests/test_wrappers.py
+++ b/tempest/tests/test_wrappers.py
@@ -18,12 +18,13 @@
import shutil
import subprocess
import tempfile
-import testtools
+
+from tempest.tests import base
DEVNULL = open(os.devnull, 'wb')
-class TestWrappers(testtools.TestCase):
+class TestWrappers(base.TestCase):
def setUp(self):
super(TestWrappers, self).setUp()
# Setup test dirs
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index 5295e44..5ae21c8 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -193,11 +193,10 @@
class BotoTestCase(tempest.test.BaseTestCase):
"""Recommended to use as base class for boto related test."""
- conclusion = decision_maker()
-
@classmethod
def setUpClass(cls):
super(BotoTestCase, cls).setUpClass()
+ cls.conclusion = decision_maker()
# The trash contains cleanup functions and paramaters in tuples
# (function, *args, **kwargs)
cls._resource_trash_bin = {}
diff --git a/test-requirements.txt b/test-requirements.txt
index 8aa6ed9..fbe7e43 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -4,3 +4,4 @@
sphinx>=1.1.2
python-subunit
oslo.sphinx
+mox>=0.5.3
diff --git a/tools/skip_tracker.py b/tools/skip_tracker.py
index ffaf134..0ae3323 100755
--- a/tools/skip_tracker.py
+++ b/tools/skip_tracker.py
@@ -46,14 +46,24 @@
test methods that have been decorated to skip because of
a particular bug.
"""
- results = []
+ results = {}
debug("Searching in %s", start)
for root, _dirs, files in os.walk(start):
for name in files:
if name.startswith('test_') and name.endswith('py'):
path = os.path.join(root, name)
debug("Searching in %s", path)
- results += find_skips_in_file(path)
+ temp_result = find_skips_in_file(path)
+ for method_name, bug_no in temp_result:
+ if results.get(bug_no):
+ result_dict = results.get(bug_no)
+ if result_dict.get(name):
+ result_dict[name].append(method_name)
+ else:
+ result_dict[name] = [method_name]
+ results[bug_no] = result_dict
+ else:
+ results[bug_no] = {name: [method_name]}
return results
@@ -83,11 +93,19 @@
return results
+def get_results(result_dict):
+ results = []
+ for bug_no in result_dict.keys():
+ for method in result_dict[bug_no]:
+ results.append((method, bug_no))
+ return results
+
+
if __name__ == '__main__':
logging.basicConfig(format='%(levelname)s: %(message)s',
level=logging.INFO)
results = find_skips()
- unique_bugs = sorted(set([bug for (method, bug) in results]))
+ unique_bugs = sorted(set([bug for (method, bug) in get_results(results)]))
unskips = []
duplicates = []
info("Total bug skips found: %d", len(results))
@@ -122,4 +140,7 @@
print("should be removed from the test cases:")
print()
for bug in unskips:
- print(" %7s" % bug)
+ message = " %7s in " % bug
+ locations = ["%s" % x for x in results[bug].keys()]
+ message += " and ".join(locations)
+ print(message)
diff --git a/tools/verify_tempest_config.py b/tools/verify_tempest_config.py
new file mode 100755
index 0000000..1b5fe68
--- /dev/null
+++ b/tools/verify_tempest_config.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 IBM Corp.
+#
+# 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 sys
+
+from tempest import clients
+from tempest import config
+
+
+CONF = config.TempestConfig()
+
+#Dicts matching extension names to config options
+NOVA_EXTENSIONS = {
+ 'disk_config': 'DiskConfig',
+ 'change_password': 'ServerPassword',
+ 'flavor_extra': 'FlavorExtraSpecs'
+}
+
+
+def verify_glance_api_versions(os):
+ # Check glance api versions
+ __, versions = os.image_client.get_versions()
+ if CONF.image_feature_enabled.api_v1 != ('v1.1' in versions or 'v1.0' in
+ versions):
+ print 'Config option image api_v1 should be change to: %s' % (
+ not CONF.image_feature_enabled.api_v1)
+ if CONF.image_feature_enabled.api_v2 != ('v2.0' in versions):
+ print 'Config option image api_v2 should be change to: %s' % (
+ not CONF.image_feature_enabled.api_v2)
+
+
+def verify_extensions(os):
+ results = {}
+ extensions_client = os.extensions_client
+ __, resp = extensions_client.list_extensions()
+ resp = resp['extensions']
+ extensions = map(lambda x: x['name'], resp)
+ results['nova_features'] = {}
+ for extension in NOVA_EXTENSIONS.keys():
+ if NOVA_EXTENSIONS[extension] in extensions:
+ results['nova_features'][extension] = True
+ else:
+ results['nova_features'][extension] = False
+ return results
+
+
+def display_results(results):
+ for option in NOVA_EXTENSIONS.keys():
+ config_value = getattr(CONF.compute_feature_enabled, option)
+ if config_value != results['nova_features'][option]:
+ print "Config option: %s should be changed to: %s" % (
+ option, not config_value)
+
+
+def main(argv):
+ os = clients.ComputeAdminManager(interface='json')
+ results = verify_extensions(os)
+ verify_glance_api_versions(os)
+ display_results(results)
+
+
+if __name__ == "__main__":
+ main(sys.argv)