Skip to content

Test: Add req and res streaming e2e tests#106

Merged
VikramAditya33 merged 1 commit into
mainfrom
fix/test-stream
May 9, 2026
Merged

Test: Add req and res streaming e2e tests#106
VikramAditya33 merged 1 commit into
mainfrom
fix/test-stream

Conversation

@VikramAditya33
Copy link
Copy Markdown
Collaborator

@VikramAditya33 VikramAditya33 commented May 9, 2026

Tests added:

  • Streaming large request bodies
  • Chunked transfer encoding
  • Backpressure handling during upload
  • Connection abort during streaming
  • Piping request to writable stream
  • A bit more

Fixed eslint config for unused var

Closes #99

Summary by CodeRabbit

  • Tests

    • Added comprehensive end-to-end test coverage for HTTP response lifecycle events and streaming scenarios.
    • Tests now validate response handling with multiple writes, chunked transfer encoding, content-length headers, backpressure handling, connection aborts, large payloads, data integrity, and non-POST methods.
  • Chores

    • Updated ESLint configuration to refine unused variable suppression rules.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 9, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6438ab47-e634-4b43-9bbe-4db91628c04e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/test-stream

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/http/streaming-connection-abort.e2e.spec.ts`:
- Around line 148-152: The test currently calls req.destroy() then immediately
resolves the promise (using requestDestroyed = true; resolve()), which can let
the test pass without observing the actual transport abort event; change the
logic in the timeout handler to call req.destroy() and then wait for the
socket/request to emit a terminal event (listen for 'error' or 'close' on
req/req.socket) and only set requestDestroyed = true and resolve the promise
when one of those events fires (with a short safety timeout to fail if no event
arrives). Apply the same change to the other instance around lines 167-169 so
both cases wait for the real abort signal rather than resolving immediately.

In `@test/http/streaming-large-payloads.e2e.spec.ts`:
- Around line 30-32: The current Promise awaiting passthrough end only listens
for 'end' and can hang if either stream errors; change the Promise in the test
to accept (resolve, reject) and attach 'error' handlers on both passthrough and
req (e.g., passthrough.on('error', reject) and req.on('error', reject)) so the
promise rejects immediately on stream errors; also remove/cleanup listeners
after resolve/reject to avoid leaks and ensure the test fails fast.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4d5cc829-dc87-49ac-9132-123d0dbf4b87

📥 Commits

Reviewing files that changed from the base of the PR and between 51ddc5c and b8fbeb3.

📒 Files selected for processing (15)
  • eslint.config.mjs
  • test/http/response-events.e2e.spec.ts
  • test/http/response-multiple-writes.e2e.spec.ts
  • test/http/response-stream-chunked.e2e.spec.ts
  • test/http/response-stream-content-length.e2e.spec.ts
  • test/http/response-stream-nodejs-piping.e2e.spec.ts
  • test/http/response-stream-pipefrom.e2e.spec.ts
  • test/http/streaming-backpressure.e2e.spec.ts
  • test/http/streaming-chunked-transfer.e2e.spec.ts
  • test/http/streaming-connection-abort.e2e.spec.ts
  • test/http/streaming-data-integrity.e2e.spec.ts
  • test/http/streaming-large-payloads.e2e.spec.ts
  • test/http/streaming-non-post-methods.e2e.spec.ts
  • test/http/streaming-pipe-buffer.e2e.spec.ts
  • test/http/streaming-pipe-passthrough.e2e.spec.ts

Comment thread test/http/streaming-connection-abort.e2e.spec.ts
Comment thread test/http/streaming-large-payloads.e2e.spec.ts
@VikramAditya33 VikramAditya33 merged commit 380d261 into main May 9, 2026
3 checks passed
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.

Request and Response Streaming e2e test

1 participant