Merge "use "" instead of "None" in xml file"
diff --git a/requirements.txt b/requirements.txt
index 3b9ec44..4dea533 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -19,6 +19,6 @@
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/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 14ab236..e8acec5 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
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 8213839..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.
@@ -144,7 +144,7 @@
# An exception should be raised when adding flavor access to the same
# tenant
- self.assertRaises(exceptions.Duplicate,
+ self.assertRaises(exceptions.Conflict,
self.client.add_flavor_access,
new_flavor['id'],
self.tenant_id)
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..aa769ba 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -21,7 +21,7 @@
from tempest.test import attr
-class HostsAdminTestJSON(base.BaseComputeAdminTest):
+class HostsAdminTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests hosts API using admin privileges.
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..69b8d9c
--- /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.BaseComputeAdminTest):
+
+ """
+ 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..37573c4 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -34,6 +34,7 @@
"""Base test case class for all Compute API tests."""
conclusion = compute.generic_setup_package()
+ force_tenant_isolation = False
@classmethod
def setUpClass(cls):
@@ -43,7 +44,8 @@
raise cls.skipException(skip_msg)
cls.isolated_creds = isolated_creds.IsolatedCreds(cls.__name__)
- 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_primary_creds()
username, tenant_name, password = creds
os = clients.Manager(username=username,
@@ -54,37 +56,19 @@
os = clients.Manager(interface=cls._interface)
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:
@@ -162,7 +146,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 +179,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 +217,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 bb04f1d..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
@@ -158,7 +159,7 @@
# Create second snapshot
alt_snapshot_name = rand_name('test-snap-')
- self.assertRaises(exceptions.Duplicate, self.client.create_image,
+ self.assertRaises(exceptions.Conflict, self.client.create_image,
self.server_id, alt_snapshot_name)
self.client.wait_for_image_status(image_id, 'ACTIVE')
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 807315a..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
@@ -158,7 +158,7 @@
resp, _ = self.client.create_keypair(k_name)
self.assertEqual(200, resp.status)
# Now try the same keyname to create another key
- self.assertRaises(exceptions.Duplicate, self.client.create_keypair,
+ self.assertRaises(exceptions.Conflict, self.client.create_keypair,
k_name)
resp, _ = self.client.delete_keypair(k_name)
self.assertEqual(202, resp.status)
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..6f50a02 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -30,7 +30,7 @@
from tempest.test import skip_because
-class ServerActionsTestJSON(base.BaseComputeTest):
+class ServerActionsTestJSON(base.BaseV2ComputeTest):
_interface = 'json'
resize_available = tempest.config.TempestConfig().compute.resize_available
run_ssh = tempest.config.TempestConfig().compute.run_ssh
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 82559d5..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
@@ -133,13 +133,13 @@
self.addCleanup(self._unpause, self.server_id)
self.assertEqual(202, resp.status)
self.servers_client.wait_for_server_status(self.server_id, 'PAUSED')
- self.assertRaises(exceptions.Duplicate,
+ self.assertRaises(exceptions.Conflict,
self.servers_client.rescue_server,
self.server_id)
@attr(type=['negative', 'gate'])
def test_rescued_vm_reboot(self):
- self.assertRaises(exceptions.Duplicate, self.servers_client.reboot,
+ self.assertRaises(exceptions.Conflict, self.servers_client.reboot,
self.rescue_id, 'HARD')
@attr(type=['negative', 'gate'])
@@ -151,7 +151,7 @@
@attr(type=['negative', 'gate'])
def test_rescued_vm_rebuild(self):
- self.assertRaises(exceptions.Duplicate,
+ self.assertRaises(exceptions.Conflict,
self.servers_client.rebuild,
self.rescue_id,
self.image_ref_alt)
@@ -164,7 +164,7 @@
self.addCleanup(self._unrescue, self.server_id)
# Attach the volume to the server
- self.assertRaises(exceptions.Duplicate,
+ self.assertRaises(exceptions.Conflict,
self.servers_client.attach_volume,
self.server_id,
self.volume_to_attach['id'],
@@ -188,7 +188,7 @@
self.addCleanup(self._unrescue, self.server_id)
# Detach the volume from the server expecting failure
- self.assertRaises(exceptions.Duplicate,
+ self.assertRaises(exceptions.Conflict,
self.servers_client.detach_volume,
self.server_id,
self.volume_to_detach['id'])
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 7062a3b..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):
@@ -120,31 +120,28 @@
nonexistent_server, 'SOFT')
@attr(type=['negative', 'gate'])
- def test_reboot_deleted_server(self):
- # Reboot a deleted server
- self.client.delete_server(self.server_id)
- self.client.wait_for_server_termination(self.server_id)
- self.assertRaises(exceptions.NotFound, self.client.reboot,
- self.server_id, 'SOFT')
-
- @attr(type=['negative', 'gate'])
def test_pause_paused_server(self):
# Pause a paused server.
self.client.pause_server(self.server_id)
+ self.addCleanup(self.client.unpause_server,
+ self.server_id)
self.client.wait_for_server_status(self.server_id, 'PAUSED')
- self.assertRaises(exceptions.Duplicate,
+ self.assertRaises(exceptions.Conflict,
self.client.pause_server,
self.server_id)
@attr(type=['negative', 'gate'])
- def test_rebuild_deleted_server(self):
- # Rebuild a deleted server
- self.client.delete_server(self.server_id)
- self.client.wait_for_server_termination(self.server_id)
+ def test_rebuild_reboot_deleted_server(self):
+ # Rebuild and Reboot a deleted server
+ _, server = self.create_server()
+ self.client.delete_server(server['id'])
+ self.client.wait_for_server_termination(server['id'])
self.assertRaises(exceptions.NotFound,
self.client.rebuild,
- self.server_id, self.image_ref_alt)
+ server['id'], self.image_ref_alt)
+ self.assertRaises(exceptions.NotFound, self.client.reboot,
+ server['id'], 'SOFT')
@attr(type=['negative', 'gate'])
def test_rebuild_non_existent_server(self):
@@ -317,7 +314,7 @@
@attr(type=['negative', 'gate'])
def test_unpause_server_invalid_state(self):
# unpause an active server.
- self.assertRaises(exceptions.Duplicate,
+ self.assertRaises(exceptions.Conflict,
self.client.unpause_server,
self.server_id)
@@ -332,9 +329,11 @@
def test_suspend_server_invalid_state(self):
# suspend a suspended server.
resp, _ = self.client.suspend_server(self.server_id)
+ self.addCleanup(self.client.resume_server,
+ self.server_id)
self.assertEqual(202, resp.status)
self.client.wait_for_server_status(self.server_id, 'SUSPENDED')
- self.assertRaises(exceptions.Duplicate,
+ self.assertRaises(exceptions.Conflict,
self.client.suspend_server,
self.server_id)
@@ -348,7 +347,7 @@
@attr(type=['negative', 'gate'])
def test_resume_server_invalid_state(self):
# resume an active server.
- self.assertRaises(exceptions.Duplicate,
+ self.assertRaises(exceptions.Conflict,
self.client.resume_server,
self.server_id)
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..bb8b372 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'
diff --git a/tempest/api/compute/test_quotas.py b/tempest/api/compute/test_quotas.py
index 6453cf4..4617bd2 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
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_roles.py b/tempest/api/identity/admin/test_roles.py
index 690d14f..543cd91 100644
--- a/tempest/api/identity/admin/test_roles.py
+++ b/tempest/api/identity/admin/test_roles.py
@@ -103,7 +103,7 @@
self.assertIn('status', resp)
self.assertTrue(resp['status'].startswith('2'))
self.addCleanup(self.client.delete_role, role1_id)
- self.assertRaises(exceptions.Duplicate, self.client.create_role,
+ self.assertRaises(exceptions.Conflict, self.client.create_role,
role_name)
@attr(type='gate')
@@ -160,7 +160,7 @@
# Duplicate user role should not get assigned
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
- self.assertRaises(exceptions.Duplicate, self.client.assign_user_role,
+ self.assertRaises(exceptions.Conflict, self.client.assign_user_role,
tenant['id'], user['id'], role['id'])
@attr(type='gate')
diff --git a/tempest/api/identity/admin/test_tenant_negative.py b/tempest/api/identity/admin/test_tenant_negative.py
index 6875bf5..d10080b 100644
--- a/tempest/api/identity/admin/test_tenant_negative.py
+++ b/tempest/api/identity/admin/test_tenant_negative.py
@@ -81,7 +81,7 @@
self.addCleanup(self.client.delete_tenant, tenant1_id)
self.addCleanup(self.data.tenants.remove, tenant)
- self.assertRaises(exceptions.Duplicate, self.client.create_tenant,
+ self.assertRaises(exceptions.Conflict, self.client.create_tenant,
tenant_name)
@attr(type=['negative', 'gate'])
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/identity/admin/test_users_negative.py b/tempest/api/identity/admin/test_users_negative.py
index 7cb9aef..b29d155 100644
--- a/tempest/api/identity/admin/test_users_negative.py
+++ b/tempest/api/identity/admin/test_users_negative.py
@@ -63,7 +63,7 @@
def test_create_user_with_duplicate_name(self):
# Duplicate user should not be created
self.data.setup_test_user()
- self.assertRaises(exceptions.Duplicate, self.client.create_user,
+ self.assertRaises(exceptions.Conflict, self.client.create_user,
self.data.test_user, self.data.test_password,
self.data.tenant['id'], self.data.test_email)
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index 36ced70..ef9814a 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -212,7 +212,7 @@
self.v3data.projects.append(project)
self.assertRaises(
- exceptions.Duplicate, self.v3_client.create_project, project_name)
+ exceptions.Conflict, self.v3_client.create_project, project_name)
@attr(type=['negative', 'gate'])
def test_create_project_by_unauthorized_user(self):
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index b6c2679..cdb8e17 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -18,6 +18,7 @@
import netaddr
from tempest import clients
+from tempest.common import isolated_creds
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest.openstack.common import log as logging
@@ -51,10 +52,19 @@
@classmethod
def setUpClass(cls):
super(BaseNetworkTest, cls).setUpClass()
- os = clients.Manager(interface=cls._interface)
- cls.network_cfg = os.config.network
+ cls.isolated_creds = isolated_creds.IsolatedCreds(cls.__name__)
if not cls.config.service_available.neutron:
raise cls.skipException("Neutron support is required")
+ 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)
+ cls.network_cfg = os.config.network
cls.client = os.network_client
cls.networks = []
cls.subnets = []
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/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 3e2b6ad..02adc5d 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'}
diff --git a/tempest/cli/simple_read_only/test_neutron.py b/tempest/cli/simple_read_only/test_neutron.py
index 3c266be..9bd07d0 100644
--- a/tempest/cli/simple_read_only/test_neutron.py
+++ b/tempest/cli/simple_read_only/test_neutron.py
@@ -22,6 +22,7 @@
import tempest.cli
from tempest.openstack.common import log as logging
+from tempest import test
CONF = cfg.CONF
@@ -67,9 +68,11 @@
def test_neutron_floatingip_list(self):
self.neutron('floatingip-list')
+ @test.skip_because(bug="1240694")
def test_neutron_meter_label_list(self):
self.neutron('meter-label-list')
+ @test.skip_because(bug="1240694")
def test_neutron_meter_label_rule_list(self):
self.neutron('meter-label-rule-list')
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/rest_client.py b/tempest/common/rest_client.py
index 4b5127a..9322f1b 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -488,7 +488,7 @@
if resp.status == 409:
if parse_resp:
resp_body = self._parse_resp(resp_body)
- raise exceptions.Duplicate(resp_body)
+ raise exceptions.Conflict(resp_body)
if resp.status == 413:
if parse_resp:
@@ -519,7 +519,7 @@
elif 'message' in resp_body:
message = resp_body['message']
- raise exceptions.ComputeFault(message)
+ raise exceptions.ServerFault(message)
if resp.status >= 400:
if parse_resp:
diff --git a/tempest/common/utils/data_utils.py b/tempest/common/utils/data_utils.py
index bbba235..3ab8fe0 100644
--- a/tempest/common/utils/data_utils.py
+++ b/tempest/common/utils/data_utils.py
@@ -24,7 +24,7 @@
def rand_name(name='test'):
- return name + str(random.randint(1, 0x7fffffff))
+ return name + "-tempest-" + str(random.randint(1, 0x7fffffff))
def rand_int_id(start=0, end=0x7fffffff):
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 158a216..8d05fd8 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -129,8 +129,8 @@
message = "Quota exceeded"
-class ComputeFault(TempestException):
- message = "Got compute fault"
+class ServerFault(TempestException):
+ message = "Got server fault"
class ImageFault(TempestException):
@@ -141,7 +141,7 @@
message = "Got identity error"
-class Duplicate(RestClientException):
+class Conflict(RestClientException):
message = "An object with that identifier already exists"
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/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/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/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/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)