Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -11,6 +11,16 @@ const mailjetEnv = {
|
||||
MAILJET_SECRET_KEY: "fixture-mailjet-secret",
|
||||
MAILJET_FROM_EMAIL: "sender@example.com",
|
||||
};
|
||||
const cryptoSecret = "shared-tenant-envelope-secret-value";
|
||||
const gdprExportSseCKey = "BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc=";
|
||||
const storageEnv = {
|
||||
STORAGE_ACCESS_KEY_ID: "access-key",
|
||||
STORAGE_BUCKET: "exports",
|
||||
STORAGE_ENDPOINT: "https://storage.example.com",
|
||||
STORAGE_REGION: "eu-central-1",
|
||||
STORAGE_SECRET_ACCESS_KEY: "secret-key",
|
||||
GDPR_EXPORT_SSE_C_KEY_BASE64: gdprExportSseCKey,
|
||||
};
|
||||
|
||||
function readPackageScripts(): Record<string, string> {
|
||||
return JSON.parse(readFileSync(packageJsonPath, "utf8")).scripts;
|
||||
@@ -171,6 +181,7 @@ describe("worker health", () => {
|
||||
{
|
||||
BULLMQ_REDIS_URL: "redis://localhost:6379/0",
|
||||
DATABASE_URL: "postgresql://localhost/app",
|
||||
CRYPTO_SECRET: cryptoSecret,
|
||||
WORKER_ENABLED: "true",
|
||||
WORKER_QUEUE_GROUP: "mail",
|
||||
...mailjetEnv,
|
||||
@@ -455,6 +466,27 @@ describe("worker health", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("reports mail-worker readiness misconfigured when the shared envelope key is absent", async () => {
|
||||
const databaseProbe = vi.fn();
|
||||
const redisProbe = vi.fn();
|
||||
const report = await buildWorkerHealthReport(
|
||||
{
|
||||
BULLMQ_REDIS_URL: "redis://localhost:6379/0",
|
||||
DATABASE_URL: "postgresql://localhost/app",
|
||||
...mailjetEnv,
|
||||
TRANSACTIONAL_MAIL_OUTBOX_REQUIRED: "true",
|
||||
WORKER_ENABLED: "true",
|
||||
WORKER_QUEUE_GROUP: "mail",
|
||||
},
|
||||
{ databaseProbe, redisProbe }
|
||||
);
|
||||
|
||||
expect(report.status).toBe("misconfigured");
|
||||
expect(report.errors).toContain("CRYPTO_SECRET:missing-required:CRYPTO_SECRET is required.");
|
||||
expect(databaseProbe).not.toHaveBeenCalled();
|
||||
expect(redisProbe).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("reports misconfigured and skips DB probe when enabled worker lacks DATABASE_URL", async () => {
|
||||
const databaseProbe = vi.fn();
|
||||
const report = await buildWorkerHealthReport(
|
||||
@@ -518,7 +550,7 @@ describe("worker health", () => {
|
||||
expect(report.storageStatus).toBe("ready");
|
||||
});
|
||||
|
||||
test("keeps the import worker group ready but idle until import runtime gates are enabled", async () => {
|
||||
test("keeps the import worker ready with only KWP while generic import gates are disabled", async () => {
|
||||
const report = await buildWorkerHealthReport(
|
||||
{
|
||||
BULLMQ_REDIS_URL: "redis://localhost:6379/0",
|
||||
@@ -531,11 +563,140 @@ describe("worker health", () => {
|
||||
);
|
||||
|
||||
expect(report.status).toBe("ready");
|
||||
expect(report.queues).toEqual([]);
|
||||
expect(report.queues).toEqual([queueNames.kwpImports]);
|
||||
expect(report.importStatus).toBe("skipped");
|
||||
expect(report.errors).not.toEqual(expect.arrayContaining([expect.stringMatching(/missing-import/u)]));
|
||||
});
|
||||
|
||||
test("reports the dedicated portal GDPR export mode ready with KWP and exports ownership", async () => {
|
||||
const report = await buildWorkerHealthReport(
|
||||
{
|
||||
BULLMQ_REDIS_URL: "redis://localhost:6379/0",
|
||||
DATABASE_URL: "postgresql://localhost/app",
|
||||
PORTAL_GDPR_EXPORT_QUEUE_ENABLED: "true",
|
||||
...storageEnv,
|
||||
WORKER_ENABLED: "true",
|
||||
WORKER_QUEUE_GROUP: "import",
|
||||
},
|
||||
{ databaseProbe: vi.fn(), redisProbe: vi.fn() }
|
||||
);
|
||||
|
||||
expect(report).toMatchObject({
|
||||
status: "ready",
|
||||
importConfigured: true,
|
||||
importStatus: "ready",
|
||||
storageConfigured: true,
|
||||
storageStatus: "ready",
|
||||
workerGroup: "import",
|
||||
});
|
||||
expect(report.queues).toEqual([queueNames.kwpImports, queueNames.exports]);
|
||||
expect(report.errors).toEqual([]);
|
||||
});
|
||||
|
||||
test("fails dedicated portal GDPR export readiness without complete storage", async () => {
|
||||
const report = await buildWorkerHealthReport(
|
||||
{
|
||||
BULLMQ_REDIS_URL: "redis://localhost:6379/0",
|
||||
DATABASE_URL: "postgresql://localhost/app",
|
||||
PORTAL_GDPR_EXPORT_QUEUE_ENABLED: "true",
|
||||
WORKER_ENABLED: "true",
|
||||
WORKER_QUEUE_GROUP: "import",
|
||||
},
|
||||
{ databaseProbe: vi.fn(), redisProbe: vi.fn() }
|
||||
);
|
||||
|
||||
expect(report.status).toBe("misconfigured");
|
||||
expect(report.queues).toEqual([queueNames.kwpImports, queueNames.exports]);
|
||||
expect(report.storageStatus).toBe("misconfigured");
|
||||
expect(report.errors).toEqual(
|
||||
expect.arrayContaining([
|
||||
"STORAGE_ENDPOINT:missing-storage-config:Required when PORTAL_GDPR_EXPORT_QUEUE_ENABLED=true.",
|
||||
"GDPR_EXPORT_SSE_C_KEY_BASE64:missing-storage-config:Required when PORTAL_GDPR_EXPORT_QUEUE_ENABLED=true.",
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
test("fails full import readiness without the GDPR SSE-C key", async () => {
|
||||
const { GDPR_EXPORT_SSE_C_KEY_BASE64: _key, ...storageWithoutKey } = storageEnv;
|
||||
const report = await buildWorkerHealthReport(
|
||||
{
|
||||
BULLMQ_REDIS_URL: "redis://localhost:6379/0",
|
||||
DATABASE_URL: "postgresql://localhost/app",
|
||||
IMPORT_QUEUE_ENABLED: "true",
|
||||
IMPORT_QUEUE_RUNTIME_READY: "true",
|
||||
...storageWithoutKey,
|
||||
WORKER_ENABLED: "true",
|
||||
WORKER_QUEUE_GROUP: "import",
|
||||
},
|
||||
{ databaseProbe: vi.fn(), redisProbe: vi.fn() }
|
||||
);
|
||||
|
||||
expect(report.status).toBe("misconfigured");
|
||||
expect(report.storageStatus).toBe("misconfigured");
|
||||
expect(report.errors).toEqual(
|
||||
expect.arrayContaining(["GDPR_EXPORT_SSE_C_KEY_BASE64:missing-storage-config:Required when the full import runtime owns GDPR export jobs."])
|
||||
);
|
||||
});
|
||||
|
||||
test("reports the full import runtime ready only with encrypted GDPR storage", async () => {
|
||||
const report = await buildWorkerHealthReport(
|
||||
{
|
||||
BULLMQ_REDIS_URL: "redis://localhost:6379/0",
|
||||
DATABASE_URL: "postgresql://localhost/app",
|
||||
IMPORT_QUEUE_ENABLED: "true",
|
||||
IMPORT_QUEUE_RUNTIME_READY: "true",
|
||||
...storageEnv,
|
||||
WORKER_ENABLED: "true",
|
||||
WORKER_QUEUE_GROUP: "import",
|
||||
},
|
||||
{ databaseProbe: vi.fn(), redisProbe: vi.fn() }
|
||||
);
|
||||
|
||||
expect(report).toMatchObject({ status: "ready", importStatus: "ready", storageStatus: "ready" });
|
||||
expect(report.queues).toEqual([queueNames.kwpImports, queueNames.imports, queueNames.exports]);
|
||||
});
|
||||
|
||||
test("fails dedicated portal GDPR export readiness on the wrong worker group", async () => {
|
||||
const report = await buildWorkerHealthReport(
|
||||
{
|
||||
BULLMQ_REDIS_URL: "redis://localhost:6379/0",
|
||||
DATABASE_URL: "postgresql://localhost/app",
|
||||
PORTAL_GDPR_EXPORT_QUEUE_ENABLED: "true",
|
||||
...storageEnv,
|
||||
WORKER_ENABLED: "true",
|
||||
WORKER_QUEUE_GROUP: "general",
|
||||
},
|
||||
{ databaseProbe: vi.fn(), redisProbe: vi.fn() }
|
||||
);
|
||||
|
||||
expect(report.status).toBe("misconfigured");
|
||||
expect(report.errors).toEqual(
|
||||
expect.arrayContaining([
|
||||
"PORTAL_GDPR_EXPORT_QUEUE_ENABLED:invalid-worker-queue-group:PORTAL_GDPR_EXPORT_QUEUE_ENABLED=true requires WORKER_QUEUE_GROUP=import.",
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
test("fails closed instead of becoming healthy-idle for a whitespace-padded dedicated gate", async () => {
|
||||
const report = await buildWorkerHealthReport(
|
||||
{
|
||||
BULLMQ_REDIS_URL: "redis://localhost:6379/0",
|
||||
DATABASE_URL: "postgresql://localhost/app",
|
||||
PORTAL_GDPR_EXPORT_QUEUE_ENABLED: " true ",
|
||||
...storageEnv,
|
||||
WORKER_ENABLED: "true",
|
||||
WORKER_QUEUE_GROUP: "import",
|
||||
},
|
||||
{ databaseProbe: vi.fn(), redisProbe: vi.fn() }
|
||||
);
|
||||
|
||||
expect(report.status).toBe("misconfigured");
|
||||
expect(report.queues).toEqual([]);
|
||||
expect(report.errors).toEqual(
|
||||
expect.arrayContaining(["PORTAL_GDPR_EXPORT_QUEUE_ENABLED:invalid-boolean:PORTAL_GDPR_EXPORT_QUEUE_ENABLED must be exactly true or false."])
|
||||
);
|
||||
});
|
||||
|
||||
test("reports misconfigured when import worker group is partially enabled", async () => {
|
||||
const report = await buildWorkerHealthReport(
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user