Skip to content

Conversation

@jh1231223
Copy link
Contributor

@jh1231223 jh1231223 commented Nov 21, 2025

Fixes #4944

This PR stabilizes the following tests:

  • test_pubsub_exact_happy_path_many_channels
  • test_sharded_pubsub_many_channels
  • test_pubsub_pattern
  • test_pubsub_pattern_many_channels

This work follows the same approach used in:


What I changed

I updated the channel-name construction in the affected tests to make each channel deterministically unique while preserving the original semantics (same shard / same pattern).

Specifically, by embedding the loop index into each channel name:

  • It guarantee the intended number of distinct channels per test, regardless of random collisions.
  • The tests now always publish and expect the same number of messages, so message-count assertions are stable across runs.

Validation

Tested locally with repeated runs:

python -m pytest -c /dev/null -q \
  tests/async_tests/test_pubsub.py \
  -k "[test_name]" \
  --count=600 -s --maxfail=1

@jh1231223 jh1231223 requested a review from a team as a code owner November 21, 2025 05:47
Signed-off-by: Jessica Hsiao <j.hsiao1998@gmail.com>
@jh1231223 jh1231223 force-pushed the fix-flaky-pubsub-pattern branch from ea607f8 to 9547901 Compare November 21, 2025 05:59
Signed-off-by: Jessica Hsiao <j.hsiao1998@gmail.com>
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.

[Python][Flaky Test] test_pubsub_exact_happy_path_many_channels

1 participant