From c85cae58bf2acfd32b6b745d7e218ba8fe05e604 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Tue, 14 Jun 2016 15:09:19 +0200 Subject: [PATCH] Fix test_update_restricted timeouts due to timestamp resolution Updating a stack where the only resource needs replacement but is restricted from being replaced is *very* fast. Since the test framework relies on seeing a change in the updated_time timestamp, which has only 1s resolution, it can easily be missed causing the test to timeout. This adds a 1s sleep between updates that have the same expected status to ensure that the timestamp changes. Change-Id: Ief845a21108e925325b1b3e8f090038ccdf73b8e Closes-Bug: #1554375 Related-Bug: #1583630 --- .../functional/test_update_restricted.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/heat_integrationtests/functional/test_update_restricted.py b/heat_integrationtests/functional/test_update_restricted.py index 1634192125..d406b53e99 100644 --- a/heat_integrationtests/functional/test_update_restricted.py +++ b/heat_integrationtests/functional/test_update_restricted.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import time + from heat_integrationtests.functional import functional_base test_template = { @@ -105,6 +107,9 @@ class UpdateRestrictedStackTest(functional_base.FunctionalTestsBase): self._check_for_restriction_reason(resource_events, reason_replace_restrict)) + # Ensure the timestamp changes, since this will be very quick + time.sleep(1) + # check replace fails - with only 'replace' restricted self.update_stack(stack_identifier, update_template, env_replace_restrict, @@ -139,6 +144,9 @@ class UpdateRestrictedStackTest(functional_base.FunctionalTestsBase): self._check_for_restriction_reason(resource_events, reason_replace_restrict)) + # Ensure the timestamp changes, since this will be very quick + time.sleep(1) + # check replace fails - with only 'replace' restricted self.update_stack(stack_identifier, update_template, env_replace_restrict,