From 6fe5230a34662c461a5d86a0b84abb80cc02da07 Mon Sep 17 00:00:00 2001 From: ricolin Date: Thu, 12 Nov 2020 22:22:06 +0800 Subject: Add more information for tests Change-Id: Id0b1056398e1b186a336eec4244c446b5767e1a0 --- heat_integrationtests/common/test.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'heat_integrationtests') diff --git a/heat_integrationtests/common/test.py b/heat_integrationtests/common/test.py index 6c330a23d..7381eacbd 100644 --- a/heat_integrationtests/common/test.py +++ b/heat_integrationtests/common/test.py @@ -164,9 +164,15 @@ class HeatIntegrationTest(testscenarios.WithScenarios, self.keypair = self.create_keypair() self.keypair_name = self.keypair.id - @classmethod - def _stack_rand_name(cls): - return rand_name(cls.__name__) + def _stack_rand_name(self): + test_name = self.id() + if test_name and '.' in test_name: + name = '-'.join(test_name.split('.')[-2:]) + # remove 'testname(...)' cases + name = name.split('(')[0] + else: + name = self.__name__ + return rand_name(name) def _get_network(self, net_name=None): if net_name is None: @@ -228,7 +234,7 @@ class HeatIntegrationTest(testscenarios.WithScenarios, fail_regexp = re.compile(failure_pattern) build_timeout = self.conf.build_timeout build_interval = self.conf.build_interval - + res = None start = timeutils.utcnow() while timeutils.delta_seconds(start, timeutils.utcnow()) < build_timeout: @@ -254,9 +260,11 @@ class HeatIntegrationTest(testscenarios.WithScenarios, resource_status_reason=res.resource_status_reason) time.sleep(build_interval) - message = ('Resource %s failed to reach %s status within ' - 'the required time (%s s).' % - (resource_name, status, build_timeout)) + message = ('Resource %s from stack %s failed to reach %s status ' + 'within the required time (%s s). Current resource ' + 'status: %s.' % + (resource_name, stack_identifier, status, build_timeout, + res.resource_status)) raise exceptions.TimeoutException(message) def verify_resource_status(self, stack_identifier, resource_name, @@ -352,8 +360,9 @@ class HeatIntegrationTest(testscenarios.WithScenarios, time.sleep(build_interval) message = ('Stack %s failed to reach %s status within ' - 'the required time (%s s).' % - (stack_identifier, status, build_timeout)) + 'the required time (%s s). Current stack state: %s.' % + (stack_identifier, status, build_timeout, + stack.stack_status)) raise exceptions.TimeoutException(message) def _stack_delete(self, stack_identifier): -- cgit v1.2.1