-
Notifications
You must be signed in to change notification settings - Fork 117
tests(pubsub): deflake test_pubsub_combined_exact_and_pattern_one_client by making channel names unique per index #4880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests(pubsub): deflake test_pubsub_combined_exact_and_pattern_one_client by making channel names unique per index #4880
Conversation
7e82b35 to
f3a541f
Compare
…s in combined exact+pattern test (valkey-io#4364) Signed-off-by: Jessica Hsiao <136421644+jh1231223@users.noreply.github.com>
f3a541f to
3f6a704
Compare
Signed-off-by: Jessica Hsiao <j.hsiao1998@gmail.com>
|
Additional ask in ticket: #4862 (comment) |
…ub_combined_exact_pattern_and_sharded_multi_client Signed-off-by: Jessica Hsiao <j.hsiao1998@gmail.com>
…attern_and_sharded_one_client' into fix-pubsub-deterministic-channels Merge valkey-io#4886 into valkey-io#4880 to combine flaky Pub/Sub test fixes Includes fixes from fix-test_pubsub_combined_exact_pattern_and_sharded_one_client into fix-pubsub-deterministic-channels as requested in issue valkey-io#4862. Stabilizes all related Pub/Sub tests with unique channel names and proper sync.#
|
Thanks for merging them all into one PR. It helps to keep readability and for potential troubleshooting down the line. PR looks good, but there are some linting errors from CD/CI you need to address. @jh1231223 Please fix python lint errors |
Signed-off-by: Jessica Hsiao <j.hsiao1998@gmail.com>
|
@xShinnRyuu I reformatted the file with Black. Lint errors should be clean now. Thanks! |
xShinnRyuu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jamesx-improving
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for your contribution!
Fixes #4364 and fixes requested in #4862
This PR now includes the changes from #4886 and stabilizes the following tests in the same file:
• test_pubsub_combined_exact_and_pattern_one_client
• test_pubsub_combined_exact_and_pattern_multiple_clients
• test_pubsub_combined_exact_pattern_and_sharded_one_client
• test_pubsub_combined_exact_pattern_and_sharded_multi_client
Approach: use unique channel names per test and ensure subscription setup completes before publishing. Verified with repeated runs; no intermittent failures observed.
Context
test_pubsub_combined_exact_and_pattern_one_clientwas occasionally failing with off-by-one mismatches in message counts.The root cause was random collisions between exact and pattern channel names generated separately in two comprehensions.
What I changed
for i in range(NUM_CHANNELS)Why
This prevents accidental overlap between channel sets, stabilizing message counts across exact and pattern subscriptions.
Validation
Tested locally with repeated runs:
python -m pytest -c /dev/null -q \ tests/async_tests/test_pubsub.py \ -k "test_pubsub_combined_exact_and_pattern_one_client" \ --count=200 -s --maxfail=1