Catching new exception while disassociating a disassociated floating ip
Because the response of disassociating floating ip api will be
changed(bug #1129719), so the tempest codes need to be updated synchronically.
Reverted the commit 49e330611319f4096061a92b4fad61a9c482b76f, and add a new
exception UnprocessableEntity.
Change-Id: I2b5944599a86f5805375f0d2d49e4ab38dc05825
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 170a137..c582826 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -338,6 +338,11 @@
return self.check_over_limit(resp_body, method, url, headers, body,
depth, wait)
+ if resp.status == 422:
+ if parse_resp:
+ resp_body = self._parse_resp(resp_body)
+ raise exceptions.UnprocessableEntity(resp_body)
+
if resp.status in (500, 501):
message = resp_body
if parse_resp:
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 577aa13..235a2e7 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -94,6 +94,10 @@
message = "Bad request"
+class UnprocessableEntity(RestClientException):
+ message = "Unprocessable entity"
+
+
class AuthenticationFailure(RestClientException):
message = ("Authentication with user %(user)s and password "
"%(password)s failed")
diff --git a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
index d9f9613..0ff81e1 100644
--- a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
@@ -162,7 +162,8 @@
self.new_server_id)
# Make sure no longer associated with old server
- self.assertRaises((exceptions.NotFound, exceptions.BadRequest),
+ self.assertRaises((exceptions.NotFound,
+ exceptions.UnprocessableEntity),
self.client.disassociate_floating_ip_from_server,
self.floating_ip, self.server_id)