Cleanup exceptions
There are some invalid usages about exceptions. They put some invalid
error messages to the log like this.
--------------------------
BuildErrorException: Server %(server_id)s failed to build and is in
ERROR status)
--------------------------
This commit fixes them.
NOTE: 'RateLimitExceeded' is only used in tempest/common/rest_client.py.
This was refactored in I6c38c343618f92e0e79843aaa662a3d24026702b . But
the class was not. And the last usage of 'SQLException' was removed in
I0fac7b030c51985f9d6d93129bf9bab75c18cd11 . But the class was not.
Change-Id: I1477e093a56210c0c9a65fa32900c2c0b876d9a4
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 81ebd4b..3596da0 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -274,13 +274,15 @@
elif resp.status == 401:
raise exceptions.AuthenticationFailure(user=user,
- password=password)
+ password=password,
+ tenant=project_name)
else:
self.LOG.error("Failed to obtain token using V3 authentication"
" (auth URL is '%s'), the response status is %s" %
(req_url, resp.status))
raise exceptions.AuthenticationFailure(user=user,
- password=password)
+ password=password,
+ tenant=project_name)
def expected_success(self, expected_code, read_code):
assert_msg = ("This function only allowed to use for HTTP status"
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 809037d..3b3f3eb 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -123,8 +123,7 @@
class RateLimitExceeded(TempestException):
- message = ("Rate limit exceeded.\nMessage: %(message)s\n"
- "Details: %(details)s")
+ message = "Rate limit exceeded"
class OverLimit(TempestException):
@@ -162,10 +161,6 @@
message = "The server is not reachable via the configured network"
-class SQLException(TempestException):
- message = "SQL error: %(message)s"
-
-
class TearDownException(TempestException):
message = "%(num)d cleanUp operation failed"
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 04882f3..652ced6 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -394,7 +394,8 @@
if new_status.lower() == error_status.lower():
message = ("%s failed to get to expected status. "
"In %s state.") % (thing, new_status)
- raise exceptions.BuildErrorException(message)
+ raise exceptions.BuildErrorException(message,
+ server_id=thing_id)
elif new_status == expected_status and expected_status is not None:
return True # All good.
LOG.debug("Waiting for %s to get to %s status. "
diff --git a/tempest/services/compute/xml/servers_client.py b/tempest/services/compute/xml/servers_client.py
index 63492b7..6d0339b 100644
--- a/tempest/services/compute/xml/servers_client.py
+++ b/tempest/services/compute/xml/servers_client.py
@@ -379,7 +379,7 @@
server_status = body['status']
if server_status == 'ERROR' and not ignore_error:
- raise exceptions.BuildErrorException
+ raise exceptions.BuildErrorException(server_id=server_id)
if int(time.time()) - start_time >= self.build_timeout:
raise exceptions.TimeoutException