@camunda/e2e-test-suite 0.0.1307 → 0.0.1308
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/tests/api/components/connectors-api-tests.spec.d.ts +10 -0
- package/dist/tests/api/components/connectors-api-tests.spec.js +30 -0
- package/dist/tests/api/components/console-api-tests.spec.d.ts +8 -0
- package/dist/tests/api/components/console-api-tests.spec.js +30 -0
- package/dist/tests/api/components/identity-api-tests.spec.d.ts +9 -0
- package/dist/tests/api/components/identity-api-tests.spec.js +49 -0
- package/dist/tests/api/components/web-modeler-api-tests.spec.d.ts +11 -0
- package/dist/tests/api/components/web-modeler-api-tests.spec.js +56 -0
- package/dist/tests/api/grpc/grpc-api-tests.spec.d.ts +11 -0
- package/dist/tests/api/grpc/grpc-api-tests.spec.js +62 -0
- package/dist/utils/api/capabilities.d.ts +22 -0
- package/dist/utils/api/capabilities.js +46 -1
- package/dist/utils/api/config.d.ts +20 -0
- package/dist/utils/api/config.js +10 -0
- package/dist/utils/api/grpc.d.ts +9 -0
- package/dist/utils/api/grpc.js +37 -0
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Connectors runtime's HTTP endpoints, reached through the ingress.
|
|
3
|
+
*
|
|
4
|
+
* The self-managed bundle leaves `/inbound` and the actuator open (only
|
|
5
|
+
* `/configurations/**` is secured), so these calls carry no credentials. They
|
|
6
|
+
* prove the route and that the runtime is up and serving its inbound
|
|
7
|
+
* registry; connector behaviour is tested in camunda/connectors and in the
|
|
8
|
+
* browser suites' connector flows.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The Connectors runtime's HTTP endpoints, reached through the ingress.
|
|
4
|
+
*
|
|
5
|
+
* The self-managed bundle leaves `/inbound` and the actuator open (only
|
|
6
|
+
* `/configurations/**` is secured), so these calls carry no credentials. They
|
|
7
|
+
* prove the route and that the runtime is up and serving its inbound
|
|
8
|
+
* registry; connector behaviour is tested in camunda/connectors and in the
|
|
9
|
+
* browser suites' connector flows.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const api_1 = require("../../../fixtures/api");
|
|
13
|
+
const test_1 = require("@playwright/test");
|
|
14
|
+
const capabilities_1 = require("../../../utils/api/capabilities");
|
|
15
|
+
const config_1 = require("../../../utils/api/config");
|
|
16
|
+
const base = config_1.apiConfig.components.connectors;
|
|
17
|
+
api_1.test.describe('Connectors runtime API', () => {
|
|
18
|
+
const unavailable = (0, capabilities_1.componentUnavailable)('connectors');
|
|
19
|
+
api_1.test.skip(!!unavailable, unavailable || '');
|
|
20
|
+
(0, api_1.test)('reports itself healthy', async ({ request }) => {
|
|
21
|
+
const response = await request.get(`${base}/actuator/health`);
|
|
22
|
+
(0, test_1.expect)(response.status()).toBe(200);
|
|
23
|
+
(0, test_1.expect)(await response.json()).toMatchObject({ status: 'UP' });
|
|
24
|
+
});
|
|
25
|
+
(0, api_1.test)('lists active inbound connectors', async ({ request }) => {
|
|
26
|
+
const response = await request.get(`${base}/inbound`);
|
|
27
|
+
(0, test_1.expect)(response.status()).toBe(200);
|
|
28
|
+
(0, test_1.expect)(Array.isArray(await response.json())).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Console Self-Managed's Administration API (`/admin-api`), 8.8 and 8.9 only.
|
|
3
|
+
*
|
|
4
|
+
* The API checks the token's issuer and the `console-api` audience, nothing
|
|
5
|
+
* else, so a listing plus the refusal of an anonymous call covers what a Helm
|
|
6
|
+
* deployment decides: the route and the audience wiring.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Console Self-Managed's Administration API (`/admin-api`), 8.8 and 8.9 only.
|
|
4
|
+
*
|
|
5
|
+
* The API checks the token's issuer and the `console-api` audience, nothing
|
|
6
|
+
* else, so a listing plus the refusal of an anonymous call covers what a Helm
|
|
7
|
+
* deployment decides: the route and the audience wiring.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const api_1 = require("../../../fixtures/api");
|
|
11
|
+
const test_1 = require("@playwright/test");
|
|
12
|
+
const auth_1 = require("../../../utils/api/auth");
|
|
13
|
+
const capabilities_1 = require("../../../utils/api/capabilities");
|
|
14
|
+
const config_1 = require("../../../utils/api/config");
|
|
15
|
+
const base = config_1.apiConfig.components.console;
|
|
16
|
+
api_1.test.describe('Console Administration API', () => {
|
|
17
|
+
const unavailable = (0, capabilities_1.componentUnavailable)('console');
|
|
18
|
+
api_1.test.skip(!!unavailable, unavailable || '');
|
|
19
|
+
(0, api_1.test)('lists clusters', async ({ request }) => {
|
|
20
|
+
const response = await request.get(`${base}/admin-api/clusters`, {
|
|
21
|
+
headers: { Authorization: await (0, auth_1.authHeader)(request) },
|
|
22
|
+
});
|
|
23
|
+
(0, test_1.expect)(response.status()).toBe(200);
|
|
24
|
+
(0, test_1.expect)(Array.isArray(await response.json())).toBe(true);
|
|
25
|
+
});
|
|
26
|
+
(0, api_1.test)('refuses a request without a token', async ({ request }) => {
|
|
27
|
+
const response = await request.get(`${base}/admin-api/clusters`);
|
|
28
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Management Identity's API (`/identity/api`), reached through the ingress
|
|
3
|
+
* with the suite's client-credentials token.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately thin: it proves the route, the token audience
|
|
6
|
+
* (`camunda-identity-resource-server`) and one write, which is what a Helm
|
|
7
|
+
* deployment can get wrong. Identity's own behaviour is tested in its repo.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Management Identity's API (`/identity/api`), reached through the ingress
|
|
4
|
+
* with the suite's client-credentials token.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately thin: it proves the route, the token audience
|
|
7
|
+
* (`camunda-identity-resource-server`) and one write, which is what a Helm
|
|
8
|
+
* deployment can get wrong. Identity's own behaviour is tested in its repo.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
const api_1 = require("../../../fixtures/api");
|
|
12
|
+
const test_1 = require("@playwright/test");
|
|
13
|
+
const auth_1 = require("../../../utils/api/auth");
|
|
14
|
+
const bpmn_1 = require("../../../utils/api/bpmn");
|
|
15
|
+
const capabilities_1 = require("../../../utils/api/capabilities");
|
|
16
|
+
const config_1 = require("../../../utils/api/config");
|
|
17
|
+
const base = config_1.apiConfig.components.identity;
|
|
18
|
+
api_1.test.describe('Management Identity API', () => {
|
|
19
|
+
const unavailable = (0, capabilities_1.componentUnavailable)('identity');
|
|
20
|
+
api_1.test.skip(!!unavailable, unavailable || '');
|
|
21
|
+
(0, api_1.test)('lists roles', async ({ request }) => {
|
|
22
|
+
const response = await request.get(`${base}/api/roles`, {
|
|
23
|
+
headers: { Authorization: await (0, auth_1.authHeader)(request) },
|
|
24
|
+
});
|
|
25
|
+
(0, test_1.expect)(response.status()).toBe(200);
|
|
26
|
+
(0, test_1.expect)(Array.isArray(await response.json())).toBe(true);
|
|
27
|
+
});
|
|
28
|
+
(0, api_1.test)('creates and deletes a role', async ({ request }) => {
|
|
29
|
+
const headers = { Authorization: await (0, auth_1.authHeader)(request) };
|
|
30
|
+
const name = (0, bpmn_1.uniqueId)('api-smoke-role');
|
|
31
|
+
const created = await request.post(`${base}/api/roles`, {
|
|
32
|
+
headers,
|
|
33
|
+
data: { name, description: 'Created by the API smoke test' },
|
|
34
|
+
});
|
|
35
|
+
(0, test_1.expect)(created.status()).toBe(204);
|
|
36
|
+
try {
|
|
37
|
+
const roles = (await (await request.get(`${base}/api/roles`, { headers })).json());
|
|
38
|
+
(0, test_1.expect)(roles.map((role) => role.name)).toContain(name);
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
const deleted = await request.delete(`${base}/api/roles/${encodeURIComponent(name)}`, { headers });
|
|
42
|
+
(0, test_1.expect)(deleted.status()).toBe(204);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
(0, api_1.test)('refuses a request without a token', async ({ request }) => {
|
|
46
|
+
const response = await request.get(`${base}/api/roles`);
|
|
47
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Web Modeler public API (`/modeler/api/v1`, served by Camunda Hub from
|
|
3
|
+
* 8.10), 8.9 onwards.
|
|
4
|
+
*
|
|
5
|
+
* The token must carry the `web-modeler-public-api` audience with the
|
|
6
|
+
* matching `read:*`, `create:*` and `delete:*` permissions; the internal
|
|
7
|
+
* `web-modeler-api` audience is not enough. The API's own behaviour is
|
|
8
|
+
* covered in camunda/camunda-hub; this proves the route, the audience and one
|
|
9
|
+
* write through a Helm deployment.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The Web Modeler public API (`/modeler/api/v1`, served by Camunda Hub from
|
|
4
|
+
* 8.10), 8.9 onwards.
|
|
5
|
+
*
|
|
6
|
+
* The token must carry the `web-modeler-public-api` audience with the
|
|
7
|
+
* matching `read:*`, `create:*` and `delete:*` permissions; the internal
|
|
8
|
+
* `web-modeler-api` audience is not enough. The API's own behaviour is
|
|
9
|
+
* covered in camunda/camunda-hub; this proves the route, the audience and one
|
|
10
|
+
* write through a Helm deployment.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
const api_1 = require("../../../fixtures/api");
|
|
14
|
+
const test_1 = require("@playwright/test");
|
|
15
|
+
const auth_1 = require("../../../utils/api/auth");
|
|
16
|
+
const bpmn_1 = require("../../../utils/api/bpmn");
|
|
17
|
+
const capabilities_1 = require("../../../utils/api/capabilities");
|
|
18
|
+
const config_1 = require("../../../utils/api/config");
|
|
19
|
+
const base = config_1.apiConfig.components.webModeler;
|
|
20
|
+
api_1.test.describe('Web Modeler public API', () => {
|
|
21
|
+
const unavailable = (0, capabilities_1.componentUnavailable)('webModeler');
|
|
22
|
+
api_1.test.skip(!!unavailable, unavailable || '');
|
|
23
|
+
(0, api_1.test)('describes the API to an authenticated caller', async ({ request }) => {
|
|
24
|
+
const response = await request.get(`${base}/api/v1/info`, {
|
|
25
|
+
headers: { Authorization: await (0, auth_1.authHeader)(request) },
|
|
26
|
+
});
|
|
27
|
+
(0, test_1.expect)(response.status()).toBe(200);
|
|
28
|
+
(0, test_1.expect)(await response.json()).toEqual(test_1.expect.any(Object));
|
|
29
|
+
});
|
|
30
|
+
(0, api_1.test)('creates and deletes a project', async ({ request }) => {
|
|
31
|
+
const headers = { Authorization: await (0, auth_1.authHeader)(request) };
|
|
32
|
+
const created = await request.post(`${base}/api/v1/projects`, {
|
|
33
|
+
headers,
|
|
34
|
+
data: { name: (0, bpmn_1.uniqueId)('api-smoke-project') },
|
|
35
|
+
});
|
|
36
|
+
const id = (await created.json().catch(() => ({}))).id;
|
|
37
|
+
try {
|
|
38
|
+
(0, test_1.expect)(created.status()).toBe(200);
|
|
39
|
+
(0, test_1.expect)(id).toBeTruthy();
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
// Runs whenever the POST returned an id, so a failed assertion above
|
|
43
|
+
// cannot leave the project behind.
|
|
44
|
+
if (id) {
|
|
45
|
+
const deleted = await request.delete(`${base}/api/v1/projects/${id}`, {
|
|
46
|
+
headers,
|
|
47
|
+
});
|
|
48
|
+
(0, test_1.expect)(deleted.status()).toBe(204);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
(0, api_1.test)('refuses a request without a token', async ({ request }) => {
|
|
53
|
+
const response = await request.get(`${base}/api/v1/info`);
|
|
54
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Zeebe gRPC API, reached through the same ingress and identity provider
|
|
3
|
+
* as the REST suite.
|
|
4
|
+
*
|
|
5
|
+
* gRPC has its own ingress host, TLS termination and token check, and none of
|
|
6
|
+
* the REST specs touches them: a cluster whose REST API passes can still
|
|
7
|
+
* refuse every gRPC client. These tests stay thin — one read, one command
|
|
8
|
+
* round trip and the authentication check — because the engine behaviour
|
|
9
|
+
* behind the commands is what the REST specs cover.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The Zeebe gRPC API, reached through the same ingress and identity provider
|
|
4
|
+
* as the REST suite.
|
|
5
|
+
*
|
|
6
|
+
* gRPC has its own ingress host, TLS termination and token check, and none of
|
|
7
|
+
* the REST specs touches them: a cluster whose REST API passes can still
|
|
8
|
+
* refuse every gRPC client. These tests stay thin — one read, one command
|
|
9
|
+
* round trip and the authentication check — because the engine behaviour
|
|
10
|
+
* behind the commands is what the REST specs cover.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
const api_1 = require("../../../fixtures/api");
|
|
14
|
+
const test_1 = require("@playwright/test");
|
|
15
|
+
const bpmn_1 = require("../../../utils/api/bpmn");
|
|
16
|
+
const capabilities_1 = require("../../../utils/api/capabilities");
|
|
17
|
+
const grpc_1 = require("../../../utils/api/grpc");
|
|
18
|
+
api_1.test.describe('gRPC', () => {
|
|
19
|
+
api_1.test.skip(!!capabilities_1.grpcUnavailable, capabilities_1.grpcUnavailable || '');
|
|
20
|
+
let zbc;
|
|
21
|
+
api_1.test.beforeEach(() => {
|
|
22
|
+
zbc = (0, grpc_1.grpcClient)();
|
|
23
|
+
});
|
|
24
|
+
api_1.test.afterEach(async () => {
|
|
25
|
+
await zbc.close();
|
|
26
|
+
});
|
|
27
|
+
(0, api_1.test)('reports the cluster topology', async () => {
|
|
28
|
+
const topology = await zbc.topology();
|
|
29
|
+
(0, test_1.expect)(topology.brokers.length).toBeGreaterThan(0);
|
|
30
|
+
(0, test_1.expect)(topology.partitionsCount).toBeGreaterThan(0);
|
|
31
|
+
(0, test_1.expect)(topology.gatewayVersion).not.toBe('');
|
|
32
|
+
});
|
|
33
|
+
(0, api_1.test)('deploys a process and runs an instance to completion', async ({ resources, }) => {
|
|
34
|
+
const processId = (0, bpmn_1.uniqueId)('grpc-roundtrip');
|
|
35
|
+
const deployment = await zbc.deployResource({
|
|
36
|
+
name: `${processId}.bpmn`,
|
|
37
|
+
process: Buffer.from((0, bpmn_1.emptyProcess)(processId)),
|
|
38
|
+
});
|
|
39
|
+
const definition = deployment.deployments[0].process;
|
|
40
|
+
resources.track('resource', definition.processDefinitionKey);
|
|
41
|
+
(0, test_1.expect)(definition.bpmnProcessId).toBe(processId);
|
|
42
|
+
const marker = (0, bpmn_1.uniqueId)('marker');
|
|
43
|
+
const result = await zbc.createProcessInstanceWithResult({
|
|
44
|
+
bpmnProcessId: processId,
|
|
45
|
+
variables: { marker },
|
|
46
|
+
requestTimeout: 30000,
|
|
47
|
+
});
|
|
48
|
+
(0, test_1.expect)(result.processDefinitionKey).toBe(definition.processDefinitionKey);
|
|
49
|
+
(0, test_1.expect)(result.variables).toMatchObject({ marker });
|
|
50
|
+
});
|
|
51
|
+
(0, api_1.test)('refuses a call without credentials', async () => {
|
|
52
|
+
api_1.test.skip(!!capabilities_1.unauthenticatedAccessAllowed, capabilities_1.unauthenticatedAccessAllowed || '');
|
|
53
|
+
const anonymous = (0, grpc_1.grpcClient)({ authenticated: false });
|
|
54
|
+
try {
|
|
55
|
+
// 16 is UNAUTHENTICATED in the gRPC status code table.
|
|
56
|
+
await (0, test_1.expect)(anonymous.topology()).rejects.toMatchObject({ code: 16 });
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
await anonymous.close();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* role that was not granted — is a failure, not a capability, and must stay
|
|
21
21
|
* red.
|
|
22
22
|
*/
|
|
23
|
+
import { apiConfig } from './config';
|
|
23
24
|
import type { ApiClient } from './http';
|
|
24
25
|
/**
|
|
25
26
|
* Reason text for the `/v2/users/**` gate, or `false` when the tree is served.
|
|
@@ -53,6 +54,14 @@ export declare const usersApiUnavailable: string | false;
|
|
|
53
54
|
*/
|
|
54
55
|
export declare const unauthenticatedAccessAllowed: string | false;
|
|
55
56
|
export declare const enforcementPrincipalUnavailable: string | false;
|
|
57
|
+
/**
|
|
58
|
+
* Reason text for the gRPC gate, or `false` when the run names a gateway.
|
|
59
|
+
*
|
|
60
|
+
* Unlike the gates above this is not a property of the cluster: every
|
|
61
|
+
* supported minor serves gRPC. It is a property of the run, since only a
|
|
62
|
+
* runner that knows the ingress host can say where the gateway is.
|
|
63
|
+
*/
|
|
64
|
+
export declare const grpcUnavailable: string | false;
|
|
56
65
|
export declare const absentUserMembership: {
|
|
57
66
|
status: number;
|
|
58
67
|
reason: string;
|
|
@@ -71,3 +80,16 @@ export declare const absentUserMembership: {
|
|
|
71
80
|
* is a finding, not a reason to stop looking.
|
|
72
81
|
*/
|
|
73
82
|
export declare function readAuthorizationsEnabled(api: ApiClient): Promise<boolean | undefined>;
|
|
83
|
+
type Component = keyof typeof apiConfig.components;
|
|
84
|
+
/**
|
|
85
|
+
* Reason text for a component spec's gate, or `false` when it can run.
|
|
86
|
+
*
|
|
87
|
+
* A component runs only where the run names its URL, since which components
|
|
88
|
+
* a deployment has is the runner's knowledge. Two are also bound to a version
|
|
89
|
+
* range: 8.10 has no standalone Console (its UI moved into Camunda Hub, and
|
|
90
|
+
* the chart has no Console templates), and before 8.9 the chart routes
|
|
91
|
+
* `/modeler` to the Web Modeler webapp rather than to the REST API that
|
|
92
|
+
* serves `/api/v1`.
|
|
93
|
+
*/
|
|
94
|
+
export declare function componentUnavailable(component: Component): string | false;
|
|
95
|
+
export {};
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* red.
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.readAuthorizationsEnabled = exports.absentUserMembership = exports.enforcementPrincipalUnavailable = exports.unauthenticatedAccessAllowed = exports.usersApiUnavailable = void 0;
|
|
25
|
+
exports.componentUnavailable = exports.readAuthorizationsEnabled = exports.absentUserMembership = exports.grpcUnavailable = exports.enforcementPrincipalUnavailable = exports.unauthenticatedAccessAllowed = exports.usersApiUnavailable = void 0;
|
|
26
26
|
const config_1 = require("./config");
|
|
27
27
|
/**
|
|
28
28
|
* Reason text for the `/v2/users/**` gate, or `false` when the tree is served.
|
|
@@ -120,6 +120,17 @@ function enforcementUnavailableReason() {
|
|
|
120
120
|
return false;
|
|
121
121
|
}
|
|
122
122
|
exports.enforcementPrincipalUnavailable = enforcementUnavailableReason();
|
|
123
|
+
/**
|
|
124
|
+
* Reason text for the gRPC gate, or `false` when the run names a gateway.
|
|
125
|
+
*
|
|
126
|
+
* Unlike the gates above this is not a property of the cluster: every
|
|
127
|
+
* supported minor serves gRPC. It is a property of the run, since only a
|
|
128
|
+
* runner that knows the ingress host can say where the gateway is.
|
|
129
|
+
*/
|
|
130
|
+
exports.grpcUnavailable = config_1.apiConfig.grpc.address
|
|
131
|
+
? false
|
|
132
|
+
: 'GRPC_ADDRESS is not set, so this run names no gRPC gateway — see ' +
|
|
133
|
+
'tests/api/README.md';
|
|
123
134
|
/**
|
|
124
135
|
* What `PUT /{roles,groups,tenants}/{id}/users/{username}` does when the
|
|
125
136
|
* username belongs to nobody.
|
|
@@ -224,3 +235,37 @@ async function readAuthorizationsEnabled(api) {
|
|
|
224
235
|
return json.authorizationsEnabled;
|
|
225
236
|
}
|
|
226
237
|
exports.readAuthorizationsEnabled = readAuthorizationsEnabled;
|
|
238
|
+
const COMPONENT_VARIABLES = {
|
|
239
|
+
identity: 'API_IDENTITY_URL',
|
|
240
|
+
connectors: 'API_CONNECTORS_URL',
|
|
241
|
+
console: 'API_CONSOLE_URL',
|
|
242
|
+
webModeler: 'API_WEB_MODELER_URL',
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Reason text for a component spec's gate, or `false` when it can run.
|
|
246
|
+
*
|
|
247
|
+
* A component runs only where the run names its URL, since which components
|
|
248
|
+
* a deployment has is the runner's knowledge. Two are also bound to a version
|
|
249
|
+
* range: 8.10 has no standalone Console (its UI moved into Camunda Hub, and
|
|
250
|
+
* the chart has no Console templates), and before 8.9 the chart routes
|
|
251
|
+
* `/modeler` to the Web Modeler webapp rather than to the REST API that
|
|
252
|
+
* serves `/api/v1`.
|
|
253
|
+
*/
|
|
254
|
+
function componentUnavailable(component) {
|
|
255
|
+
if (!config_1.apiConfig.components[component]) {
|
|
256
|
+
return `${COMPONENT_VARIABLES[component]} is not set, so this run names no ${component} to call`;
|
|
257
|
+
}
|
|
258
|
+
// Connectors' inbound and actuator endpoints need no credentials; the others
|
|
259
|
+
// take the suite's client-credentials token.
|
|
260
|
+
if (component !== 'connectors' && config_1.apiConfig.authMethod !== 'oauth2') {
|
|
261
|
+
return `the ${component} API takes an OAuth2 token, and this run authenticates with ${config_1.apiConfig.authMethod}`;
|
|
262
|
+
}
|
|
263
|
+
if (component === 'console' && (0, config_1.atLeastVersion)('8.10')) {
|
|
264
|
+
return '8.10 ships no standalone Console, so there is no Administration API to call';
|
|
265
|
+
}
|
|
266
|
+
if (component === 'webModeler' && !(0, config_1.atLeastVersion)('8.9')) {
|
|
267
|
+
return 'before 8.9 the chart routes /modeler to the Web Modeler webapp, not its public API';
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
exports.componentUnavailable = componentUnavailable;
|
|
@@ -93,6 +93,26 @@ export interface ApiConfig {
|
|
|
93
93
|
clientId: string;
|
|
94
94
|
clientSecret: string;
|
|
95
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* The cluster's Zeebe gRPC gateway, as `host:port`, for the gRPC spec.
|
|
98
|
+
* Read from `GRPC_ADDRESS`; the spec runs when it is set and skips when it
|
|
99
|
+
* is empty. It authenticates the same way as the REST client above.
|
|
100
|
+
*/
|
|
101
|
+
grpc: {
|
|
102
|
+
address: string;
|
|
103
|
+
useTls: boolean;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Base URLs, context path included, of the other components the component
|
|
107
|
+
* specs smoke-test, e.g. `https://<host>/identity`. A component's spec runs
|
|
108
|
+
* when its URL is set and skips when it is empty.
|
|
109
|
+
*/
|
|
110
|
+
components: {
|
|
111
|
+
identity: string;
|
|
112
|
+
connectors: string;
|
|
113
|
+
console: string;
|
|
114
|
+
webModeler: string;
|
|
115
|
+
};
|
|
96
116
|
}
|
|
97
117
|
export declare function loadApiConfig(): ApiConfig;
|
|
98
118
|
export declare const apiConfig: ApiConfig;
|
package/dist/utils/api/config.js
CHANGED
|
@@ -43,6 +43,16 @@ function loadApiConfig() {
|
|
|
43
43
|
clientId: env('SECONDARY_CLIENT_ID'),
|
|
44
44
|
clientSecret: env('SECONDARY_CLIENT_SECRET'),
|
|
45
45
|
},
|
|
46
|
+
grpc: {
|
|
47
|
+
address: env('GRPC_ADDRESS'),
|
|
48
|
+
useTls: env('GRPC_TLS', 'true') === 'true',
|
|
49
|
+
},
|
|
50
|
+
components: {
|
|
51
|
+
identity: env('API_IDENTITY_URL').replace(/\/+$/, ''),
|
|
52
|
+
connectors: env('API_CONNECTORS_URL').replace(/\/+$/, ''),
|
|
53
|
+
console: env('API_CONSOLE_URL').replace(/\/+$/, ''),
|
|
54
|
+
webModeler: env('API_WEB_MODELER_URL').replace(/\/+$/, ''),
|
|
55
|
+
},
|
|
46
56
|
};
|
|
47
57
|
}
|
|
48
58
|
exports.loadApiConfig = loadApiConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Zeebe gRPC client for the gRPC spec, built from the same configuration as
|
|
3
|
+
* the REST `ApiClient`: OAuth2 client credentials or basic auth, and the
|
|
4
|
+
* tenant on a multi-tenant cluster.
|
|
5
|
+
*/
|
|
6
|
+
import { ZBClient } from 'zeebe-node';
|
|
7
|
+
export declare function grpcClient(options?: {
|
|
8
|
+
authenticated?: boolean;
|
|
9
|
+
}): ZBClient;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A Zeebe gRPC client for the gRPC spec, built from the same configuration as
|
|
4
|
+
* the REST `ApiClient`: OAuth2 client credentials or basic auth, and the
|
|
5
|
+
* tenant on a multi-tenant cluster.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.grpcClient = void 0;
|
|
9
|
+
const zeebe_node_1 = require("zeebe-node");
|
|
10
|
+
const config_1 = require("./config");
|
|
11
|
+
function grpcClient(options = {}) {
|
|
12
|
+
const authenticated = options.authenticated ?? true;
|
|
13
|
+
const { oauth, basic } = config_1.apiConfig;
|
|
14
|
+
return new zeebe_node_1.ZBClient(config_1.apiConfig.grpc.address, {
|
|
15
|
+
useTLS: config_1.apiConfig.grpc.useTls,
|
|
16
|
+
// A failed call must surface as the failure, not as a retry loop that
|
|
17
|
+
// outlasts the test timeout.
|
|
18
|
+
retry: false,
|
|
19
|
+
loglevel: 'NONE',
|
|
20
|
+
...(config_1.apiConfig.multiTenancy ? { tenantId: config_1.apiConfig.tenantId } : {}),
|
|
21
|
+
...(!authenticated
|
|
22
|
+
? {}
|
|
23
|
+
: config_1.apiConfig.authMethod === 'basic'
|
|
24
|
+
? { basicAuth: { username: basic.username, password: basic.password } }
|
|
25
|
+
: {
|
|
26
|
+
oAuth: {
|
|
27
|
+
url: oauth.tokenUrl,
|
|
28
|
+
audience: oauth.audience,
|
|
29
|
+
...(oauth.scope ? { scope: oauth.scope } : {}),
|
|
30
|
+
clientId: oauth.clientId,
|
|
31
|
+
clientSecret: oauth.clientSecret,
|
|
32
|
+
cacheOnDisk: false,
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.grpcClient = grpcClient;
|