Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(e2e): grant the upgrade lane's Hosts again after the head setup

Alfredo Lopeza356a58f834e
diff --git a/scripts/e2e/e2e-hcc-layout-upgrade.sh b/scripts/e2e/e2e-hcc-layout-upgrade.sh
index f354db9f6..eb92f153b 100755
--- a/scripts/e2e/e2e-hcc-layout-upgrade.sh
+++ b/scripts/e2e/e2e-hcc-layout-upgrade.sh
@@ -219,7 +219,12 @@ login_all() {
TEAM_ID="$(jq -r '.items[0].id // empty' <<<"$HTTP_BODY")"
user_login || return 1
# bash 3.2 treats "${empty[@]}" as unbound under set -u.
- [ "${#CREATED_HOSTS[@]}" -eq 0 ] || mint_rpc_token
+ [ "${#CREATED_HOSTS[@]}" -eq 0 ] && return 0
+ if [ "${1:-}" = regrant ]; then
+ local host
+ for host in "${CREATED_HOSTS[@]}"; do grant_host "$host" || return 1; done
+ fi
+ mint_rpc_token
}
hcc_image() {
@@ -274,7 +279,9 @@ upgrade_to_head() {
*) ok "HCC runs $(hcc_image)" ;;
esac
hold_forwards head || return 1
- login_all || return 1
+ # The setup's seed (seed-e2e-data.sh put_agents) sets the user's and team's
+ # agents to the source Host only, revoking the rows' grants.
+ login_all regrant || return 1
read_fixture_image
}
diff --git a/scripts/e2e/e2e-hcc-storage-layout-switch.test.mjs b/scripts/e2e/e2e-hcc-storage-layout-switch.test.mjs
index 7ae63d249..6bab3b64c 100644
--- a/scripts/e2e/e2e-hcc-storage-layout-switch.test.mjs
+++ b/scripts/e2e/e2e-hcc-storage-layout-switch.test.mjs
@@ -428,6 +428,33 @@ test('the upgrade lane repairs blockers before it upgrades', () => {
assert.doesNotMatch(helper('check_upgraded'), /wait_refused_pod|REPAIR_STATE_FAMILY_SCRIPT/)
})
+// A7.45: the head setup's seed (seed-e2e-data.sh put_agents) resets the user's
+// and team's agents, so the lane grants its rows' Hosts again before the mint.
+test('login_all regrant grants every created Host before it mints', () => {
+ assert.match(helper('upgrade_to_head'), /login_all regrant \|\| return 1/)
+ const run = arg => bash(`
+ set -u
+ calls=()
+ admin_login() { calls+=(admin_login); }
+ admin() { HTTP_CODE=200; HTTP_BODY='{"items":[{"id":"t1","email":"u@x"}]}'; }
+ user_login() { calls+=(user_login); }
+ grant_host() { calls+=("grant:$1"); }
+ mint_rpc_token() { calls+=(mint); }
+ fail() { echo "FAIL $*"; }
+ CAPI=http://capi DEV_EMAIL=u@x
+ CREATED_HOSTS=(host-a host-b)
+ ${helper('login_all')}
+ login_all ${arg}; rc=$?
+ printf '%s\\n' "\${calls[@]}"; echo "RC=$rc"
+ `)
+ const regrant = run('regrant')
+ assert.equal(regrant.status, 0, regrant.stderr)
+ assert.equal(regrant.stdout.trim(), 'admin_login\nuser_login\ngrant:host-a\ngrant:host-b\nmint\nRC=0')
+ // Witness: the plain call reaches the mint and grants nothing.
+ const plain = run('')
+ assert.equal(plain.stdout.trim(), 'admin_login\nuser_login\nmint\nRC=0')
+})
+
test('the lane T5 repair leaves a tree the merge does not touch', () => {
const repairScript = SOURCE.match(/^REPAIR_STATE_FAMILY_SCRIPT='([^']*)'/m)
assert.ok(repairScript, 'REPAIR_STATE_FAMILY_SCRIPT not found')