Skip to content

Commit 53b9cb1

Browse files
authored
Merge branch 'develop' into dependabot/pip/develop/click-8.3.1
2 parents 6260eeb + 20b8404 commit 53b9cb1

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

tests/integration/pipeline/base.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,32 @@ def setUp(self):
6565
super().setUp()
6666
shutil.rmtree(os.path.join(os.getcwd(), ".aws-sam", "pipeline"), ignore_errors=True)
6767

68+
# Max time in seconds to wait for each stack deletion to complete
69+
STACK_DELETE_TIMEOUT_SECONDS = 180
70+
6871
def tearDown(self):
6972
for stack_name in self.stack_names:
7073
self._cleanup_s3_buckets(stack_name)
7174
self.cf_client.delete_stack(StackName=stack_name)
75+
self._wait_for_stack_deletions()
7276
shutil.rmtree(os.path.join(os.getcwd(), ".aws-sam", "pipeline"), ignore_errors=True)
7377
super().tearDown()
7478

79+
def _wait_for_stack_deletions(self):
80+
"""Wait for all stack deletions to complete so subsequent runs don't collide."""
81+
waiter = self.cf_client.get_waiter("stack_delete_complete")
82+
for stack_name in self.stack_names:
83+
try:
84+
waiter.wait(
85+
StackName=stack_name,
86+
WaiterConfig={
87+
"Delay": 10,
88+
"MaxAttempts": self.STACK_DELETE_TIMEOUT_SECONDS // 10,
89+
},
90+
)
91+
except botocore.exceptions.WaiterError:
92+
logging.warning("Timed out waiting for stack %s to delete", stack_name)
93+
7594
def _cleanup_s3_buckets(self, stack_name):
7695
try:
7796
stack_resources = self.cf_client.describe_stack_resources(StackName=stack_name)

tests/integration/sync/test_sync_build_in_source.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def tearDown(self):
3333
if os.path.isfile(path):
3434
os.remove(path)
3535

36+
# Clear the build cache so reruns re-execute the Makefile and recreate marker files
37+
shutil.rmtree(self.test_data_path.joinpath(".aws-sam"), ignore_errors=True)
38+
3639
@parameterized.expand(
3740
[
3841
(True, True), # build in source
@@ -94,6 +97,9 @@ def tearDown(self):
9497
if os.path.isfile(path):
9598
os.remove(path)
9699

100+
# Clear the build cache so reruns re-execute the Makefile and recreate marker files
101+
shutil.rmtree(Path(self.test_data_path, ".aws-sam"), ignore_errors=True)
102+
97103
@parameterized.expand(
98104
[
99105
(True, True), # build in source

0 commit comments

Comments
 (0)