test(aiomysql): Add span streaming variants to aiomysql tests#6601
1 issue
find-bugs: Found 1 issue (1 medium)
Medium
Streaming span is serialized before `add_query_source` is called, making the threshold assertion vacuously true - `tests/integrations/aiomysql/test_aiomysql.py:703-707`
The fake_record_sql_queries_streaming mock in the span_streaming=True branch exits the inner with record_sql_queries(...) as span: pass block immediately, causing StreamedSpan._end() to fire and serialize the span to the batcher before timestamps are mocked and before add_query_source runs. The assertion assert "code.line.number" not in data will always pass regardless of the threshold logic, meaning a regression that always adds code source would go undetected.
⏱ 15m 37s · 1.8M in / 58.1k out · $1.95
Annotations
Check warning on line 707 in tests/integrations/aiomysql/test_aiomysql.py
sentry-warden / warden: find-bugs
Streaming span is serialized before `add_query_source` is called, making the threshold assertion vacuously true
The `fake_record_sql_queries_streaming` mock in the `span_streaming=True` branch exits the inner `with record_sql_queries(...) as span: pass` block immediately, causing `StreamedSpan._end()` to fire and serialize the span to the batcher before timestamps are mocked and before `add_query_source` runs. The assertion `assert "code.line.number" not in data` will always pass regardless of the threshold logic, meaning a regression that always adds code source would go undetected.