Skip to content

Commit

Permalink
feat: add timeout flag to verify subcommand (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisKujawa authored Dec 8, 2022
2 parents d3e5522 + 33e2a26 commit b072579
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion go-chaos/cmd/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
var (
version int
bpmnProcessId string
timeoutInSec int
)

func init() {
Expand All @@ -34,6 +35,7 @@ func init() {
verifyInstanceCreation.Flags().IntVar(&partitionId, "partitionId", 1, "Specify the id of the partition")
verifyInstanceCreation.Flags().StringVar(&variables, "variables", "", "Specify the variables for the process instance. Expect json string.")
verifyInstanceCreation.Flags().BoolVar(&awaitResult, "awaitResult", false, "Specify whether the completion of the created process instance should be awaited.")
verifyInstanceCreation.Flags().IntVar(&timeoutInSec, "timeoutInSec", 30, "Specify the timeout of the verification in seconds")

verifyInstanceCreation.Flags().StringVar(&bpmnProcessId, "bpmnProcessId", "benchmark", "Specify the BPMN process ID for which the instance should be created.")
verifyInstanceCreation.Flags().IntVar(&version, "version", -1, "Specify the version for which the instance should be created, defaults to latest version.")
Expand Down Expand Up @@ -85,7 +87,7 @@ Process instances are created until the required partition is reached.`,
Variables: variables,
})
ensureNoError(err)
err = internal.CreateProcessInstanceOnPartition(processInstanceCreator, int32(partitionId), 30*time.Second)
err = internal.CreateProcessInstanceOnPartition(processInstanceCreator, int32(partitionId), time.Duration(timeoutInSec)*time.Second)
ensureNoError(err)

internal.LogInfo("The steady-state was successfully verified!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"type": "process",
"path": "zbchaos",
"arguments": [
"verify", "instance-creation", "--partitionId=1"
"verify", "instance-creation", "--partitionId=1", "--timeoutInSec=300"
],
"timeout": 900
}
Expand All @@ -122,7 +122,7 @@
"type": "process",
"path": "zbchaos",
"arguments": [
"verify", "instance-creation", "--partitionId=2"
"verify", "instance-creation", "--partitionId=2", "--timeoutInSec=300"
],
"timeout": 900
}
Expand All @@ -135,7 +135,7 @@
"type": "process",
"path": "zbchaos",
"arguments": [
"verify", "instance-creation", "--partitionId=3"
"verify", "instance-creation", "--partitionId=3", "--timeoutInSec=300"
],
"timeout": 900
}
Expand Down

0 comments on commit b072579

Please sign in to comment.