test: add http2 tests - #1228
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds HTTP/2 server E2E test coverage to validate proxy middleware behavior over secure connections. The ChangesHTTP/2 E2E Testing with TLS
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/e2e/http2-server.spec.ts`:
- Line 11: The teardown assumes mockTargetServer was initialized and will throw
if setup aborted early; update uses of mockTargetServer (the let
mockTargetServer variable and any afterEach/teardown calls such as
stop/close/closeAsync) to allow it to be undefined by declaring it optional and
guard all cleanup calls with a null/undefined check (e.g., if (mockTargetServer)
await mockTargetServer.stop()) so teardown becomes resilient when beforeEach
fails early — apply the same guard to every cleanup site referenced (lines
around the afterEach/teardown blocks that use mockTargetServer, including the
spots corresponding to the previous line 53, 74, and 116).
- Around line 51-52: The test restores NODE_TLS_REJECT_UNAUTHORIZED by assigning
previousNodeTlsRejectUnauthorized back to
process.env.NODE_TLS_REJECT_UNAUTHORIZED, which will set the literal string
"undefined" when the prior value was absent; update the restore logic wherever
previousNodeTlsRejectUnauthorized is used (both teardown/cleanup sites around
the HTTP/2 server tests) to check if previousNodeTlsRejectUnauthorized ===
undefined and, if so, delete process.env.NODE_TLS_REJECT_UNAUTHORIZED, otherwise
reassign the saved string value to process.env.NODE_TLS_REJECT_UNAUTHORIZED to
correctly restore the prior state.
- Line 67: The tests are invoking request(http2ProxyServer!) without enabling
HTTP/2 and the multiplexing test creates independent requests instead of a
persistent agent; update all supertest calls that use request(http2ProxyServer!)
(including the calls in the hello and other endpoint tests) to pass the option {
http2: true } so supertest uses HTTP/2, and change the multiplexing test to
create and reuse a persistent agent (e.g., supertest.agent with { http2: true })
to issue multiple concurrent requests through the same HTTP/2 connection to
validate multiplexing behavior.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 730bfa13-b21d-4a69-8ee5-00356ec5832a
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (3)
cspell.jsonpackage.jsontest/e2e/http2-server.spec.ts
Summary by CodeRabbit
Tests
Chores