Skip to content

test(upgrade): run channel flow tests against the mock server offline - #36286

Open
bartlomieju wants to merge 1 commit into
mainfrom
fix/upgrade-flow-tests-offline
Open

test(upgrade): run channel flow tests against the mock server offline#36286
bartlomieju wants to merge 1 commit into
mainfrom
fix/upgrade-flow-tests-offline

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

The stable, canary, specific_stable and specific_canary upgrade
spec tests each copied the binary and ran a real deno upgrade, hitting
GitHub and dl.deno.land and downloading a full release archive on every
CI run across every platform. That burns bandwidth and couples PR CI to
the live release state: when a new version ships mid-flight, the output
match can break on unrelated PRs (which is exactly what happened when
v2.9.4 was published).

This points these four tests at the existing test-server mock instead,
the same mechanism delta and checksum already use, via
DENO_TESTING_UPGRADE and DENO_DONT_USE_INTERNAL_BASE_UPGRADE_URL. The
version lookup and the download both resolve to localhost:4545, so the
tests are fully offline, deterministic (fixed sentinel versions), and run
in tens of milliseconds instead of ~13s each.

The mock serves a placeholder, non-executable binary, so each upgrade
runs through version resolution and the download and then fails
validation. The tests assert the resolved version and the mocked
download URL rather than a completed install, matching the pattern the
existing mocked upgrade tests use.

Canary downloads previously had no test hook, so this extends the
DENO_TESTING_UPGRADE redirect to the canary download URL in
get_download_url (only active when that env var is set, so no
production impact) and teaches the test server to serve zips under
/deno-upgrade/canary/, mirroring the existing /deno-upgrade/download/
handling.

The two end-to-end tests that need a real runnable binary to assert the
upgraded executable actually runs and reports the expected version
(space_in_tmp, out) are intentionally left on the real network for
now; moving those behind a mock needs a runnable cross-platform stub or a
scheduled real-network job, which is a follow-up.

The `stable`, `canary`, `specific_stable` and `specific_canary` upgrade
spec tests each copied the binary and ran a real `deno upgrade`, hitting
GitHub / dl.deno.land and downloading a full ~40MB release on every CI
run. That wastes bandwidth and couples PR CI to the live release state
(a freshly published version could break the output match on unrelated
PRs).

Point these four at the existing test-server mock instead, the same way
`delta` and `checksum` already do, via DENO_TESTING_UPGRADE and
DENO_DONT_USE_INTERNAL_BASE_UPGRADE_URL. The version lookup and download
now resolve to localhost:4545, so the tests are fully offline,
deterministic (fixed sentinel versions), and run in tens of milliseconds
instead of ~13s. The mock serves a placeholder, non-executable binary,
so each upgrade runs through version resolution and the download and then
fails validation; the tests assert the resolved version and the mocked
download URL rather than a completed install.

Canary downloads previously had no test hook, so extend the
DENO_TESTING_UPGRADE redirect to the canary download URL in
get_download_url and teach the test server to serve zips under
/deno-upgrade/canary/, mirroring the existing /deno-upgrade/download/
handling.

The end-to-end tests that need a real runnable binary (space_in_tmp,
out) are intentionally left on the real network for now.
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.

1 participant