@camunda/e2e-test-suite 0.0.1802 → 0.0.1804
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.
package/dist/utils/api/grpc.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* the REST `ApiClient`: OAuth2 client credentials or basic auth, and the
|
|
4
4
|
* tenant on a multi-tenant cluster.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { Zeebe } from '@camunda8/sdk';
|
|
7
|
+
export type GrpcClient = Zeebe.ZeebeGrpcClient;
|
|
7
8
|
export declare function grpcClient(options?: {
|
|
8
9
|
authenticated?: boolean;
|
|
9
|
-
}):
|
|
10
|
+
}): GrpcClient;
|
package/dist/utils/api/grpc.js
CHANGED
|
@@ -6,32 +6,42 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.grpcClient = void 0;
|
|
9
|
-
const
|
|
9
|
+
const sdk_1 = require("@camunda8/sdk");
|
|
10
10
|
const config_1 = require("./config");
|
|
11
11
|
function grpcClient(options = {}) {
|
|
12
12
|
const authenticated = options.authenticated ?? true;
|
|
13
13
|
const { oauth, basic } = config_1.apiConfig;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
// The SDK takes TLS from the address scheme rather than a `useTLS` flag.
|
|
15
|
+
const scheme = config_1.apiConfig.grpc.useTls ? 'grpcs' : 'grpc';
|
|
16
|
+
const address = config_1.apiConfig.grpc.address.includes('://')
|
|
17
|
+
? config_1.apiConfig.grpc.address
|
|
18
|
+
: `${scheme}://${config_1.apiConfig.grpc.address}`;
|
|
19
|
+
return new sdk_1.Camunda8({
|
|
20
|
+
ZEEBE_GRPC_ADDRESS: address,
|
|
21
|
+
CAMUNDA_LOG_LEVEL: 'none',
|
|
22
|
+
...(config_1.apiConfig.multiTenancy ? { CAMUNDA_TENANT_ID: config_1.apiConfig.tenantId } : {}),
|
|
21
23
|
...(!authenticated
|
|
22
|
-
? {}
|
|
24
|
+
? { CAMUNDA_AUTH_STRATEGY: 'NONE', CAMUNDA_OAUTH_DISABLED: true }
|
|
23
25
|
: config_1.apiConfig.authMethod === 'basic'
|
|
24
|
-
? {
|
|
26
|
+
? {
|
|
27
|
+
CAMUNDA_AUTH_STRATEGY: 'BASIC',
|
|
28
|
+
CAMUNDA_BASIC_AUTH_USERNAME: basic.username,
|
|
29
|
+
CAMUNDA_BASIC_AUTH_PASSWORD: basic.password,
|
|
30
|
+
}
|
|
25
31
|
: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
32
|
+
CAMUNDA_AUTH_STRATEGY: 'OAUTH',
|
|
33
|
+
CAMUNDA_OAUTH_URL: oauth.tokenUrl,
|
|
34
|
+
CAMUNDA_ZEEBE_OAUTH_AUDIENCE: oauth.audience,
|
|
35
|
+
...(oauth.scope ? { CAMUNDA_TOKEN_SCOPE: oauth.scope } : {}),
|
|
36
|
+
ZEEBE_CLIENT_ID: oauth.clientId,
|
|
37
|
+
ZEEBE_CLIENT_SECRET: oauth.clientSecret,
|
|
38
|
+
CAMUNDA_TOKEN_DISK_CACHE_DISABLE: true,
|
|
34
39
|
}),
|
|
35
|
-
|
|
40
|
+
zeebeGrpcSettings: {
|
|
41
|
+
// A failed call must surface as the failure, not as a retry loop that
|
|
42
|
+
// outlasts the test timeout.
|
|
43
|
+
ZEEBE_GRPC_CLIENT_RETRY: false,
|
|
44
|
+
},
|
|
45
|
+
}).getZeebeGrpcApiClient();
|
|
36
46
|
}
|
|
37
47
|
exports.grpcClient = grpcClient;
|
package/dist/utils/apiHelpers.js
CHANGED
|
@@ -525,11 +525,11 @@ async function waitForInboundWebhookRegistered(webhookPath, baseUrl = process.en
|
|
|
525
525
|
exports.waitForInboundWebhookRegistered = waitForInboundWebhookRegistered;
|
|
526
526
|
// ---- Orchestration Cluster Health Check ----
|
|
527
527
|
// Polls the c8Run management API until the orchestration cluster can accept
|
|
528
|
-
// commands, so a `beforeAll` that deploys through
|
|
529
|
-
// first gRPC call against a broker that is not serving yet.
|
|
528
|
+
// commands, so a `beforeAll` that deploys through the gRPC client never issues
|
|
529
|
+
// its first gRPC call against a broker that is not serving yet.
|
|
530
530
|
//
|
|
531
|
-
// The gate exists because every
|
|
532
|
-
//
|
|
531
|
+
// The gate exists because every gRPC call is unbounded by default: the client
|
|
532
|
+
// retries forever, so `deploy`/`createProcessInstance` retry gRPC code 14
|
|
533
533
|
// (gateway unreachable) and code 8 (backpressure) forever. Such a call neither
|
|
534
534
|
// resolves nor rejects, it just drains the caller's whole hook budget, and
|
|
535
535
|
// Playwright can then only report `"beforeAll" hook timeout of 720000ms
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
declare const
|
|
4
|
-
declare const createInstances: <Variables extends JSONDoc = IProcessVariables>(bpmnProcessId: string, version: number, numberOfInstances: number, variables?: Variables | undefined) => Promise<import("zeebe-node").CreateProcessInstanceResponse[]>;
|
|
1
|
+
import type { IProcessVariables, JSONDoc } from '@camunda8/sdk/dist/zeebe/lib/interfaces-1.0';
|
|
2
|
+
declare const deploy: (processNames: string | string[]) => Promise<import("@camunda8/sdk/dist/zeebe/types").DeployResourceResponse<unknown>>;
|
|
3
|
+
declare const createInstances: <Variables extends JSONDoc = IProcessVariables>(bpmnProcessId: string, version: number, numberOfInstances: number, variables?: Variables | undefined) => Promise<import("@camunda8/sdk/dist/zeebe/types").CreateProcessInstanceResponse[]>;
|
|
5
4
|
export { deploy, createInstances };
|
|
5
|
+
export type { IProcessVariables, JSONDoc };
|
|
@@ -17,11 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.createInstances = exports.deploy = void 0;
|
|
20
|
-
const
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
// spent 3h18m emitting 75,236 "[deployWorkflow]: Attempt N (max: -1)" lines,
|
|
20
|
+
const sdk_1 = require("@camunda8/sdk");
|
|
21
|
+
// The SDK's gRPC client retries a failed call forever by default, exactly as
|
|
22
|
+
// zeebe-node did: an unreachable gateway was retried indefinitely and nothing
|
|
23
|
+
// ever threw, so run 32136136238 spent 3h18m emitting 75,236 retry lines,
|
|
25
24
|
// reached attempt 719, and still reported the job as successful.
|
|
26
25
|
//
|
|
27
26
|
// Bound it so an unreachable broker surfaces as a fast, visible test failure
|
|
@@ -29,16 +28,48 @@ const zeebe_node_1 = require("zeebe-node");
|
|
|
29
28
|
// the 5s ceiling is about a minute of grace -- enough to ride out a gateway
|
|
30
29
|
// restart, short enough to fail honestly.
|
|
31
30
|
//
|
|
32
|
-
// Must be > 0:
|
|
33
|
-
// 0 would fall through to the -1 default and restore the infinite loop.
|
|
31
|
+
// Must be > 0: a 0 would be read as "unset" and restore the infinite loop.
|
|
34
32
|
const parsedMaxRetries = Number(process.env.ZEEBE_CLIENT_MAX_RETRIES);
|
|
35
33
|
const maxRetries = Number.isFinite(parsedMaxRetries) && parsedMaxRetries > 0
|
|
36
34
|
? parsedMaxRetries
|
|
37
35
|
: 15;
|
|
38
|
-
//
|
|
39
|
-
|
|
36
|
+
// zeebe-node read the gateway from ZEEBE_GATEWAY_ADDRESS and fell back to
|
|
37
|
+
// localhost:26500; the SDK reads ZEEBE_GRPC_ADDRESS. Keep the old variable
|
|
38
|
+
// working so a c8Run runner that sets it keeps hitting the same broker.
|
|
39
|
+
//
|
|
40
|
+
// The scheme is load-bearing: without one the SDK resolves TLS as
|
|
41
|
+
// `CAMUNDA_SECURE_CONNECTION ?? !ZEEBE_INSECURE_CONNECTION`, both undefined
|
|
42
|
+
// here, so it would dial c8Run's plaintext gateway over TLS. zeebe-node
|
|
43
|
+
// defaulted to no TLS, so default to grpc:// and leave an explicit scheme be.
|
|
44
|
+
const configuredAddress = process.env.ZEEBE_GRPC_ADDRESS ||
|
|
45
|
+
process.env.ZEEBE_GATEWAY_ADDRESS ||
|
|
46
|
+
'localhost:26500';
|
|
47
|
+
const gatewayAddress = configuredAddress.includes('://')
|
|
48
|
+
? configuredAddress
|
|
49
|
+
: `grpc://${configuredAddress}`;
|
|
50
|
+
const zbc = new sdk_1.Camunda8({
|
|
51
|
+
ZEEBE_GRPC_ADDRESS: gatewayAddress,
|
|
52
|
+
CAMUNDA_AUTH_STRATEGY: 'NONE',
|
|
53
|
+
CAMUNDA_OAUTH_DISABLED: true,
|
|
54
|
+
zeebeGrpcSettings: {
|
|
55
|
+
ZEEBE_GRPC_CLIENT_MAX_RETRIES: maxRetries,
|
|
56
|
+
},
|
|
57
|
+
}).getZeebeGrpcApiClient();
|
|
58
|
+
// zeebe-node's deployProcess() took a path, or a list of paths, and inferred
|
|
59
|
+
// the resource type from the file extension. The SDK wants the type named, so
|
|
60
|
+
// do that inference here and keep every call site unchanged.
|
|
61
|
+
const toResource = (filename) => {
|
|
62
|
+
if (filename.endsWith('.form')) {
|
|
63
|
+
return { formFilename: filename };
|
|
64
|
+
}
|
|
65
|
+
if (filename.endsWith('.dmn')) {
|
|
66
|
+
return { decisionFilename: filename };
|
|
67
|
+
}
|
|
68
|
+
return { processFilename: filename };
|
|
69
|
+
};
|
|
40
70
|
const deploy = (processNames) => {
|
|
41
|
-
|
|
71
|
+
const files = Array.isArray(processNames) ? processNames : [processNames];
|
|
72
|
+
return zbc.deployResources(files.map(toResource));
|
|
42
73
|
};
|
|
43
74
|
exports.deploy = deploy;
|
|
44
75
|
const createInstances = (bpmnProcessId, version, numberOfInstances, variables) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/e2e-test-suite",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1804",
|
|
4
4
|
"description": "End-to-end test helpers for Camunda 8",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -75,11 +75,14 @@
|
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@axe-core/playwright": "^4.7.3",
|
|
77
77
|
"@camunda8/hub-api": "0.2.0",
|
|
78
|
+
"@camunda8/sdk": "^8.8.27",
|
|
78
79
|
"axios": "^1.5.0",
|
|
79
80
|
"dotenv": "^16.3.1",
|
|
80
81
|
"mailslurp-client": "^15.20.2",
|
|
81
82
|
"node-fetch": "^3.3.2",
|
|
82
|
-
"unzipper": "^0.12.3"
|
|
83
|
-
|
|
83
|
+
"unzipper": "^0.12.3"
|
|
84
|
+
},
|
|
85
|
+
"overrides": {
|
|
86
|
+
"fast-xml-parser": "^5.12.1"
|
|
84
87
|
}
|
|
85
88
|
}
|