Skip to content

The agent that grows with you

test(e2e): upgrade harnesses install main from their tagless sandbox origins

Tekniumf9bdaa303e16
diff --git a/tests/e2e/core/upgrade/_install_helpers.py b/tests/e2e/core/upgrade/_install_helpers.py
index 46cdfacc2b1..88b45ff8378 100644
--- a/tests/e2e/core/upgrade/_install_helpers.py
+++ b/tests/e2e/core/upgrade/_install_helpers.py
@@ -121,8 +121,9 @@ class Sandbox:
return str(python)
def run(self, argv: list[str], *, timeout: float = 600, cwd: Path | None = None,
- input: str | None = None) -> subprocess.CompletedProcess:
- return H.run(argv, env=self.env, cwd=cwd or self.root, writable=[self.root], timeout=timeout, input=input)
+ input: str | None = None, env: dict[str, str] | None = None) -> subprocess.CompletedProcess:
+ return H.run(argv, env=env or self.env, cwd=cwd or self.root, writable=[self.root], timeout=timeout,
+ input=input)
def cli(self, *args: str, timeout: float = 600) -> subprocess.CompletedProcess:
return self.run([self.hermes, *args], timeout=timeout)
@@ -161,13 +162,17 @@ def run_installer(sb: Sandbox, *, timeout: float = 1800) -> subprocess.Completed
"""HEAD's scripts/install.sh, non-interactive, as the documented `curl | bash` run does it."""
script = sb.root / "install.sh"
shutil.copy(H.WORKTREE / "scripts" / "install.sh", script)
- env = dict(sb.env)
- if not sb.checkout.exists():
- # The origin publishes commits on main and no release tags, so a fresh install follows
- # main; the channel it saves carries the reruns.
- env["HERMES_INSTALL_CHANNEL"] = "main"
- return H.run(["bash", str(script), "--non-interactive"], env=env, cwd=sb.root, writable=[sb.root],
- timeout=timeout, input="")
+ return sb.run(["bash", str(script), "--non-interactive"], timeout=timeout, input="",
+ env=fresh_install_env(sb))
+
+
+def fresh_install_env(sb: Sandbox) -> dict[str, str]:
+ """The sandbox env, plus `main` as the channel for a FRESH install: sandbox origins publish
+ commits on main and no release tags, so the stable default has nothing to install. The
+ install saves the choice, which carries every rerun (a rerun passes nothing, as users do)."""
+ if sb.checkout.exists():
+ return sb.env
+ return {**sb.env, "HERMES_INSTALL_CHANNEL": "main"}
def pin_main_channel(sb: Sandbox) -> None:
diff --git a/tests/e2e/core/upgrade/git/_git_world.py b/tests/e2e/core/upgrade/git/_git_world.py
index 52f9cda8cb2..8cda8c8bb61 100644
--- a/tests/e2e/core/upgrade/git/_git_world.py
+++ b/tests/e2e/core/upgrade/git/_git_world.py
@@ -222,7 +222,10 @@ def world(root: Path, *, base: str, installer_ref: str | None = None,
_preclone(sb, preclone, w.git_env())
script = sb.root / "install.sh"
script.write_text(installer_script(installer_ref), encoding="utf-8")
- cp = sb.run(["bash", str(script), "--non-interactive"], timeout=1800, input="")
+ # The served repo publishes commits on main and no release tags: install main (N-1's
+ # installer ignores the variable and installs main anyway).
+ cp = sb.run(["bash", str(script), "--non-interactive"], timeout=1800, input="",
+ env={**sb.env, "HERMES_INSTALL_CHANNEL": "main"})
assert cp.returncode == 0, f"install ({installer_ref or 'HEAD'} installer, base {base[:12]}) failed:\n{w.diag(cp)}"
head = w.head()
assert head == base, f"installer left HEAD at {head}, expected {base}\n{w.diag(cp)}"
diff --git a/tests/e2e/core/upgrade/hosts/test_libc_musl.py b/tests/e2e/core/upgrade/hosts/test_libc_musl.py
index a5d1d001a51..d64aec832d5 100644
--- a/tests/e2e/core/upgrade/hosts/test_libc_musl.py
+++ b/tests/e2e/core/upgrade/hosts/test_libc_musl.py
@@ -80,7 +80,7 @@ def alpine_install(tmp_path_factory):
objects = Path(I.git("rev-parse", "--path-format=absolute", "--git-common-dir", cwd=H.WORKTREE)) / "objects"
pull = subprocess.run(["docker", "pull", "-q", IMAGE], capture_output=True, text=True, timeout=600, check=False)
assert pull.returncode == 0, f"docker pull {IMAGE} failed (network?):\n{pull.stderr[-2000:]}"
- argv = ["docker", "run", "--rm", "-e", f"ORIGIN={origin}",
+ argv = ["docker", "run", "--rm", "-e", f"ORIGIN={origin}", "-e", "HERMES_INSTALL_CHANNEL=main",
"-v", f"{origin}:{origin}:ro", "-v", f"{objects}:{objects}:ro", "-v", f"{work}:/work:ro",
IMAGE, "sh", "-c", SCRIPT]
cp = subprocess.run(argv, capture_output=True, text=True, timeout=1800, check=False)
diff --git a/tests/e2e/core/upgrade/network/_seed.py b/tests/e2e/core/upgrade/network/_seed.py
index 260df4d1587..26c6d49f2b3 100644
--- a/tests/e2e/core/upgrade/network/_seed.py
+++ b/tests/e2e/core/upgrade/network/_seed.py
@@ -195,7 +195,8 @@ def seed_install(root: Path) -> Installed:
sb.env.pop("SSL_CERT_FILE", None)
script = sb.root / "install.sh"
shutil.copy(H.WORKTREE / "scripts" / "install.sh", script)
- cp = sb.run(["bash", str(script), "--non-interactive", "--skip-browser"], timeout=1800, input="")
+ cp = sb.run(["bash", str(script), "--non-interactive", "--skip-browser"], timeout=1800, input="",
+ env=I.fresh_install_env(sb))
assert cp.returncode == 0, "seed install failed:\n" + I.describe(cp)
I.pin_main_channel(sb) # cells publish commits, not releases (test_release_channel_records opts back into stable)
# From here on the checkout talks to the official URL, which only the proxy can serve.