Watch
0
0
Fork
You've already forked hyperhive
0

full-setup vm test: wait for the agents to be deployed and need a login

A last subtest polls GET /api/agents/status on the controller socket until
iris and spawn are fresh with needs_login true, through settle() with up to
40 minutes. The header's green condition is now this check, and its note on
what is not scripted yet drops the agents' deploy.
This commit is contained in:
atlas 2026-11-10 00:56:23 +01:00 • committed by mara
commit 702974867f

View file

@ -1,7 +1,6 @@
# `vmTests.<system>.full-setup`: one VM runs a whole single-host swarm # `vmTests.<system>.full-setup`: one VM runs a whole single-host swarm
# (`deploy.singleHostSwarm`) with no network and no substituter, and a script # (`deploy.singleHostSwarm`) with no network and no substituter, and a script walks
# walks docs/1-getting-started/setup.md until the controller has committed the # docs/1-getting-started/setup.md until the agents are deployed and need a login.
# agents' meta flake to the swarm's forge.
# #
# Steps of setup.md, as the script runs them: # Steps of setup.md, as the script runs them:
# 1 secret store `bao operator init`, the granter bootstrap with the root # 1 secret store `bao operator init`, the granter bootstrap with the root
@ -15,11 +14,12 @@
# 9 first agent The same endpoint, for `iris`: `swarmctl agent create` has no # 9 first agent The same endpoint, for `iris`: `swarmctl agent create` has no
# archetype flag, and a custom agent's config repo would need # archetype flag, and a custom agent's config repo would need
# inputs the VM cannot resolve offline. # inputs the VM cannot resolve offline.
# `swarmctl setup status` is read last: step 9 (the product's `ruth`) stays undone. # `swarmctl setup status` is read before the agents deploy: steps 1-6 done; step 9
# Not scripted yet; a later slice adds them: step 3, the first SSO login to the # (the product's hard-coded `ruth`) stays undone, as no root agent exists here. Not
# forge (an OIDC code flow against authelia), `swarmctl forge make-admin`, and # scripted yet: step 3, the first SSO login to the forge (an OIDC code flow against
# the agents' deploy up to the point where each says it needs a login. Green # authelia), and `swarmctl forge make-admin`.
# when `internal/meta` on the forge holds the flake the toplevels were built from. # Green when `GET /api/agents/status` on the controller socket lists `iris` and
# `spawn` with `freshness` fresh and `needs_login` true.
# #
# Offline: the test seeds the swarm's forge with `hyperhive/hyperhive` (one # Offline: the test seeds the swarm's forge with `hyperhive/hyperhive` (one
# commit of `self`, ./hyperhive-fixture-repo.nix). The controller renders # commit of `self`, ./hyperhive-fixture-repo.nix). The controller renders
@ -405,7 +405,14 @@ pkgs.testers.runNixOSTest (
raise Exception("swarmctl setup status did not report the steps done so far:\n" + "\n".join(lines)) raise Exception("swarmctl setup status did not report the steps done so far:\n" + "\n".join(lines))
assert machine.execute("swarmctl setup status >/dev/null")[0] == 1 assert machine.execute("swarmctl setup status >/dev/null")[0] == 1
# The agents' deploy and the check that they need a login are not scripted yet. with subtest("the agents are deployed and need a login"):
settle(
f"curl --fail --silent --unix-socket {SOCKET} {API}/api/agents/status "
"| jq -e '[.[] | select(.hive == \"" + HIVE + "\" and .freshness == \"fresh\" and .needs_login == true)"
" | .name] | contains([\"iris\", \"spawn\"])'",
2400,
["swarm-controller", "hive-c0re"],
)
''; '';
} }
) )