Skip to content

chore(ipv6): only run ipv6 e2e test in ipv6 environment#1207

Merged
chimurai merged 1 commit into
masterfrom
conditional-ipv6-testing
Apr 19, 2026
Merged

chore(ipv6): only run ipv6 e2e test in ipv6 environment#1207
chimurai merged 1 commit into
masterfrom
conditional-ipv6-testing

Conversation

@chimurai

@chimurai chimurai commented Apr 19, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Tests
    • Improved test reliability: IPv6 integration tests now run only on systems that support IPv6, preventing spurious failures on non‑IPv6 environments.
    • Added a runtime availability check so the IPv6 test suite is conditionally registered and executed based on detected IPv6 support, reducing false negatives in CI and local runs.

@coderabbitai

coderabbitai Bot commented Apr 19, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1a682990-9374-4cf6-9add-fcc884c1cb8d

📥 Commits

Reviewing files that changed from the base of the PR and between 31f0775 and 6ad063e.

📒 Files selected for processing (2)
  • test/e2e/ipv6.spec.ts
  • test/e2e/test-kit.ts
✅ Files skipped from review due to trivial changes (1)
  • test/e2e/ipv6.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/test-kit.ts

📝 Walkthrough

Walkthrough

Adds an async runtime check that detects IPv6 availability by attempting to bind a temporary TCP server to ::1, and uses it to conditionally register the IPv6 end-to-end test suite so the suite runs only when IPv6 is available.

Changes

Cohort / File(s) Summary
IPv6 Detection Helper
test/e2e/test-kit.ts
Added exported isIPv6Available(): Promise<boolean> that creates a temporary Node net TCP server bound to ::1, resolves true if it successfully listens (then closes), and resolves false on binding/listening error.
Conditional Test Execution
test/e2e/ipv6.spec.ts
Imported isIPv6Available and changed unconditional describe('ipv6 integration', ...) to describe.runIf(await isIPv6Available())(...), gating the entire IPv6 e2e suite on runtime IPv6 availability.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I poked at ::1 with a twitch and a grin,

Brought up a small server to see if it’d spin.
If it listens—hip hop—tests tumble and play,
If it balks—no fuss—tests nap for the day.
A rabbit’s quick check keeps CI hoppity-happy.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: making the IPv6 e2e test conditional based on IPv6 environment availability, which is the core purpose of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch conditional-ipv6-testing

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.

@pkg-pr-new

pkg-pr-new Bot commented Apr 19, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/http-proxy-middleware@1207

commit: 6ad063e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
test/e2e/test-kit.ts (1)

28-34: Optional: guard against lingering error events and add a safety timeout.

The implementation is correct in practice (Promise.resolve is idempotent, so a late error after a successful close is harmless). Two minor hardening ideas worth considering:

  • Remove the error listener once listen succeeds (and vice versa) to avoid holding references to the server after resolution.
  • Add a short timeout fallback so the detection cannot hang indefinitely on pathological network stacks.
♻️ Suggested hardening
 export async function isIPv6Available(): Promise<boolean> {
   return new Promise((resolve) => {
     const server = createServer();
-    server.listen(0, '::1', () => server.close(() => resolve(true)));
-    server.on('error', () => resolve(false));
+    const done = (result: boolean) => {
+      server.removeAllListeners('error');
+      resolve(result);
+    };
+    server.once('error', () => done(false));
+    server.listen(0, '::1', () => server.close(() => done(true)));
   });
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/e2e/test-kit.ts` around lines 28 - 34, In isIPv6Available, avoid
lingering listeners and potential hangs by removing the 'error' listener when
listen succeeds and removing the 'listening'/'listening callback' handlers when
an error fires, and add a short timeout (e.g., 1–2s) that closes the server and
resolves false if neither event occurs; update the Promise logic to clear the
timeout and remove the opposite listener on resolution so server references are
released and the check cannot hang.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/e2e/test-kit.ts`:
- Around line 28-34: In isIPv6Available, avoid lingering listeners and potential
hangs by removing the 'error' listener when listen succeeds and removing the
'listening'/'listening callback' handlers when an error fires, and add a short
timeout (e.g., 1–2s) that closes the server and resolves false if neither event
occurs; update the Promise logic to clear the timeout and remove the opposite
listener on resolution so server references are released and the check cannot
hang.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5369a6b8-fb9c-470b-929d-86fcde24759c

📥 Commits

Reviewing files that changed from the base of the PR and between 0934d02 and 5bce259.

📒 Files selected for processing (2)
  • test/e2e/ipv6.spec.ts
  • test/e2e/test-kit.ts

@coveralls

coveralls commented Apr 19, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 93.956%. remained the same — conditional-ipv6-testing into master

@chimurai
chimurai force-pushed the conditional-ipv6-testing branch 2 times, most recently from ff09eaa to 31f0775 Compare April 19, 2026 13:47
@chimurai
chimurai force-pushed the conditional-ipv6-testing branch from 31f0775 to 6ad063e Compare April 19, 2026 13:49
@chimurai
chimurai merged commit 4be9fbd into master Apr 19, 2026
21 checks passed
@chimurai
chimurai deleted the conditional-ipv6-testing branch April 19, 2026 13:51
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.

2 participants