Skip to content

E2E Test: data channel send/receive test.#647

Open
cloudwebrtc wants to merge 1 commit intomainfrom
duan/e2e-test-data-channel
Open

E2E Test: data channel send/receive test.#647
cloudwebrtc wants to merge 1 commit intomainfrom
duan/e2e-test-data-channel

Conversation

@cloudwebrtc
Copy link
Copy Markdown
Contributor

Summary

Adds end-to-end pytests for LiveKit's data-channel (publish_data) routing semantics, covering targeted delivery, broadcast, topic propagation, and topic-on-targeted sends. Each scenario uses dedicated rtc.Room instances per participant and asserts that only the intended receivers see the packet.

Test What it covers
test_data_one_to_one destination_identities=["receiver"] reaches only receiver; bystander gets nothing.
test_data_one_to_many_targeted destination_identities=["r1", "r2"] reaches both; an excluded participant gets nothing.
test_data_broadcast Empty destination_identities fan-outs to every other participant in the room.
test_data_topic_passthrough topic is preserved end-to-end; receiver-side filtering by topic works.
test_data_targeted_with_topic Targeted send carries topic; non-targets receive nothing.

Implementation notes:

  • _DataCollector subscribes to data_received and (optionally) filters by sender identity, so cross-test packet noise is impossible.
  • _ensure_visible waits until the sender's room state lists the target identities — without this, targeted publishes can race the participant-joined signal and silently drop.
  • _assert_no_data uses a 1s settle window before asserting absence, to avoid false negatives from in-flight delivery.

Requires

  • LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET env vars (tests are auto-skipped otherwise).

Test plan

  • pytest livekit-rtc/tests/test_dc.py -v passes against a current LiveKit server (verified locally on 1.10.1).
  • Tests are skipped cleanly when LiveKit env vars are missing.
  • No regressions in the existing tests/ suite.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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