From 42ddc381146c4c6b7e4a07a7a2261a8c78630a5a Mon Sep 17 00:00:00 2001 From: "chenguang.xu@datadoghq.com" Date: Tue, 5 Nov 2024 10:07:29 -0500 Subject: [PATCH] Tests failure --- aws/logs_monitoring/tests/test_awslogs_handler.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/aws/logs_monitoring/tests/test_awslogs_handler.py b/aws/logs_monitoring/tests/test_awslogs_handler.py index 79b80d25..39e43d4d 100644 --- a/aws/logs_monitoring/tests/test_awslogs_handler.py +++ b/aws/logs_monitoring/tests/test_awslogs_handler.py @@ -96,7 +96,7 @@ def test_awslogs_handler_step_functions_tags_added_properly( { "id": "37199773595581154154810589279545129148442535997644275712", "timestamp": 1668095539607, - "message": '{"id": "1","type": "ExecutionStarted","details": {"input": "{}","inputDetails": {"truncated": "false"},"roleArn": "arn:aws:iam::12345678910:role/service-role/StepFunctions-test-role-a0iurr4pt"},"previous_event_id": "0","event_timestamp": "1716992192441","execution_arn": "arn:aws:states:us-east-1:12345678910:execution:StepFunction1:ccccccc-d1da-4c38-b32c-2b6b07d713fa","redrive_count": "0"}', + "message": '{"id": "1","type": "ExecutionStarted","details": {"input": "{}","inputDetails": {"truncated": "false"},"roleArn": "arn:aws:iam::12345678910:role/service-role/StepFunctions-test-role-a0iurr4pt"},"previous_event_id": "0","event_timestamp": "1716992192441","execution_arn": "arn:aws:states:us-east-1:12345678910:execution:StepFunction3:ccccccc-d1da-4c38-b32c-2b6b07d713fa","redrive_count": "0"}', } ], } @@ -125,13 +125,12 @@ def test_awslogs_handler_step_functions_tags_added_properly( ) self.assertEqual( awslogs_handler.metadata[DD_HOST], - "arn:aws:states:us-east-1:12345678910:stateMachine:StepFunction1", + "arn:aws:states:us-east-1:12345678910:stateMachine:StepFunction3", ) @patch("caching.cloudwatch_log_group_cache.CloudwatchLogGroupTagsCache.__init__") @patch("caching.cloudwatch_log_group_cache.send_forwarder_internal_metrics") - @patch.dict("os.environ", {"DD_STEP_FUNCTIONS_TRACE_ENABLED": "true"}) - def test_awslogs_handler_step_functions_customized_log_group_properly( + def test_awslogs_handler_step_functions_customized_log_group( self, mock_forward_metrics, mock_cache_init, @@ -165,7 +164,7 @@ def test_awslogs_handler_step_functions_customized_log_group_properly( } } context = None - metadata = {"ddsource": "postgresql", "ddtags": "env:dev"} + metadata = {"ddtags": "env:dev"} mock_forward_metrics.side_effect = MagicMock() mock_cache_init.return_value = None cache_layer = CacheLayer("") @@ -175,7 +174,7 @@ def test_awslogs_handler_step_functions_customized_log_group_properly( cache_layer._cloudwatch_log_group_cache.get = MagicMock() awslogs_handler = AwsLogsHandler(context, metadata, cache_layer) - awslogs_handler.handle(eventFromCustomizedLogGroup) + verify_as_json(list(awslogs_handler.handle(eventFromCustomizedLogGroup))) self.assertEqual( awslogs_handler.metadata[DD_SOURCE], AwsEventSource.STEPFUNCTION.value )