Skip to content

test: make blob desiredSize assertion robust#64106

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-blob
Open

test: make blob desiredSize assertion robust#64106
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-blob

Conversation

@trivikr

@trivikr trivikr commented Jun 24, 2026

Copy link
Copy Markdown
Member

Fixes flaky parallel/test-blob failures where
ReadableByteStreamController.desiredSize could be either 0 or -5
after the first blob stream read.

The test checks from a setTimeout(0) callback, while Blob.stream()
continues pulling data via setImmediate(). Depending on event loop
ordering, the next 5-byte "hello" chunk may already be queued by the
time 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
not ok 797 parallel/test-blob
  ---
  duration_ms: 252.40200
  severity: fail
  exitcode: 1
  stack: |-
    node:internal/assert/utils:146
      throw error;
      ^
    
    AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
    
    -5 !== 0
    
        at Timeout.<anonymous> (/home/iojs/build/workspace/node/test/parallel/test-blob.js:358:12)
        at Timeout._onTimeout (/home/iojs/build/workspace/node/test/common/index.js:510:15)
        at listOnTimeout (node:internal/timers:605:17)
        at process.processTimers (node:internal/timers:541:7) {
      generatedMessage: true,
      code: 'ERR_ASSERTION',
      actual: -5,
      expected: 0,
      operator: 'strictEqual',
      diff: 'simple'
    }

Assisted-by: openai:gpt-5.5

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
@trivikr trivikr added the flaky-test Issues and PRs related to the tests with unstable failures on the CI. label Jun 24, 2026
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Jun 24, 2026
@trivikr trivikr added request-ci Add this label to start a Jenkins CI on a PR. test Issues and PRs related to the tests. needs-ci PRs that need a full CI run. and removed test Issues and PRs related to the tests. needs-ci PRs that need a full CI run. labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flaky-test Issues and PRs related to the tests with unstable failures on the CI. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants