@@ -77,10 +77,6 @@ def setUp(self):
7777 self .mock_dd_lambda_layer_tag = patcher .start ()
7878 self .addCleanup (patcher .stop )
7979
80- patcher = patch ("datadog_lambda.wrapper.set_dsm_context" )
81- self .mock_set_dsm_context = patcher .start ()
82- self .addCleanup (patcher .stop )
83-
8480 @patch ("datadog_lambda.config.Config.trace_enabled" , False )
8581 def test_datadog_lambda_wrapper (self ):
8682 @wrapper .datadog_lambda_wrapper
@@ -562,62 +558,6 @@ def return_type_test(event, context):
562558 self .assertEqual (result , test_result )
563559 self .assertFalse (MockPrintExc .called )
564560
565- def test_set_dsm_context_called_when_DSM_and_tracing_enabled (self ):
566- os .environ ["DD_DATA_STREAMS_ENABLED" ] = "true"
567- os .environ ["DD_TRACE_ENABLED" ] = "true"
568-
569- @wrapper .datadog_lambda_wrapper
570- def lambda_handler (event , context ):
571- return "ok"
572-
573- result = lambda_handler ({}, get_mock_context ())
574- self .assertEqual (result , "ok" )
575- self .mock_set_dsm_context .assert_called_once ()
576-
577- del os .environ ["DD_DATA_STREAMS_ENABLED" ]
578-
579- def test_set_dsm_context_not_called_when_only_DSM_enabled (self ):
580- os .environ ["DD_DATA_STREAMS_ENABLED" ] = "true"
581- os .environ ["DD_TRACE_ENABLED" ] = "false"
582-
583- @wrapper .datadog_lambda_wrapper
584- def lambda_handler (event , context ):
585- return "ok"
586-
587- result = lambda_handler ({}, get_mock_context ())
588- self .assertEqual (result , "ok" )
589- self .mock_set_dsm_context .assert_not_called ()
590-
591- del os .environ ["DD_DATA_STREAMS_ENABLED" ]
592-
593- def test_set_dsm_context_not_called_when_only_tracing_enabled (self ):
594- os .environ ["DD_DATA_STREAMS_ENABLED" ] = "false"
595- os .environ ["DD_TRACE_ENABLED" ] = "true"
596-
597- @wrapper .datadog_lambda_wrapper
598- def lambda_handler (event , context ):
599- return "ok"
600-
601- result = lambda_handler ({}, get_mock_context ())
602- self .assertEqual (result , "ok" )
603- self .mock_set_dsm_context .assert_not_called ()
604-
605- del os .environ ["DD_DATA_STREAMS_ENABLED" ]
606-
607- def test_set_dsm_context_not_called_when_tracing_and_DSM_disabled (self ):
608- os .environ ["DD_DATA_STREAMS_ENABLED" ] = "false"
609- os .environ ["DD_TRACE_ENABLED" ] = "false"
610-
611- @wrapper .datadog_lambda_wrapper
612- def lambda_handler (event , context ):
613- return "ok"
614-
615- result = lambda_handler ({}, get_mock_context ())
616- self .assertEqual (result , "ok" )
617- self .mock_set_dsm_context .assert_not_called ()
618-
619- del os .environ ["DD_DATA_STREAMS_ENABLED" ]
620-
621561
622562class TestLambdaWrapperWithTraceContext (unittest .TestCase ):
623563 xray_root = "1-5e272390-8c398be037738dc042009320"
0 commit comments