zeebe

package
v1.4.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 13 Imported by: 0

README

Start the environment

In Visual Studio Code run Remote-Containers: Open Folder in Container... from the Command Palette (F1) and select the tests/e2e/bindings/zeebe folder.

Run the tests

cd tests/e2e/bindings/zeebe/
docker-compose up -d
docker exec -w /go/src/github.com/dapr/components-contrib -it zeebe_dapr_1 make e2e-tests-zeebe

BPMN process files

The test suite uses two BPMN processes which are located in the processes folder. These processes can be edited with the Camunda Modeler

Missing tests

There is currently an issue which prevents the activate-jobs command to return the activated jobs: https://github.com/camunda-cloud/zeebe/issues/5925 This command is a prerequisite for the other commands because it returns the jobKey which the other commands need to operate an a job.

Without the working command it is not possible to write tests for he following commands:

  • activate-jobs
  • complete-job
  • fail-job
  • update-job-retries
  • throw-error

If this issue is fixed, then the tests can be written.

Currently it's not possible to get an incident key which is needed to resolve an incident.

Documentation

Index

Constants

View Source
const (
	// TestProcessFile contains the basic test process file name
	TestProcessFile string = "test.bpmn"
	// CalcProcessFile contains the calculation process file name
	CalcProcessFile string = "calc.bpmn"
)

Variables

This section is empty.

Functions

func CalcWorker

func CalcWorker(request *bindings.ReadResponse) ([]byte, error)

CalcWorker is a simple calculation worker

func Command

func Command() (*command.ZeebeCommand, error)

Command initializes the Zeebe command binding and returns it

func CreateProcessInstance

func CreateProcessInstance(
	cmd *command.ZeebeCommand,
	payload map[string]interface{}) (*pb.CreateProcessInstanceResponse, error)

CreateProcessInstance creates a process instance and returns the process instance data

func DeployProcess

func DeployProcess(
	cmd *command.ZeebeCommand,
	fileName string,
	modifiers ...func(string) string) (*pb.ProcessMetadata, error)

DeployProcess deploys a test BPMN file. The function also accepts a list of modifier functions which allows to manipulate the content of the returned BPMN file. On success the function returns a JSON with the deployment information

func GetTestFile

func GetTestFile(fileName string, modifiers ...func(string) string) ([]byte, error)

GetTestFile loads the content of a BPMN process file. The function also accepts a list of modifier functions which allows to manipulate the content of the returned BPMN file

func InitTestProcess

func InitTestProcess(
	cmd *command.ZeebeCommand,
	id string,
	testWorker func(*bindings.ReadResponse) ([]byte, error),
	additionalMetadata ...MetadataPair) error

InitTestProcess initializes a test process

func InterruptProcess

func InterruptProcess()

InterruptProcess interrupts a process

func JobTypeModifier

func JobTypeModifier(from string, to string) func(string) string

JobTypeModifier modifies the job type of a process

func JobWorker

func JobWorker(jobType string, additionalMetadata ...MetadataPair) (*jobworker.ZeebeJobWorker, error)

JobWorker initializes the Zeebe job worker binding and returns it

func NameModifier

func NameModifier(name string) func(string) string

NameModifier modifies the name of a process

func ProcessIDModifier

func ProcessIDModifier(id string) func(string) string

ProcessIDModifier modifies the process ID in a BPMN file

func RetryModifier

func RetryModifier(jobType string, retries int) func(string) string

RetryModifier modifies the job retries for a specific job type

func TestID

func TestID() string

TestID creates a valid test ID for the isolation of processes during test. This ID is optimized for the usage inside a BPMN file because some values inside a BPMN must always start with a character. This function will ensure that this is always the case.

Types

type CalcResult

type CalcResult struct {
	Result float64 `json:"result"`
}

type CalcVariables

type CalcVariables struct {
	Operator      string  `json:"operator"`
	FirstOperand  float64 `json:"firstOperand"`
	SecondOperand float64 `json:"secondOperand"`
}

type EnvVars

type EnvVars struct {
	ZeebeVersion                 string
	ZeebeBrokerHost              string
	ZeebeBrokerGatewayPort       string
	ZeebeBrokerClusterSize       string
	ZeebeBrokerReplicationFactor string
	ZeebeBrokerPartitionsCount   string
}

func GetEnvVars

func GetEnvVars() EnvVars

GetEnvVars returns the Zeebe environment vars

type MetadataPair

type MetadataPair struct {
	Key, Value string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL