Merge "Add a skip for meter-label cli tests"
diff --git a/tempest/api/compute/admin/test_flavors_access.py b/tempest/api/compute/admin/test_flavors_access.py
index 8213839..5495778 100644
--- a/tempest/api/compute/admin/test_flavors_access.py
+++ b/tempest/api/compute/admin/test_flavors_access.py
@@ -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/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index bb04f1d..accfc35 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -158,7 +158,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/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 807315a..9b2a1de 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -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/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 82559d5..3cbae56 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -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_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 7062a3b..d2088fa 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -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/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_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/test_security_groups.py b/tempest/api/network/test_security_groups.py
index 914dcff..9218f0c 100644
--- a/tempest/api/network/test_security_groups.py
+++ b/tempest/api/network/test_security_groups.py
@@ -17,7 +17,6 @@
from tempest.api.network import base
from tempest.common.utils import data_utils
-from tempest import exceptions
from tempest.test import attr
@@ -124,19 +123,6 @@
for rule in rule_list_body['security_group_rules']]
self.assertIn(rule_create_body['security_group_rule']['id'], rule_list)
- @attr(type=['negative', 'smoke'])
- def test_show_non_existent_security_group(self):
- non_exist_id = data_utils.rand_name('secgroup-')
- self.assertRaises(exceptions.NotFound, self.client.show_security_group,
- non_exist_id)
-
- @attr(type=['negative', 'smoke'])
- def test_show_non_existent_security_group_rule(self):
- non_exist_id = data_utils.rand_name('rule-')
- self.assertRaises(exceptions.NotFound,
- self.client.show_security_group_rule,
- non_exist_id)
-
class SecGroupTestXML(SecGroupTest):
_interface = 'xml'
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
new file mode 100644
index 0000000..d321e23
--- /dev/null
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -0,0 +1,42 @@
+# 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 tempest.api.network import test_security_groups as base
+from tempest import exceptions
+from tempest.test import attr
+import uuid
+
+
+class NegativeSecGroupTest(base.SecGroupTest):
+ _interface = 'json'
+
+ @attr(type=['negative', 'smoke'])
+ def test_show_non_existent_security_group(self):
+ non_exist_id = str(uuid.uuid4())
+ self.assertRaises(exceptions.NotFound, self.client.show_security_group,
+ non_exist_id)
+
+ @attr(type=['negative', 'smoke'])
+ def test_show_non_existent_security_group_rule(self):
+ non_exist_id = str(uuid.uuid4())
+ self.assertRaises(exceptions.NotFound,
+ self.client.show_security_group_rule,
+ non_exist_id)
+
+
+class NegativeSecGroupTestXML(NegativeSecGroupTest):
+ _interface = 'xml'
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"