8000 Fix Lambda CI log pollution issues (#13546) · localstack/localstack@056da83 · GitHub
[go: up one dir, main page]

Skip to content

Commit 056da83

Browse files
authored
Fix Lambda CI log pollution issues (#13546)
1 parent 35f78d8 commit 056da83

File tree

4 files changed

+54
-58
lines changed

4 files changed

+54
-58
lines changed

localstack-core/localstack/testing/pytest/fixtures.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,8 +1547,10 @@ def _create_event_source_mapping(*args, **kwargs):
15471547
for uuid in uuids:
15481548
try:
15491549
aws_client.lambda_.delete_event_source_mapping(UUID=uuid)
1550-
except Exception:
1551-
LOG.debug("Unable to delete event source mapping %s in cleanup", uuid)
1550+
except aws_client.lambda_.exceptions.ResourceNotFoundException:
1551+
pass
1552+
except Exception as ex:
1553+
LOG.debug("Unable to delete event source mapping %s in cleanup: %s", uuid, ex)
15521554

15531555

15541556
@pytest.fixture

tests/aws/services/lambda_/test_lambda_api.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ def test_create_deprecated_function_runtime_with_validation_disabled(
104104
func_name=function_name,
105105
runtime=Runtime.python3_7,
106106
role=lambda_su_role,
107-
MemorySize=256,
108-
Timeout=5,
109-
LoggingConfig={
110-
"LogFormat": LogFormat.JSON,
111-
},
112107
)
113108

114109
@markers.aws.validated
@@ -128,11 +123,6 @@ def test_create_deprecated_function_runtime_with_validation_enabled(
128123
func_name=function_name,
129124
runtime=runtime,
130125
role=lambda_su_role,
131-
MemorySize=256,
132-
Timeout=5,
133-
LoggingConfig={
134-
"LogFormat": LogFormat.JSON,
135-
},
136126
)
137127
snapshot.match("deprecation_error", e.value.response)
138128

@@ -5563,6 +5553,7 @@ def test_event_source_mapping_exceptions(
55635553
def test_event_source_mapping_lifecycle_delete_function(
55645554
self,
55655555
create_lambda_function,
5556+
create_event_source_mapping,
55665557
snapshot,
55675558
sqs_create_queue,
55685559
cleanups,
@@ -5594,7 +5585,7 @@ def test_event_source_mapping_lifecycle_delete_function(
55945585
role=lambda_su_role,
55955586
)
55965587
# "minimal"
5597-
create_response = aws_client.lambda_.create_event_source_mapping(
5588+
create_response = create_event_source_mapping(
55985589
FunctionName=function_name,
55995590
EventSourceArn=stream_arn,
56005591
DestinationConfig={"OnFailure": {"Destination": destination_queue_arn}},
@@ -5605,7 +5596,6 @@ def test_event_source_mapping_lifecycle_delete_function(
56055596
)
56065597

56075598
uuid = create_response["UUID"]
5608-
cleanups.append(lambda: aws_client.lambda_.delete_event_source_mapping(UUID=uuid))
56095599
snapshot.match("create_response", create_response)
56105600

56115601
# the stream might not be active immediately(!)
@@ -5626,7 +5616,7 @@ def _assert_function_deleted():
56265616

56275617
get_response_post_delete = aws_client.lambda_.get_event_source_mapping(UUID=uuid)
56285618
snapshot.match("get_response_post_delete", get_response_post_delete)
5629-
#
5619+
56305620
delete_response = aws_client.lambda_.delete_event_source_mapping(UUID=uuid)
56315621
snapshot.match("delete_response", delete_response)
56325622

@@ -5869,6 +5859,7 @@ def test_create_event_filter_criteria_validation(
58695859
create_lambda_function,
58705860
lambda_su_role,
58715861
dynamodb_create_table,
5862+
create_ev 6D40 ent_source_mapping,
58725863
snapshot,
58735864
aws_client,
58745865
):
@@ -5891,14 +5882,17 @@ def test_create_event_filter_criteria_validation(
58915882
StreamSpecification={"StreamEnabled": True, "StreamViewType": "NEW_AND_OLD_IMAGES"},
58925883
)
58935884
stream_arn = update_table_response["TableDescription"]["LatestStreamArn"]
5885+
_await_dynamodb_table_active(aws_client.dynamodb, table_name)
58945886

5895-
response = aws_client.lambda_.create_event_source_mapping(
5887+
response = create_event_source_mapping(
58965888
FunctionName=function_name,
58975889
EventSourceArn=stream_arn,
58985890
StartingPosition="LATEST",
58995891
FilterCriteria={"Filters": []},
59005892
)
59015893
snapshot.match("response-with-empty-filters", response)
5894+
# Wait until ESM is enabled to mitigate cleanup failure
5895+
_await_event_source_mapping_enabled(aws_client.lambda_, response["UUID"])
59025896

59035897
with pytest.raises(ParamValidationError):
59045898
aws_client.lambda_.create_event_source_mapping(

tests/aws/services/lambda_/test_lambda_api.snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17872,7 +17872,7 @@
1787217872
}
1787317873
},
1787417874
"tests/aws/services/lambda_/test_lambda_api.py::TestLambdaEventSourceMappings::test_create_event_filter_criteria_validation": {
17875-
"recorded-date": "25-11-2025, 02:48:23",
17875+
"recorded-date": "18-12-2025, 15:04:51",
1787617876
"recorded-content": {
1787717877
"response-with-empty-filters": {
1787817878
"BatchSize": 100,

tests/aws/services/lambda_/test_lambda_api.validation.json

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@
108108
}
109109
},
110110
"tests/aws/services/lambda_/test_lambda_api.py::TestLambdaEventSourceMappings::test_create_event_filter_criteria_validation": {
111-
"last_validated_date": "2025-11-25T02:48:23+00:00",
111+
"last_validated_date": "2025-12-18T15:07:44+00:00",
112112
"durations_in_seconds": {
113-
"setup": 0.01,
114-
"call": 10.92,
115-
"teardown": 2.08,
116-
"total": 13.01
113+
"setup": 12.13,
114+
"call": 22.59,
115+
"teardown": 2.65,
116+
"total": 37.37
117117
}
118118
},
119119
"tests/aws/services/lambda_/test_lambda_api.py::TestLambdaEventSourceMappings::test_create_event_source_self_managed": {
@@ -1935,75 +1935,75 @@
19351935
}
19361936
},
19371937
"tests/aws/services/lambda_/test_lambda_api.py::TestRuntimeValidation::test_create_deprecated_function_runtime_with_validation_enabled[dotnetcore3.1]": {
1938-
"last_validated_date": "2025-11-25T02:26:09+00:00",
1938+
"last_validated_date": "2025-12-18T15:11:17+00:00",
19391939
"durations_in_seconds": {
19401940
"setup": 0.0,
1941-
"call": 0.16,
1942-
"teardown": 0.01,
1943-
"total": 0.17
1941+
"call": 0.27,
1942+
"teardown": 0.0,
1943+
"total": 0.27
19441944
}
19451945
},
19461946
"tests/aws/services/lambda_/test_lambda_api.py::TestRuntimeValidation::test_create_deprecated_function_runtime_with_validation_enabled[go1.x]": {
1947-
"last_validated_date": "2025-11-25T02:26:08+00:00",
1947+
"last_validated_date": "2025-12-18T15:11:16+00:00",
19481948
"durations_in_seconds": {
1949-
"setup": 0.0,
1950-
"call": 0.14,
1951-
"teardown": 0.01,
1952-
"total": 0.15
1949+
"setup": 0.01,
1950+
"call": 0.26,
1951+
"teardown": 0.0,
1952+
"total": 0.27
19531953
}
19541954
},
19551955
"tests/aws/services/lambda_/test_lambda_api.py::TestRuntimeValidation::test_create_deprecated_function_runtime_with_validation_enabled[java8]": {
1956-
"last_validated_date": "2025-11-25T02:26:08+00:00",
1956+
"last_validated_date": "2025-12-18T15:11:15+00:00",
19571957
"durations_in_seconds": {
1958-
"setup": 11.1,
1959-
"call": 0.37,
1960-
"teardown": 0.01,
1961-
"total": 11.48
1958+
"setup": 12.15,
1959+
"call": 0.71,
1960+
"teardown": 0.0,
1961+
"total": 12.86
19621962
}
19631963
},
19641964
"tests/aws/services/lambda_/test_lambda_api.py::TestRuntimeValidation::test_create_deprecated_function_runtime_with_validation_enabled[nodejs12.x]": {
1965-
"last_validated_date": "2025-11-25T02:26:09+00:00",
1965+
"last_validated_date": "2025-12-18T15:11:18+00:00",
19661966
"durations_in_seconds": {
1967-
"setup": 0.0,
1968-
"call": 0.16,
1969-
"teardown": 0.01,
1970-
"total": 0.17
1967+
"setup": 0.01,
1968+
"call": 0.29,
1969+
"teardown": 0.76,
1970+
"total": 1.06
19711971
}
19721972
},
19731973
"tests/aws/services/lambda_/test_lambda_api.py::TestRuntimeValidation::test_create_deprecated_function_runtime_with_validation_enabled[nodejs14.x]": {
1974-
"last_validated_date": "2025-11-25T02:26:08+00:00",
1974+
"last_validated_date": "2025-12-18T15:11:17+00:00",
19751975
"durations_in_seconds": {
19761976
"setup": 0.0,
1977-
"call": 0.18,
1978-
"teardown": 0.01,
1979-
"total": 0.19
1977+
"call": 0.28,
1978+
"teardown": 0.0,
1979+
"total": 0.28
19801980
}
19811981
},
19821982
"tests/aws/services/lambda_/test_lambda_api.py::TestRuntimeValidation::test_create_deprecated_function_runtime_with_validation_enabled[provided]": {
1983-
"last_validated_date": "2025-11-25T02:26:08+00:00",
1983+
"last_validated_date": "2025-12-18T15:11:16+00:00",
19841984
"durations_in_seconds": {
19851985
"setup": 0.0,
1986-
"call": 0.14,
1987-
"teardown": 0.01,
1988-
"total": 0.15
1986+
"call": 0.27,
1987+
"teardown": 0.0,
1988+
"total": 0.27
19891989
}
19901990
},
19911991
"tests/aws/services/lambda_/test_lambda_api.py::TestRuntimeValidation::test_create_deprecated_function_runtime_with_validation_enabled[python3.7]": {
1992-
"last_validated_date": "2025-11-25T02:26:09+00:00",
1992+
"last_validated_date": "2025-12-18T15:11:17+00:00",
19931993
"durations_in_seconds": {
1994-
"setup": 0.0,
1995-
"call": 0.17,
1996-
"teardown": 0.01,
1997-
"total": 0.18
1994+
"setup": 0.01,
1995+
"call": 0.27,
1996+
"teardown": 0.0,
1997+
"total": 0.28
19981998
}
19991999
},
20002000
"tests/aws/services/lambda_/test_lambda_api.py::TestRuntimeValidation::test_create_deprecated_function_runtime_with_validation_enabled[ruby2.7]": {
2001-
"last_validated_date": "2025-11-25T02:26:08+00:00",
2001+
"last_validated_date": "2025-12-18T15:11:16+00:00",
20022002
"durations_in_seconds": {
20032003
"setup": 0.0,
2004-
"call": 0.16,
2005-
"teardown": 0.01,
2006-
"total": 0.17
2004+
"call": 0.27,
2005+
"teardown": 0.0,
2006+
"total": 0.27
20072007
}
20082008
}
20092009
}

0 commit comments

Comments
 (0)
0