Skip to content

The agent that grows with you

test(e2e/desktop): reuse a seeded install only once its snapshot is complete

teknium1ae327988932b
diff --git a/apps/desktop/e2e/update/global-setup.ts b/apps/desktop/e2e/update/global-setup.ts
index 6f4e4ac4b26..2549b68372a 100644
--- a/apps/desktop/e2e/update/global-setup.ts
+++ b/apps/desktop/e2e/update/global-setup.ts
@@ -39,7 +39,7 @@ function assertIsolated(): void {
export default function globalSetup(): void {
assertIsolated()
- if (process.env.HERMES_E2E_UPDATE_REUSE === '1' && fs.existsSync(path.join(UPDATE_ROOT, 'golden'))) {
+ if (process.env.HERMES_E2E_UPDATE_REUSE === '1' && fs.existsSync(path.join(UPDATE_ROOT, 'install.json'))) {
return
}
diff --git a/apps/desktop/e2e/update/seed.py b/apps/desktop/e2e/update/seed.py
index c068333426d..5d718b59ba4 100644
--- a/apps/desktop/e2e/update/seed.py
+++ b/apps/desktop/e2e/update/seed.py
@@ -52,6 +52,7 @@ def _fail(what: str, cp: subprocess.CompletedProcess) -> None:
def install(root: Path) -> None:
p = _paths(root)
root.mkdir(parents=True, exist_ok=True)
+ p["facts"].unlink(missing_ok=True)
for key in ("sb", "origin", "golden"):
shutil.rmtree(p[key], ignore_errors=True)
head = os.environ.get("HERMES_E2E_UPDATE_INSTALL_REF") or I.head_sha()
@@ -75,10 +76,11 @@ def install(root: Path) -> None:
"env": sb.env,
"headSha": head,
}
- p["facts"].write_text(json.dumps(facts, indent=1), encoding="utf-8")
p["golden"].mkdir()
for key in ("sb", "origin"):
subprocess.run(["cp", "-a", str(p[key]), str(p["golden"] / key)], check=True)
+ # Written last: its presence means the snapshot is complete (REUSE keys on it).
+ p["facts"].write_text(json.dumps(facts, indent=1), encoding="utf-8")
print(json.dumps(facts))