-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(zeebe): implement deleteResource (#73)
- Loading branch information
Showing
19 changed files
with
240 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Run Local Integration Tests Multitenant | ||
|
||
on: [push] | ||
|
||
jobs: | ||
local_integration: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: selfhosted | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" # Specify a Node.js version | ||
|
||
# This is to force nx arch-specific packages to correctly install | ||
# This is to work around https://github.com/npm/cli/issues/4828 | ||
- name: Remove package-lock.json | ||
run: rm -f package-lock.json | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
# Workaround for https://github.com/actions/runner-images/issues/2821 | ||
- name: Remove mono blocking 8084 port | ||
run: sudo kill -9 $(sudo lsof -t -i:8084) | ||
|
||
- name: Set up Docker | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} registry.camunda.cloud | ||
- name: Set up Docker Compose | ||
run: | | ||
docker-compose -f docker/docker-compose-multitenancy.yml -f docker/docker-compose-modeler.yaml up -d | ||
- name: Run Integration Tests | ||
run: | | ||
npm run test:multitenancy | ||
env: | ||
CAMUNDA_SECURE_CONNECTION: false | ||
ZEEBE_ADDRESS: localhost:26500 | ||
ZEEBE_CLIENT_ID: zeebe | ||
ZEEBE_CLIENT_SECRET: zecret | ||
CAMUNDA_OAUTH_URL: http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token | ||
CAMUNDA_TASKLIST_BASE_URL: http://localhost:8082 | ||
CAMUNDA_OPERATE_BASE_URL: http://localhost:8081 | ||
CAMUNDA_OPTIMIZE_BASE_URL: http://localhost:8083 | ||
CAMUNDA_MODELER_BASE_URL: http://localhost:8070/api | ||
# Needed for Multi-Tenancy | ||
CAMUNDA_TENANT_ID: <default> | ||
|
||
- name: Cleanup | ||
if: always() | ||
run: docker-compose -f docker/docker-compose-multitenancy.yml -f docker/docker-compose-modeler.yaml down |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0gtgqqw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.21.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.4.0"> | ||
<bpmn:process id="delete-me" name="DeleteResource" isExecutable="true"> | ||
<bpmn:startEvent id="StartEvent_1" name="Start"> | ||
<bpmn:outgoing>Flow_0fgdzij</bpmn:outgoing> | ||
</bpmn:startEvent> | ||
<bpmn:sequenceFlow id="Flow_0fgdzij" sourceRef="StartEvent_1" targetRef="Activity_0ui3en7" /> | ||
<bpmn:endEvent id="Event_1wzv4ji" name="End"> | ||
<bpmn:incoming>Flow_0l1o4z0</bpmn:incoming> | ||
</bpmn:endEvent> | ||
<bpmn:sequenceFlow id="Flow_0l1o4z0" name="End" sourceRef="Activity_0ui3en7" targetRef="Event_1wzv4ji" /> | ||
<bpmn:serviceTask id="Activity_0ui3en7" name="Never Executed"> | ||
<bpmn:extensionElements> | ||
<zeebe:taskDefinition type="never-executed" /> | ||
</bpmn:extensionElements> | ||
<bpmn:incoming>Flow_0fgdzij</bpmn:incoming> | ||
<bpmn:outgoing>Flow_0l1o4z0</bpmn:outgoing> | ||
</bpmn:serviceTask> | ||
</bpmn:process> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="delete-me"> | ||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> | ||
<dc:Bounds x="179" y="99" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="185" y="142" width="24" height="14" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Event_1wzv4ji_di" bpmnElement="Event_1wzv4ji"> | ||
<dc:Bounds x="432" y="99" width="36" height="36" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="440" y="142" width="20" height="14" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Activity_05jxyb8_di" bpmnElement="Activity_0ui3en7"> | ||
<dc:Bounds x="270" y="77" width="100" height="80" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge id="Flow_0fgdzij_di" bpmnElement="Flow_0fgdzij"> | ||
<di:waypoint x="215" y="117" /> | ||
<di:waypoint x="270" y="117" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_0l1o4z0_di" bpmnElement="Flow_0l1o4z0"> | ||
<di:waypoint x="370" y="117" /> | ||
<di:waypoint x="432" y="117" /> | ||
<bpmndi:BPMNLabel> | ||
<dc:Bounds x="391" y="99" width="20" height="14" /> | ||
</bpmndi:BPMNLabel> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |
39 changes: 39 additions & 0 deletions
39
src/__tests__/zeebe/integration/Client-DeleteResource.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { restoreZeebeLogging, suppressZeebeLogging } from 'lib' | ||
import { ZeebeGrpcClient } from 'zeebe' | ||
|
||
jest.setTimeout(20000) | ||
|
||
suppressZeebeLogging() | ||
|
||
afterAll(() => restoreZeebeLogging()) | ||
|
||
test('can delete a resource', async () => { | ||
let thrown = false | ||
const zbc = new ZeebeGrpcClient() | ||
|
||
const deployment = await zbc.deployResource({ | ||
processFilename: './src/__tests__/testdata/DeleteResource.bpmn', | ||
}) | ||
|
||
const resourceKey = deployment.deployments[0].process.processDefinitionKey | ||
|
||
const process = await zbc.createProcessInstance({ | ||
bpmnProcessId: 'delete-me', | ||
variables: {}, | ||
}) | ||
|
||
await zbc.cancelProcessInstance(process.processInstanceKey) | ||
|
||
await zbc.deleteResource({ resourceKey }) | ||
try { | ||
/** This should now throw, as the resource has been deleted */ | ||
const process2 = await zbc.createProcessInstance({ | ||
bpmnProcessId: 'delete-me', | ||
variables: {}, | ||
}) | ||
await zbc.cancelProcessInstance(process2.processInstanceKey) | ||
} catch (e) { | ||
thrown = true | ||
} | ||
expect(thrown).toBe(true) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const bigIntToString = (bigInt: bigint) => bigInt.toString() | ||
export const stringToBigInt = (str: string) => BigInt(str) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const delay = (ms: number) => new Promise((res) => setTimeout(res, ms)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.