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 )