Files
hermes-agent/tests/install/e2e-assets/source-update-command.sh
Teknium 7831de8999 test(release): install and network E2E follow the new update-channel defaults
rc.10-v0.21.7 failed 13 release jobs because the release-only E2E still
assumed the old update behavior:

- Install/update E2E (Linux, macOS, Windows; hermes-update and desktop-app
  routes). A fresh install of the official repo now defaults to the stable
  channel. Installed at HEAD it is newer than v0.21.6 and correctly waits
  ("Already up to date"), so the HEAD -> NEXT legs never moved ("checkout
  landed on NEXT", "no successful update completion receipt"). The drivers
  now record `hermes update --set-channel main` before the user-state
  snapshot, the same way the pytest sandboxes already do (3a4b4b6f83).
  Releases older than --set-channel follow main already and are skipped by a
  help probe.
- Network E2E (test_offline_and_flaky, test_proxy_only_egress). They asserted
  that `main` reads and retries releases/channels/main.json through the
  proxy. #136429 removed that read on purpose (regional WAF 403s, #128295).
  Rewritten to the new contract: `main` reads no release record, survives a
  release-host outage, and a cut tunnel to github.com still fails fast and
  changes nothing.

The desktop unit test with the same assumption was already fixed on main
(0aa764fedd).
2026-10-11 02:55:56 -07:00

30 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# Build the installed CLI's invocation for a source-to-source update.
# Older releases do not accept either flag, so probe their own help first.
build_source_update_command() {
local hermes="$1" help="$2"
update_cmd=("$hermes" update)
if grep -qF -- --yes <<< "$help"; then
update_cmd+=(--yes)
fi
# This fixture advances serve.git/main to an unpublished HEAD (or NEXT).
# Newer updaters otherwise consult releases/channels/main.json, which may
# not exist. Explicit --branch main follows the fixture's git transport.
if grep -Eq -- '(^|[[:space:]]|\[)--branch([=[:space:]]|$)' <<< "$help"; then
update_cmd+=(--branch main)
fi
}
# Official source checkouts default to the stable channel (the latest published
# vX.Y.Z), and these fixtures publish commits on main, not releases: a fresh
# install at HEAD is newer than the latest release and correctly waits, so the
# HEAD -> NEXT legs would find no update. Record `main` for the install BEFORE
# the user-state snapshot (config.yaml is part of the baseline). Releases that
# predate --set-channel follow main already.
pin_source_main_channel() {
local hermes="$1" help
help="$("$hermes" update --help 2>&1)" || { printf 'update --help failed: %s\n' "$help" >&2; return 1; }
grep -qF -- --set-channel <<< "$help" || return 0
"$hermes" update --set-channel main < /dev/null
}