Repository navigation
[Tests] Cover the Cloudflare tunnel timeout with no reported error - #8733
Draft
github-actions[bot] wants to merge 1 commit into
Draft
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
The tunnel timeout handler has two branches: it reports the last collected cloudflared errors, or falls back to "unknown error." when none were collected. Only the first branch was exercised, so the fallback message could change or break without any test noticing. Add a case that writes a log line matching neither the URL, connection, nor known-error patterns, then advances the fake clock past the unit-test tunnel timeout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
The seven-day review of Main tests (2026-09-25 to 2026-10-02 UTC) found ten failed runs. Every evidenced flake in that window is already claimed, so this PR closes a coverage gap instead:
checkForCachedNewVersionreturningundefinedfrom a shared on-disk cache, one run (Node 24.1.0 in windows-latest) — the samedescribeblock is rewritten by Stabilize version, profile, and package cache tests #8669.runWithRateLimitclock boundary, one run (Node 26.1.0 in ubuntu-latest) — fixed by merged PR [Tests] Fix flaky outdated rate-limit cache test #8705.The remaining failures in the window were cancellations rather than test failures.
The Cloudflare tunnel timeout handler has two branches: report the last collected cloudflared errors, or fall back to
Could not start Cloudflare tunnel: unknown error.when none were collected. Only the first branch was exercised. I confirmed the gap by changing the fallback message intunnel.tsand running the package suite — all 19 tests still passed, so that user-facing message could change or break silently.WHAT is this pull request doing?
Adds one test to
packages/plugin-cloudflare/src/tunnel.test.tsthat writes a cloudflared log line matching neither the URL, connection, nor known-error patterns, then advances the fake clock past the unit-test tunnel timeout and asserts the fallback status.No production code changes. The test follows the fake-timer pattern of the neighbouring
cleans errors coming from the logcase, including itstry/finallyrestore, and asserts the publicgetTunnelStatus()contract rather than internal wiring.The test is load-bearing: with the fallback message mutated it fails and no other test does; restored, it passes.
Validation on Linux / Node 26.1.0: the file and the full
plugin-cloudflaresuite pass (19 tests), five consecutive--sequence.shuffleruns pass, and--pool=forksand--no-file-parallelismpass.lintandtype-checkare clean. The branch under test is platform-independent and uses fake timers, so it carries no OS-specific timing risk; Windows and macOS confirmation comes from CI.How to manually test your changes?
CI
Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add