test(node): stabilize shardnumsub (unique channels + bounded wait) #4955
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here’s a polished PR description for the shardnumsub fix—paste it in and just replace the issue number if needed (likely #4927):
Issue link
This Pull Request is linked to issue (URL): #4926
What & Why (Summary)
PubSub › test pubsub shardnumsub_%pintermittently fails due to:pubsubShardNumSub.This PR makes minimal, test-only changes to stabilize the check:
runIdsuffix (e.g.,test_shardchannel1:${runId}) to isolate state between runs.Details of the change
const runId = String(getRandomKey());test_shardchannel[1-4]→test_shardchannel[1-4]:${runId}.0/0/0(pre-subscribe) and1/2/3/0(post-subscribe), pollpubsubShardNumSubup to 60×50 ms and then perform the finalexpect(keeps the original assertion intact while mitigating transient timing).Why this fixes the flake
Risk & Scope
How I verified
tests/PubSub.test.tstargetingshardnumsub_%prepeatedly (in-band and CI-like runs).1/2/3/0and0/0/0outcomes with no spurious counts from unrelated runs.