mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
test(web-app-openbao): assert the seal state and health-code contract
This commit is contained in:
1 file changed
+35
@@ -0,0 +1,35 @@
|
||||
const { test, expect } = require("@playwright/test");
|
||||
const { normalizeBaseUrl } = require("./personas");
|
||||
|
||||
const baseUrl = normalizeBaseUrl(process.env.OPENBAO_BASE_URL || "");
|
||||
|
||||
test.use({ ignoreHTTPSErrors: true });
|
||||
|
||||
test("seal: the node reports itself unsealed with a static-seal recovery config", async ({ request }) => {
|
||||
const response = await request.get(`${baseUrl}/v1/sys/seal-status`, { failOnStatusCode: false });
|
||||
expect(response.status(), "seal-status must be readable unauthenticated").toBe(200);
|
||||
|
||||
const status = await response.json();
|
||||
expect(status.initialized, "OpenBao must be initialised").toBe(true);
|
||||
expect(status.sealed, "the static seal must have auto-unsealed the node").toBe(false);
|
||||
// An auto-seal yields recovery keys rather than unseal shares; recovery_seal marks that mode.
|
||||
expect(
|
||||
status.recovery_seal,
|
||||
"an auto-seal must report recovery mode, not Shamir unseal shares",
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
test("seal: the sealed state is the monitored signal on /v1/sys/health", async ({ request }) => {
|
||||
// Contract the monitoring probe relies on: strict codes distinguish sealed (503) from
|
||||
// healthy (200). The overridden codes are only used by the container healthcheck.
|
||||
const strict = await request.get(`${baseUrl}/v1/sys/health`, { failOnStatusCode: false });
|
||||
expect(strict.status(), "a healthy unsealed node must answer 200").toBe(200);
|
||||
|
||||
const overridden = await request.get(`${baseUrl}/v1/sys/health?sealedcode=200&uninitcode=200`, {
|
||||
failOnStatusCode: false,
|
||||
});
|
||||
expect(
|
||||
overridden.status(),
|
||||
"the overridden codes the container healthcheck uses must be accepted",
|
||||
).toBe(200);
|
||||
});
|
||||
Reference in new issue
Block a user