Repository navigation
test: make blob desiredSize assertion robust - #64106
Merged
Merged
Conversation
The blob stream pull continuation runs with setImmediate(), while the test checks desiredSize from a timer. Depending on platform scheduling, the stream may or may not have queued the next 5-byte chunk yet. Accept both valid intermediate states to avoid flaky failures. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5
Member
Author
|
✅ stress test in PR: https://ci.nodejs.org/job/node-stress-single-test/771/ |
panva
approved these changes
Jul 1, 2026
aduh95
reviewed
Jul 1, 2026
Comment on lines
+357
to
+360
| // it may have pulled in the next 'hello' which is 5 bytes hence -5. | ||
| // The ordering of this timer and the stream's setImmediate() pull | ||
| // continuation can vary across platforms. | ||
| assert([0, -5].includes(stream[kState].controller.desiredSize)); |
Fixes flaky
parallel/test-blobfailures whereReadableByteStreamController.desiredSizecould be either0or-5after the first blob stream read.
The test checks from a
setTimeout(0)callback, whileBlob.stream()continues pulling data via
setImmediate(). Depending on event loopordering, the next 5-byte
"hello"chunk may already be queued by thetime the assertion runs.
This updates the assertion to accept both valid intermediate states and
documents the scheduling dependency.
Refs: https://github.com/nodejs/reliability/issues?q=sort%3Aupdated-desc%20%22parallel%2Ftest-blob%22
Example
Assisted-by: openai:gpt-5.5