Skip to content

Commit cb00842

Browse files
lexfreiclaude
andcommitted
fix(openbao): improve E2E test robustness
Simplify pod phase wait using kubectl wait --for=jsonpath instead of manual polling loop. Add unseal key validation after init to fail early with diagnostic output if initialization produces invalid data. Co-Authored-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 73f9c57 commit cb00842

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎hack/e2e-apps/openbao.bats‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,18 @@ EOF
2222
kubectl -n tenant-test wait hr openbao-$name-system --timeout=120s --for=condition=ready
2323

2424
# Wait for pod to be running (OpenBAO starts sealed, so pod is Running but not Ready)
25-
timeout 90 sh -ec "until kubectl -n tenant-test get pod openbao-$name-0 -o jsonpath='{.status.phase}' | grep -q Running; do sleep 5; done"
25+
kubectl -n tenant-test wait pod openbao-$name-0 --timeout=90s --for=jsonpath='{.status.phase}'=Running
2626

2727
# Wait for OpenBAO API to accept connections (exit code 2 = sealed but responsive, 1 = not ready)
2828
timeout 30 sh -ec "until kubectl -n tenant-test exec openbao-$name-0 -- sh -c 'bao status >/dev/null 2>&1; test \$? -ne 1'; do sleep 3; done"
2929

3030
# Initialize OpenBAO (single key share for testing simplicity)
3131
init_output=$(kubectl -n tenant-test exec openbao-$name-0 -- bao operator init -key-shares=1 -key-threshold=1 -format=json)
3232
unseal_key=$(echo "$init_output" | jq -r '.unseal_keys_b64[0]')
33+
if [ -z "$unseal_key" ] || [ "$unseal_key" = "null" ]; then
34+
echo "Failed to extract unseal key. Init output: $init_output" >&2
35+
return 1
36+
fi
3337

3438
# Unseal OpenBAO
3539
kubectl -n tenant-test exec openbao-$name-0 -- bao operator unseal "$unseal_key"

0 commit comments

Comments
 (0)