8000 Ensure the bucket is empty before deletion · localstack/localstack@839ff1e · GitHub
[go: up one dir, main page]

Skip to content

Commit 839ff1e

Browse files
committed
Ensure the bucket is empty before deletion
1 parent 997a9d1 commit 839ff1e

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

tests/aws/services/lambda_/event_source_mapping/test_cfn_resource.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55

66
from localstack.testing.pytest import markers
7+
from localstack.testing.scenario.provisioning import cleanup_s3_bucket
78
from localstack.utils.strings import short_uid
89
from localstack.utils.sync import retry
910
from tests.aws.services.lambda_.event_source_mapping.utils import is_old_esm
@@ -18,7 +19,7 @@
1819
"$..Tags.'aws:cloudformation:stack-name'",
1920
]
2021
)
21-
def test_adding_tags(deploy_cfn_template, aws_client, snapshot):
22+
def test_adding_tags(deploy_cfn_template, aws_client, snapshot, cleanups):
2223
template_path = os.path.join(
2324
os.path.join(os.path.dirname(__file__), "../../../templates/event_source_mapping_tags.yml")
2425
)
@@ -29,6 +30,9 @@ def test_adding_tags(deploy_cfn_template, aws_client, snapshot):
2930
template_path=template_path,
3031
parameters={"OutputKey": output_key},
3132
)
33+
# ensure the S3 bucket is empty so we can delete it
34+
cleanups.append(lambda: cleanup_s3_bucket(aws_client.s3, stack.outputs["OutputBucketName"]))
35+
3236
snapshot.add_transformer(snapshot.transform.regex(stack.stack_id, "<stack-id>"))
3337
snapshot.add_transformer(snapshot.transform.regex(stack.stack_name, "<stack-name>"))
3438

tests/aws/services/lambda_/event_source_mapping/test_cfn_resource.snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"tests/aws/services/lambda_/event_source_mapping/test_cfn_resource.py::test_adding_tags": {
3-
"recorded-date": "05-11-2024, 21:35:12",
3+
"recorded-date": "06-11-2024, 11:55:29",
44
"recorded-content": {
55
"event-source-mapping-tags": {
66
"Tags": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"tests/aws/services/lambda_/event_source_mapping/test_cfn_resource.py::test_adding_tags": {
3-
"last_validated_date": "2024-11-05T21:35:12+00:00"
3+
"last_validated_date": "2024-11-06T11:55:29+00:00"
44
}
55
}

0 commit comments

Comments
 (0)
0