From bfa809ded711625cf1936070d3dee67b14e1099e Mon Sep 17 00:00:00 2001 From: Christopher Zell Date: Wed, 7 Dec 2022 21:13:50 +0100 Subject: [PATCH 1/4] refactor: unify models --- go-chaos/internal/bpmn/msg-catch.bpmn | 22 +++++----- .../internal/bpmn/oneReceiveMsgEvent.bpmn | 44 ------------------- 2 files changed, 11 insertions(+), 55 deletions(-) delete mode 100644 go-chaos/internal/bpmn/oneReceiveMsgEvent.bpmn diff --git a/go-chaos/internal/bpmn/msg-catch.bpmn b/go-chaos/internal/bpmn/msg-catch.bpmn index 16063c251..3c47e6750 100644 --- a/go-chaos/internal/bpmn/msg-catch.bpmn +++ b/go-chaos/internal/bpmn/msg-catch.bpmn @@ -1,6 +1,6 @@ - - + + Flow_1gq79wv @@ -22,15 +22,7 @@ - - - - - - - - - + @@ -49,6 +41,14 @@ + + + + + + + + diff --git a/go-chaos/internal/bpmn/oneReceiveMsgEvent.bpmn b/go-chaos/internal/bpmn/oneReceiveMsgEvent.bpmn deleted file mode 100644 index b7d335eed..000000000 --- a/go-chaos/internal/bpmn/oneReceiveMsgEvent.bpmn +++ /dev/null @@ -1,44 +0,0 @@ - - - - - Flow_1m8gt0g - - - - Flow_1m8gt0g - Flow_1njc5pr - - - - Flow_1njc5pr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From d210f7bb1a8278db3ed13757821ee9b064557bab Mon Sep 17 00:00:00 2001 From: Christopher Zell Date: Thu, 8 Dec 2022 09:00:27 +0100 Subject: [PATCH 2/4] feat: allow to reference bundled processes --- go-chaos/cmd/deploy.go | 2 +- go-chaos/internal/zeebe.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/go-chaos/cmd/deploy.go b/go-chaos/cmd/deploy.go index 33f7565ef..3878ef6fd 100644 --- a/go-chaos/cmd/deploy.go +++ b/go-chaos/cmd/deploy.go @@ -25,7 +25,7 @@ func init() { deployCmd.AddCommand(deployProcessModelCmd) deployProcessModelCmd.Flags().StringVar(&processModelPath, "processModelPath", "", - "Specify the path to a BPMN process model, which should be deployed. Defaults to a benchmark process model with one task (included in zbchaos).") + "Specify the path to a BPMN process model, which should be deployed. Defaults to a benchmark process model with one task (included in zbchaos). If the path starts with 'bpmn/' zbchaos will look for a referenced model bundled within the cli, like: 'bpmn/one_task.bpmn'.") deployCmd.AddCommand(deployMultiVersionProcessModelCmd) deployMultiVersionProcessModelCmd.Flags().IntVar(&versionCount, "versionCount", 10, diff --git a/go-chaos/internal/zeebe.go b/go-chaos/internal/zeebe.go index c07d3dfbf..c89026d82 100644 --- a/go-chaos/internal/zeebe.go +++ b/go-chaos/internal/zeebe.go @@ -20,6 +20,7 @@ import ( "errors" "fmt" "os" + "strings" "time" "github.com/camunda/zeebe/clients/go/v8/pkg/pb" @@ -260,7 +261,11 @@ func readBPMNFileOrDefault(fileName string) ([]byte, string, error) { if len(fileName) == 0 { fileName = "bpmn/one_task.bpmn" - + bpmnBytes, err = bpmnContent.ReadFile(fileName) + if err != nil { + return nil, "", err + } + } else if strings.Contains(fileName, "bpmn/") { bpmnBytes, err = bpmnContent.ReadFile(fileName) if err != nil { return nil, "", err From 9ec65d237f07a92f56358f472cb5a43d94ff7111 Mon Sep 17 00:00:00 2001 From: Christopher Zell Date: Thu, 8 Dec 2022 09:00:44 +0100 Subject: [PATCH 3/4] test: rm json logging, for easier reading --- go-chaos/integration/integration_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/go-chaos/integration/integration_test.go b/go-chaos/integration/integration_test.go index 6cc8d287a..23190d179 100644 --- a/go-chaos/integration/integration_test.go +++ b/go-chaos/integration/integration_test.go @@ -49,7 +49,6 @@ func Test_ShouldBeAbleToRunExperiments(t *testing.T) { // given internal.Verbosity = true cmd.Verbose = true - cmd.JsonLogging = true ctx := context.Background() container := CreateEZEContainer(t, ctx) defer container.StopLogProducer() From 7380c3943c54cae2d7e8152f77c688e7ae32feba Mon Sep 17 00:00:00 2001 From: Christopher Zell Date: Thu, 8 Dec 2022 09:01:07 +0100 Subject: [PATCH 4/4] feat: migrate message correlation --- .../msg-correlation/experiment.json | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/go-chaos/internal/chaos-experiments/camunda-cloud/production-s/msg-correlation/experiment.json b/go-chaos/internal/chaos-experiments/camunda-cloud/production-s/msg-correlation/experiment.json index 8fd1d57ef..137fe34e2 100644 --- a/go-chaos/internal/chaos-experiments/camunda-cloud/production-s/msg-correlation/experiment.json +++ b/go-chaos/internal/chaos-experiments/camunda-cloud/production-s/msg-correlation/experiment.json @@ -15,21 +15,32 @@ "tolerance": 0, "provider": { "type": "process", - "path": "verify-readiness.sh", + "path": "zbchaos", + "arguments": ["verify", "readiness"], "timeout": 900 } } ] }, "method": [ + { + "name": "Deploy process model with catch event", + "type": "action", + "tolerance": 0, + "provider": { + "type": "process", + "path": "zbchaos", + "arguments": ["deploy", "process", "--processModelPath", "bpmn/msg-catch.bpmn"] + } + }, { "type": "action", "name": "Publish message to partition one", "tolerance": 0, "provider": { "type": "process", - "path": "publish-message.sh", - "timeout": 900 + "path": "zbchaos", + "arguments": ["publish", "--partitionId", "1"] } }, { @@ -37,19 +48,33 @@ "name": "Terminate leader of partition 1 non-gracefully", "provider": { "type": "process", - "path": "terminate-partition.sh", - "arguments": [ "Leader", "1" ] + "path": "zbchaos", + "arguments": ["terminate", "broker", "--role", "LEADER", "--partitionId", "1"] } }, { - "name": "Should be able to create a process and await the message correlation", - "type": "probe", - "tolerance": 0, - "provider": { - "type": "process", - "path": "await-message-correlation.sh", - "timeout": 900 - } + "name": "All pods should be ready", + "type": "probe", + "tolerance": 0, + "provider": { + "type": "process", + "path": "zbchaos", + "arguments": ["verify", "readiness"], + "timeout": 900 + } + }, + { + "name": "Should be able to create a process instance and await the message correlation", + "type": "probe", + "tolerance": 0, + "provider": { + "type": "process", + "path": "zbchaos", + "arguments": ["verify", "instance-creation", + "--awaitResult", + "--bpmnProcessId", "oneReceiveMsgEvent", + "--variables", "{\"key\": \"0\"}"] + } } ], "rollbacks": []