@camunda/e2e-test-suite 0.0.979 → 0.0.980
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,8 +5,10 @@ const c8Run_8_9_1 = require("../../fixtures/c8Run-8.9");
|
|
|
5
5
|
const zeebeClient_1 = require("../../utils/zeebeClient");
|
|
6
6
|
const UtilitiesPage_1 = require("../../pages/c8Run-8.9/UtilitiesPage");
|
|
7
7
|
const sleep_1 = require("../../utils/sleep");
|
|
8
|
+
const apiHelpers_1 = require("../../utils/apiHelpers");
|
|
8
9
|
const _setup_1 = require("../../test-setup.js");
|
|
9
10
|
c8Run_8_9_1.test.beforeAll(async () => {
|
|
11
|
+
await (0, apiHelpers_1.waitForOrchestrationClusterReady)();
|
|
10
12
|
await Promise.all([
|
|
11
13
|
(0, zeebeClient_1.deploy)('./resources/User_Task_Editing_Variables.bpmn'),
|
|
12
14
|
(0, zeebeClient_1.deploy)('./resources/Zeebe_User_Task.bpmn'),
|
|
@@ -18,6 +18,7 @@ export declare function authC8runAPI(name: string, password: string): Promise<vo
|
|
|
18
18
|
export declare function validateMcpServerHealth(serverUrl?: string): Promise<APIResponse>;
|
|
19
19
|
export declare function waitForConnectorsReady(baseUrl?: string | undefined, timeoutMs?: number, requiredJobTypes?: string[]): Promise<void>;
|
|
20
20
|
export declare function waitForInboundWebhookRegistered(webhookPath: string, baseUrl?: string | undefined, timeoutMs?: number): Promise<void>;
|
|
21
|
+
export declare function waitForOrchestrationClusterReady(managementUrl?: string, timeoutMs?: number): Promise<void>;
|
|
21
22
|
export declare function deployProcess(filePath: string, authToken?: string, environment?: 'saas' | 'sm', clusterType?: string): Promise<number | null>;
|
|
22
23
|
export declare function createProcessInstance(processDefinitionKey: string, authToken?: string, environment?: 'saas' | 'sm', clusterType?: string, variables?: Record<string, unknown>): Promise<string>;
|
|
23
24
|
export declare function waitForProcessInstanceVisible(processInstanceKey: string, authToken?: string, environment?: 'saas' | 'sm', clusterType?: string, maxAttempts?: number, retryDelayMs?: number): Promise<void>;
|
package/dist/utils/apiHelpers.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.updateClusterDataFilters = exports.getClusterDataFilters = exports.getTestClusterUuid = exports.authConsoleManagementAPI = exports.updateCollectionScope = exports.createSingleProcessReport = exports.createDashboard = exports.createCollection = exports.getOptimizeCookieSm = exports.getOptimizeCoockie = exports.createStringClusterVariable = exports.createJsonClusterVariable = exports.waitForProcessInstanceVisible = exports.createProcessInstance = exports.deployProcess = exports.waitForInboundWebhookRegistered = exports.waitForConnectorsReady = exports.validateMcpServerHealth = exports.authC8runAPI = exports.authSmAPI = exports.authSaasAPI = exports.authAPI = exports.buildZeebeApiUrl = exports.retryOn500 = exports.sendRequestAndAssertResponse = exports.assertUnauthorizedResponseBody = exports.expectUnauthorizedErrorBody = exports.assertResponseStatus = exports.getApiRequestContext = void 0;
|
|
6
|
+
exports.updateClusterDataFilters = exports.getClusterDataFilters = exports.getTestClusterUuid = exports.authConsoleManagementAPI = exports.updateCollectionScope = exports.createSingleProcessReport = exports.createDashboard = exports.createCollection = exports.getOptimizeCookieSm = exports.getOptimizeCoockie = exports.createStringClusterVariable = exports.createJsonClusterVariable = exports.waitForProcessInstanceVisible = exports.createProcessInstance = exports.deployProcess = exports.waitForOrchestrationClusterReady = exports.waitForInboundWebhookRegistered = exports.waitForConnectorsReady = exports.validateMcpServerHealth = exports.authC8runAPI = exports.authSmAPI = exports.authSaasAPI = exports.authAPI = exports.buildZeebeApiUrl = exports.retryOn500 = exports.sendRequestAndAssertResponse = exports.assertUnauthorizedResponseBody = exports.expectUnauthorizedErrorBody = exports.assertResponseStatus = exports.getApiRequestContext = void 0;
|
|
7
7
|
const test_1 = require("@playwright/test");
|
|
8
8
|
const sleep_1 = require("./sleep");
|
|
9
9
|
const randomSleep_1 = require("./randomSleep");
|
|
@@ -408,6 +408,69 @@ async function waitForInboundWebhookRegistered(webhookPath, baseUrl = process.en
|
|
|
408
408
|
}).toPass({ intervals: [5000, 10000, 15000], timeout: timeoutMs });
|
|
409
409
|
}
|
|
410
410
|
exports.waitForInboundWebhookRegistered = waitForInboundWebhookRegistered;
|
|
411
|
+
// ---- Orchestration Cluster Health Check ----
|
|
412
|
+
// Polls the c8Run management API until the orchestration cluster can accept
|
|
413
|
+
// commands, so a `beforeAll` that deploys through zeebe-node never issues its
|
|
414
|
+
// first gRPC call against a broker that is not serving yet.
|
|
415
|
+
//
|
|
416
|
+
// The gate exists because every zeebe-node call is unbounded: ZBClient defaults
|
|
417
|
+
// to `maxRetries: -1`, so `deploy`/`createProcessInstance` retry gRPC code 14
|
|
418
|
+
// (gateway unreachable) and code 8 (backpressure) forever. Such a call neither
|
|
419
|
+
// resolves nor rejects, it just drains the caller's whole hook budget, and
|
|
420
|
+
// Playwright can then only report `"beforeAll" hook timeout of 720000ms
|
|
421
|
+
// exceeded` with no cause while reporting every remaining test in the file as
|
|
422
|
+
// never run.
|
|
423
|
+
//
|
|
424
|
+
// `brokerStatus` is the documented "can accept commands" signal: it backs the
|
|
425
|
+
// broker's `/actuator/health/status` group and reports DOWN until the broker is
|
|
426
|
+
// healthy. See camunda-docs version-8.9
|
|
427
|
+
// self-managed/components/orchestration-cluster/zeebe/operations/health.md --
|
|
428
|
+
// "A broker is healthy when it can process processes, accept commands, and
|
|
429
|
+
// perform all its expected tasks". Several consecutive healthy responses are
|
|
430
|
+
// required so an instance that is still shutting down, or has only just begun
|
|
431
|
+
// starting, cannot satisfy the gate on one lucky answer.
|
|
432
|
+
async function waitForOrchestrationClusterReady(managementUrl = 'http://localhost:9600', timeoutMs = 240000) {
|
|
433
|
+
const healthEndpoint = `${managementUrl}/actuator/health`;
|
|
434
|
+
apiRequestContext = await getApiRequestContext();
|
|
435
|
+
const requiredConsecutive = 3;
|
|
436
|
+
let consecutiveHealthy = 0;
|
|
437
|
+
await (0, test_1.expect)(async () => {
|
|
438
|
+
let response;
|
|
439
|
+
try {
|
|
440
|
+
response = await apiRequestContext.get(healthEndpoint, {
|
|
441
|
+
timeout: 10000,
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
catch (error) {
|
|
445
|
+
consecutiveHealthy = 0;
|
|
446
|
+
throw error;
|
|
447
|
+
}
|
|
448
|
+
if (response.status() !== 200) {
|
|
449
|
+
consecutiveHealthy = 0;
|
|
450
|
+
throw new Error(`orchestration cluster health returned ${response.status()}`);
|
|
451
|
+
}
|
|
452
|
+
const brokerStatus = await brokerStatusFrom(response);
|
|
453
|
+
if (brokerStatus !== undefined && brokerStatus !== 'UP') {
|
|
454
|
+
consecutiveHealthy = 0;
|
|
455
|
+
throw new Error(`broker cannot accept commands yet (brokerStatus: ${brokerStatus})`);
|
|
456
|
+
}
|
|
457
|
+
consecutiveHealthy += 1;
|
|
458
|
+
(0, test_1.expect)(consecutiveHealthy).toBeGreaterThanOrEqual(requiredConsecutive);
|
|
459
|
+
}).toPass({ intervals: [5000, 10000, 15000], timeout: timeoutMs });
|
|
460
|
+
}
|
|
461
|
+
exports.waitForOrchestrationClusterReady = waitForOrchestrationClusterReady;
|
|
462
|
+
// Reads the `brokerStatus` indicator out of an `/actuator/health` response.
|
|
463
|
+
// Returns undefined when the response carries no such component, so a
|
|
464
|
+
// distribution that does not expose it falls back to the plain 200 check.
|
|
465
|
+
async function brokerStatusFrom(response) {
|
|
466
|
+
try {
|
|
467
|
+
const body = (await response.json());
|
|
468
|
+
return body.components?.brokerStatus?.status;
|
|
469
|
+
}
|
|
470
|
+
catch {
|
|
471
|
+
return undefined;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
411
474
|
// ---- Zeebe: API helpers ----
|
|
412
475
|
async function deployProcess(filePath, authToken, environment, clusterType) {
|
|
413
476
|
try {
|