Skip to content

test(sensors): cover TracingSensor (distributed_tracing) 0% → 100%#733

Merged
wbarnha merged 1 commit into
masterfrom
claude/cov-distributed-tracing
Jul 21, 2026
Merged

test(sensors): cover TracingSensor (distributed_tracing) 0% → 100%#733
wbarnha merged 1 commit into
masterfrom
claude/cov-distributed-tracing

Conversation

@wbarnha

@wbarnha wbarnha commented Jul 21, 2026

Copy link
Copy Markdown
Member

What

Adds a unit-test suite for faust/sensors/distributed_tracing.py, which had no tests at all (0% coverage — the single largest testable coverage gap on master).

Coverage

faust/sensors/distributed_tracing.py: 0% → 100% (all 102 statements and all 30 branches). That's the biggest single-module coverage win available without new dependencies.

Tests (tests/unit/sensors/test_distributed_tracing.py, 24 cases)

Exercises every TracingSensor callback and both sides of each branch, driving the opentracing tracer/spans through mocks:

  • app_tracer / kafka_tracer cached properties
  • on_message_in — with trace-context headers (extract + follows_from) and without
  • on_stream_event_in — parent span present/absent; stream_meta and stream_spans created fresh vs. reused
  • on_stream_event_out — span finished/popped, no-spans, and stream-not-present
  • on_message_out — span present/absent
  • on_send_initiated — parent span present/absent
  • on_send_completed — span present/absent
  • on_send_error — error tag + log_kv + finish(exception=…), and no-span
  • trace_inject_headers — success, no-tracer, no-span, and the exception→None path
  • stop — closes aiohttp sessions, and the no-sessions path
  • on_threaded_producer_buffer_processed

Notes

  • Test-only change; no source touched.
  • The other two 0%-coverage modules aren't covered here because they need optional deps this environment/CI doesn't install: faust/contrib/sentry.py (needs raven/sentry_sdk) and faust/stores/aerospike.py (needs the aerospike client). Those are worth a follow-up once their extras are added to the test matrix.
  • Verified locally: 24 passed; flake8/black clean. (Pre-existing, unrelated test_datadog.py collection errors in this environment are a local datadog-dep issue, not affected by this change.)

🤖 Generated with Claude Code


Generated by Claude Code

faust/sensors/distributed_tracing.py had no tests (0% coverage). Add a
unit suite for TracingSensor exercising every callback and branch:
message in/out (with and without trace-context headers), stream event
in/out (parent span present/absent, stream_meta and stream_spans created
vs reused), send initiated/completed/error (span present/absent), header
injection (success, no-tracer, no-span, and the exception path), and
session cleanup on stop. Drives the opentracing tracer/spans via mocks.

Module coverage: 0% -> 100% (statements and branches).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHPL4VFWQRQPpjR1gXSKyL
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.02%. Comparing base (5bf3405) to head (456a668).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #733      +/-   ##
==========================================
+ Coverage   95.11%   96.02%   +0.91%     
==========================================
  Files         104      104              
  Lines       11169    11169              
  Branches     1206     1206              
==========================================
+ Hits        10623    10725     +102     
+ Misses        452      350     -102     
  Partials       94       94              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wbarnha
wbarnha enabled auto-merge July 21, 2026 17:03
@wbarnha
wbarnha disabled auto-merge July 21, 2026 17:07
@wbarnha
wbarnha enabled auto-merge July 21, 2026 17:07
@wbarnha
wbarnha disabled auto-merge July 21, 2026 17:14
@wbarnha
wbarnha merged commit 50e35ad into master Jul 21, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant