Fix InvalidInstanceID.NotFound handling
The matcher used with boto tests is returing with None,
when it matches. The incorrect condition handling may lead to
longer deletion time or failure.
Change-Id: I7d03528ab6183dd9a49169c0a6ec2a4a95fb7d52
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index b36e8c7..b0be74e 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -109,6 +109,9 @@
CODE_RE = '.*' # regexp makes sense in group match
def match(self, exc):
+ """:returns: Retruns with an error string if not matches,
+ returns with None when matches.
+ """
if not isinstance(exc, exception.BotoServerError):
return "%r not an BotoServerError instance" % exc
LOG.info("Status: %s , error_code: %s", exc.status, exc.error_code)
@@ -120,6 +123,7 @@
return ("Error code (%s) does not match" +
"the expected re pattern \"%s\"") %\
(exc.error_code, self.CODE_RE)
+ return None
class ClientError(BotoExceptionMatcher):
@@ -314,7 +318,7 @@
except ValueError:
return "_GONE"
except exception.EC2ResponseError as exc:
- if colusure_matcher.match(exc):
+ if colusure_matcher.match(exc) is None:
return "_GONE"
else:
raise
@@ -450,7 +454,7 @@
return "_GONE"
except exception.EC2ResponseError as exc:
if cls.ec2_error_code.\
- client.InvalidInstanceID.NotFound.match(exc):
+ client.InvalidInstanceID.NotFound.match(exc) is None:
return "_GONE"
# NOTE(afazekas): incorrect code,
# but the resource must be destoreyd