test(langchain): Add text completion test #5740
2 issues
code-review: Found 2 issues (1 high, 1 medium)
High
Test filters for wrong span operation type 'gen_ai.pipeline' instead of 'gen_ai.generate_text' - `tests/integrations/langchain/test_langchain.py:155-158`
The test filters spans by op == "gen_ai.pipeline" but the LangchainIntegration creates text completion spans with op=OP.GEN_AI_GENERATE_TEXT ("gen_ai.generate_text"). Other similar tests in this file correctly use "gen_ai.generate_text" (lines 1291, 2005). This will cause the test to not find any matching spans and fail at assert len(llm_spans) > 0.
Medium
Loss of test coverage for langchain-core-only installation scenario - `tests/integrations/langchain/test_langchain.py:1093-1098`
The deleted test_langchain_integration_with_langchain_core_only test uniquely verified that the integration works when AgentExecutor is None (i.e., when only langchain-core is installed, but not the full langchain package). The replacement test_langchain_text_completion test uses the actual langchain library and does not cover this edge case. This reduces coverage for users who only have langchain-core installed.
Duration: 3m 25s · Tokens: 1.1M in / 7.6k out · Cost: $1.31 (+extraction: $0.00, +merge: $0.00, +fix_gate: $0.00)
Annotations
Check failure on line 158 in tests/integrations/langchain/test_langchain.py
sentry-warden / warden: code-review
Test filters for wrong span operation type 'gen_ai.pipeline' instead of 'gen_ai.generate_text'
The test filters spans by `op == "gen_ai.pipeline"` but the LangchainIntegration creates text completion spans with `op=OP.GEN_AI_GENERATE_TEXT` ("gen_ai.generate_text"). Other similar tests in this file correctly use `"gen_ai.generate_text"` (lines 1291, 2005). This will cause the test to not find any matching spans and fail at `assert len(llm_spans) > 0`.
Check warning on line 1098 in tests/integrations/langchain/test_langchain.py
sentry-warden / warden: code-review
Loss of test coverage for langchain-core-only installation scenario
The deleted `test_langchain_integration_with_langchain_core_only` test uniquely verified that the integration works when `AgentExecutor` is `None` (i.e., when only langchain-core is installed, but not the full langchain package). The replacement `test_langchain_text_completion` test uses the actual langchain library and does not cover this edge case. This reduces coverage for users who only have langchain-core installed.