def test_detect_agentless_env_with_lambda(self): assert _in_aws_lambda() assert not _has_aws_lambda_agent_extension() tracer = Tracer() assert isinstance(tracer.writer, LogWriter) tracer.configure(enabled=True) assert isinstance(tracer.writer, LogWriter)
def test_detect_agent_config_with_lambda_extension(self): def mock_os_path_exists(path): return path == "/opt/extensions/datadog-agent" assert _in_aws_lambda() with mock.patch("os.path.exists", side_effect=mock_os_path_exists): assert _has_aws_lambda_agent_extension() tracer = Tracer() assert isinstance(tracer.writer, AgentWriter) assert tracer.writer._sync_mode tracer.configure(enabled=False) assert isinstance(tracer.writer, AgentWriter) assert tracer.writer._sync_mode