Watch
0
0
Fork
You've already forked hyperhive
0

k8s VM tests: wait for the store's active node after the unseal

The tests waited on `bao status`, which answers once the node is
unsealed and before raft has elected it, so the first policy write raced
the election and failed with "local node not active but active cluster
node not found". `unseal_bao` unseals and then waits for sys/leader to
say the node is the leader; the four tests that bootstrap the store use
it at both unseal sites.

Closes #6807
This commit is contained in:
maia 2026-11-23 20:18:50 +01:00
commit e42cdd74f8

View file

@ -458,8 +458,7 @@ pkgs.testers.runNixOSTest {
with subtest("the store is initialised, unsealed and bootstrapped"):
machine.wait_until_succeeds('[ "$(bao status >/dev/null 2>&1; echo $?)" = 2 ]', timeout=900)
machine.succeed(f"umask 077 && bao operator init -key-shares=1 -key-threshold=1 -format=json > {INIT}")
machine.succeed(f"bao operator unseal \"$(jq -r '.unseal_keys_b64[0]' {INIT})\"")
machine.wait_until_succeeds("bao status", timeout=120)
unseal_bao(machine, INIT)
machine.succeed(
"set -o pipefail; "
f'export BAO_TOKEN="$(jq -r .root_token {INIT})"; '
@ -481,8 +480,7 @@ pkgs.testers.runNixOSTest {
if machine.execute("journalctl -u swarm-bao-agent-pki --no-pager | grep -F 'restart openbao.service'")[0] == 0:
machine.succeed("systemctl --machine=swarm-bao restart openbao.service")
machine.wait_until_succeeds('[ "$(bao status >/dev/null 2>&1; echo $?)" = 2 ]', timeout=900)
machine.succeed(f"bao operator unseal \"$(jq -r '.unseal_keys_b64[0]' {INIT})\"")
machine.wait_until_succeeds("bao status", timeout=120)
unseal_bao(machine, INIT)
for unit in ["swarm-bao-controller-policy", "swarm-bao-services-issuer-policy", "swarm-bao-k8s-jwt-policy"]:
settle(f'[ "$(systemctl is-active {unit}.service)" = active ]', 900, [f"{unit}.service"])
machine.wait_until_succeeds(