Changed the exception name
Here changed the exception name for
http error code 409 from Duplicate to Conflict
and error code 500 from ComputeFault to ServerFault.
Change-Id: Ifbebd8761ac8402308e9d37ec78468c65539ac1a
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 c57dded..d2088fa 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -126,7 +126,7 @@
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)
@@ -314,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)
@@ -333,7 +333,7 @@
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)
@@ -347,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/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/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"