From aae673a5e9ba24c572ec7e900b8cca1495846761 Mon Sep 17 00:00:00 2001 From: Maximilian Hoheiser Date: Tue, 7 May 2024 12:45:39 +0200 Subject: [PATCH] feat: update test markers --- tests/aws/services/events/test_events.py | 2 +- .../events/test_events_integrations.py | 21 +++++++++++++------ .../test_events_integrations.snapshot.json | 15 +++++++++++++ .../test_events_integrations.validation.json | 2 +- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/tests/aws/services/events/test_events.py b/tests/aws/services/events/test_events.py index 865966378d057..6b3c8ee9ec244 100644 --- a/tests/aws/services/events/test_events.py +++ b/tests/aws/services/events/test_events.py @@ -651,7 +651,7 @@ def test_list_event_buses_with_limit(self, create_event_bus, aws_client, snapsho ) snapshot.match("list-event-buses-limit-next-token", response) - @markers.aws.unknown + @markers.aws.needs_fixing # TODO use fixture setup_sqs_queue_as_event_target to simplify @pytest.mark.skipif(is_aws_cloud(), reason="not validated") @pytest.mark.parametrize("strategy", ["standard", "domain", "path"]) def test_put_events_into_event_bus( diff --git a/tests/aws/services/events/test_events_integrations.py b/tests/aws/services/events/test_events_integrations.py index 6fe71f709d10a..9c8659322d498 100644 --- a/tests/aws/services/events/test_events_integrations.py +++ b/tests/aws/services/events/test_events_integrations.py @@ -83,8 +83,9 @@ def test_put_events_with_target_sqs_new_region(aws_client_factory): assert "EventId" in response.get("Entries")[0] -@markers.aws.unknown -def test_put_events_with_target_sqs_event_detail_match(put_events_with_filter_to_sqs): +@markers.aws.validated +@pytest.mark.skipif(is_v2_provider(), reason="V2 provider does not support this feature yet") +def test_put_events_with_target_sqs_event_detail_match(put_events_with_filter_to_sqs, snapshot): entries1 = [ { "Source": TEST_EVENT_PATTERN["source"][0], @@ -100,17 +101,25 @@ def test_put_events_with_target_sqs_event_detail_match(put_events_with_filter_to } ] entries_asserts = [(entries1, True), (entries2, False)] - put_events_with_filter_to_sqs( + messages = put_events_with_filter_to_sqs( pattern={"detail": {"EventType": ["0", "1"]}}, entries_asserts=entries_asserts, input_path="$.detail", ) + snapshot.add_transformers_list( + [ + snapshot.transform.key_value("ReceiptHandle", reference_replacement=False), + snapshot.transform.key_value("MD5OfBody", reference_replacement=False), + ], + ) + snapshot.match("messages", messages) + # TODO: further unify/parameterize the tests for the different target types below -@markers.aws.unknown +@markers.aws.needs_fixing @pytest.mark.parametrize("strategy", ["standard", "domain", "path"]) def test_put_events_with_target_sns( monkeypatch, @@ -179,7 +188,7 @@ def test_put_events_with_target_sns( ) -@markers.aws.unknown +@markers.aws.needs_fixing def test_put_events_with_target_lambda(create_lambda_function, cleanups, aws_client, clean_up): rule_name = f"rule-{short_uid()}" function_name = f"lambda-func-{short_uid()}" @@ -484,7 +493,7 @@ def check_invocation(): retry(check_invocation, sleep=5, retries=15) -@markers.aws.unknown +@markers.aws.needs_fixing def test_put_events_with_target_firehose(aws_client, clean_up): s3_bucket = "s3-{}".format(short_uid()) s3_prefix = "testeventdata" diff --git a/tests/aws/services/events/test_events_integrations.snapshot.json b/tests/aws/services/events/test_events_integrations.snapshot.json index 9a4c20d2f2db9..e27cdb2a10e9e 100644 --- a/tests/aws/services/events/test_events_integrations.snapshot.json +++ b/tests/aws/services/events/test_events_integrations.snapshot.json @@ -129,5 +129,20 @@ } ] } + }, + "tests/aws/services/events/test_events_integrations.py::test_put_events_with_target_sqs_event_detail_match": { + "recorded-date": "07-05-2024, 10:40:38", + "recorded-content": { + "messages": [ + { + "MessageId": "", + "ReceiptHandle": "receipt-handle", + "MD5OfBody": "m-d5-of-body", + "Body": { + "EventType": "1" + } + } + ] + } } } diff --git a/tests/aws/services/events/test_events_integrations.validation.json b/tests/aws/services/events/test_events_integrations.validation.json index 7de094e66181b..bf2860707799f 100644 --- a/tests/aws/services/events/test_events_integrations.validation.json +++ b/tests/aws/services/events/test_events_integrations.validation.json @@ -9,7 +9,7 @@ "last_validated_date": "2024-04-26T08:43:27+00:00" }, "tests/aws/services/events/test_events_integrations.py::test_put_events_with_target_sqs_event_detail_match": { - "last_validated_date": "2024-03-26T15:50:07+00:00" + "last_validated_date": "2024-05-07T10:40:38+00:00" }, "tests/aws/services/events/test_events_integrations.py::test_should_ignore_schedules_for_put_event": { "last_validated_date": "2024-03-26T15:51:47+00:00"