Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,100 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
isE2eOperatorOptInEnabled,
|
||||
missingE2eInputs,
|
||||
optionalE2eBooleanInput,
|
||||
skipOrFailWhenE2eFixtureMissing,
|
||||
skipOrFailWhenE2eInputsMissing,
|
||||
skipOrFailWhenE2eOptInMissing,
|
||||
skipOrFailWhenE2eReadinessOptInMissing,
|
||||
} from "../tests/e2e/utils/readiness";
|
||||
|
||||
describe("missingE2eInputs", () => {
|
||||
it("treats unset, empty, and whitespace-only readiness inputs as missing", () => {
|
||||
const missing = missingE2eInputs(["UNSET", "EMPTY", "SPACES", "PATH"], {
|
||||
EMPTY: "",
|
||||
SPACES: " \n\t",
|
||||
PATH: "/e2e-readiness/dashboard",
|
||||
} as NodeJS.ProcessEnv);
|
||||
|
||||
expect(missing).toEqual(["UNSET", "EMPTY", "SPACES"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("strict E2E readiness gates", () => {
|
||||
it("requires explicit 0|1 boolean inputs in readiness mode", () => {
|
||||
expect(() =>
|
||||
optionalE2eBooleanInput("E2E_REGISTRATION_EXPECTS_EMAIL_VERIFICATION", {
|
||||
REQUIRE_E2E_READINESS: "1",
|
||||
} as NodeJS.ProcessEnv)
|
||||
).toThrow(/E2E_REGISTRATION_EXPECTS_EMAIL_VERIFICATION=0\|1 must be set while REQUIRE_E2E_READINESS=1/u);
|
||||
});
|
||||
|
||||
it("parses explicit 0|1 boolean inputs", () => {
|
||||
expect(
|
||||
optionalE2eBooleanInput("E2E_REGISTRATION_EXPECTS_EMAIL_VERIFICATION", { E2E_REGISTRATION_EXPECTS_EMAIL_VERIFICATION: "0" } as NodeJS.ProcessEnv)
|
||||
).toBe(false);
|
||||
expect(
|
||||
optionalE2eBooleanInput("E2E_REGISTRATION_EXPECTS_EMAIL_VERIFICATION", { E2E_REGISTRATION_EXPECTS_EMAIL_VERIFICATION: "1" } as NodeJS.ProcessEnv)
|
||||
).toBe(true);
|
||||
expect(optionalE2eBooleanInput("E2E_REGISTRATION_EXPECTS_EMAIL_VERIFICATION", {} as NodeJS.ProcessEnv)).toBeUndefined();
|
||||
});
|
||||
|
||||
it("rejects invalid boolean inputs", () => {
|
||||
expect(() =>
|
||||
optionalE2eBooleanInput("E2E_REGISTRATION_EXPECTS_EMAIL_VERIFICATION", {
|
||||
E2E_REGISTRATION_EXPECTS_EMAIL_VERIFICATION: "yes",
|
||||
} as NodeJS.ProcessEnv)
|
||||
).toThrow(/E2E_REGISTRATION_EXPECTS_EMAIL_VERIFICATION must be 0 or 1/u);
|
||||
});
|
||||
|
||||
it("fails instead of skipping when required readiness inputs are missing", () => {
|
||||
expect(() =>
|
||||
skipOrFailWhenE2eInputsMissing(["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD"], "Tenant shell inputs not configured", {
|
||||
E2E_TENANT_EMAIL: "tenant@example.test",
|
||||
E2E_TENANT_PASSWORD: "",
|
||||
REQUIRE_E2E_READINESS: "1",
|
||||
} as NodeJS.ProcessEnv)
|
||||
).toThrow(/Tenant shell inputs not configured: missing E2E_TENANT_PASSWORD while REQUIRE_E2E_READINESS=1/u);
|
||||
});
|
||||
|
||||
it("fails instead of skipping when a mutating opt-in is missing in mutating readiness mode", () => {
|
||||
expect(() =>
|
||||
skipOrFailWhenE2eOptInMissing("E2E_ALLOW_REGISTRATION_CREATE", "skipping mutating registration provisioning flow", {
|
||||
REQUIRE_E2E_READINESS: "1",
|
||||
REQUIRE_E2E_MUTATING_READINESS: "1",
|
||||
} as NodeJS.ProcessEnv)
|
||||
).toThrow(/E2E_ALLOW_REGISTRATION_CREATE=1 not set - skipping mutating registration provisioning flow while REQUIRE_E2E_MUTATING_READINESS=1/u);
|
||||
});
|
||||
|
||||
it("fails instead of skipping when a required readiness opt-in is missing in readiness mode", () => {
|
||||
expect(() =>
|
||||
skipOrFailWhenE2eReadinessOptInMissing("E2E_BROWSER_MATRIX", "browser matrix readiness is required", {
|
||||
REQUIRE_E2E_READINESS: "1",
|
||||
} as NodeJS.ProcessEnv)
|
||||
).toThrow(/E2E_BROWSER_MATRIX=1 not set - browser matrix readiness is required while REQUIRE_E2E_READINESS=1/u);
|
||||
});
|
||||
|
||||
it("fails instead of skipping when a fixture is missing in readiness mode", () => {
|
||||
expect(() =>
|
||||
skipOrFailWhenE2eFixtureMissing("No mobile shell subscription settings link rendered for this fixture", {
|
||||
REQUIRE_E2E_READINESS: "1",
|
||||
} as NodeJS.ProcessEnv)
|
||||
).toThrow(/No mobile shell subscription settings link rendered for this fixture while REQUIRE_E2E_READINESS=1/u);
|
||||
});
|
||||
|
||||
it("keeps operator-only probes opt-in even during strict readiness runs", () => {
|
||||
expect(
|
||||
isE2eOperatorOptInEnabled("E2E_REQUIRE_SUBSCRIPTION_SUCCESS", {
|
||||
REQUIRE_E2E_READINESS: "1",
|
||||
} as NodeJS.ProcessEnv)
|
||||
).toBe(false);
|
||||
expect(
|
||||
isE2eOperatorOptInEnabled("E2E_REQUIRE_WORKFLOW_OUTBOX_DRAIN", {
|
||||
REQUIRE_E2E_READINESS: "1",
|
||||
E2E_REQUIRE_WORKFLOW_OUTBOX_DRAIN: "1",
|
||||
} as NodeJS.ProcessEnv)
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user