zeebe_bpmn_rspec 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +35 -4
- data/docker-compose.yml +4 -4
- data/lib/zeebe_bpmn_rspec/activated_job.rb +5 -2
- data/lib/zeebe_bpmn_rspec/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ee557a1aed97212da2a198eafd8238859e12499f32e8ddf24d97d5240c83c36
|
4
|
+
data.tar.gz: 0105ee8a65e00fbab192cf6f76710e43973bec36324b3defcc4f83882db833ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 978a61f885179d519ede6340a283b93f9c36e1d712c1279629500732afe01a9f9ac7483a484c17d99356bcebb0258fb04f65771492a6d2b6774cd9be64454f1b
|
7
|
+
data.tar.gz: 6f235e5995f75fd04b7996708bb8a23d81cbb1b7bf1ecd8ebea46a5fba78fa1e5c60f8ab1e305e263d0e16e7ac2005dad78dfdf5e684528ff3cdf3343a2f9c2e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -118,7 +118,7 @@ activate_job("my_job").
|
|
118
118
|
|
119
119
|
#### Complete Job
|
120
120
|
|
121
|
-
Jobs can be completed by calling `and_complete
|
121
|
+
Jobs can be completed by calling `and_complete` (also aliased as `complete`). Variables can optionally be returned with the
|
122
122
|
completed job.
|
123
123
|
|
124
124
|
```ruby
|
@@ -134,7 +134,7 @@ project_job("my_job").
|
|
134
134
|
|
135
135
|
#### Fail Job
|
136
136
|
|
137
|
-
Jobs can be failed by calling `and_fail
|
137
|
+
Jobs can be failed by calling `and_fail` (also aliased as `fail`). An optional message can be specified when failing a job.
|
138
138
|
|
139
139
|
```ruby
|
140
140
|
# Failing a job can be chanined with expectations
|
@@ -147,9 +147,17 @@ activate_job("my_job").
|
|
147
147
|
and_fail("something didn't go right")
|
148
148
|
```
|
149
149
|
|
150
|
+
By default retries are set to zero when a job is failed but the remaining retries can optionally be specified:
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
job = activate_job("my_job")
|
154
|
+
|
155
|
+
job.fail(retries: 1)
|
156
|
+
```
|
157
|
+
|
150
158
|
#### Throw Error
|
151
159
|
|
152
|
-
The `and_throw_error` method can be used to throw an error for a job. The error code is required and an
|
160
|
+
The `and_throw_error` (also aliased as `throw_error`) method can be used to throw an error for a job. The error code is required and an
|
153
161
|
optional message may be specified:
|
154
162
|
|
155
163
|
```ruby
|
@@ -165,7 +173,18 @@ activate_job("my_job").
|
|
165
173
|
|
166
174
|
#### Activating Multiple Jobs
|
167
175
|
|
168
|
-
|
176
|
+
Multiple jobs can be activated using the `activate_jobs` method.
|
177
|
+
|
178
|
+
```ruby
|
179
|
+
activate_jobs("my_job")
|
180
|
+
```
|
181
|
+
|
182
|
+
The call to `activate_jobs` returns an Enumerator that returns `ActivatedJob` instance.
|
183
|
+
The maximum number of jobs to return can be specified:
|
184
|
+
|
185
|
+
```ruby
|
186
|
+
jobs = activate_jobs("my_job", max_jobs: 2).to_a
|
187
|
+
```
|
169
188
|
|
170
189
|
### Workflow Complete
|
171
190
|
|
@@ -198,6 +217,18 @@ publish_message("message_name", correlation_key: expected_value,
|
|
198
217
|
variables: { foo: "bar" })
|
199
218
|
```
|
200
219
|
|
220
|
+
## Tips & Tricks
|
221
|
+
|
222
|
+
### Enumerator for Multiple Jobs
|
223
|
+
|
224
|
+
When activating multiple jobs, call `to_a` on the result of `activate_jobs` to get
|
225
|
+
an array of activated jobs objects.
|
226
|
+
|
227
|
+
### Timer Duration
|
228
|
+
|
229
|
+
Specify timer durations using a variable so that tests can easily set the variable
|
230
|
+
to specify a short duration.
|
231
|
+
|
201
232
|
## Limitations
|
202
233
|
|
203
234
|
The current gem and approach have some limitations:
|
data/docker-compose.yml
CHANGED
@@ -6,7 +6,7 @@ x-environment: &default-environment
|
|
6
6
|
PRYRC: /usr/src/app/.docker-pryrc
|
7
7
|
BUNDLE_IGNORE_CONFIG: 1
|
8
8
|
BUNDLE_DISABLE_SHARED_GEMS: "true"
|
9
|
-
ZEEBE_ADDRESS: zeebe
|
9
|
+
ZEEBE_ADDRESS: zeebe:26500
|
10
10
|
x-service: &default-service
|
11
11
|
image: ruby:2.6.6
|
12
12
|
volumes:
|
@@ -18,7 +18,7 @@ x-service: &default-service
|
|
18
18
|
stdin_open: true
|
19
19
|
services:
|
20
20
|
zeebe:
|
21
|
-
image: camunda/zeebe:0.23.
|
21
|
+
image: camunda/zeebe:0.23.4
|
22
22
|
environment:
|
23
23
|
ZEEBE_LOG_LEVEL: debug
|
24
24
|
volumes:
|
@@ -28,8 +28,8 @@ services:
|
|
28
28
|
monitor:
|
29
29
|
image: camunda/zeebe-simple-monitor:0.19.0
|
30
30
|
environment:
|
31
|
-
- zeebe.client.broker.contactPoint=zeebe
|
32
|
-
- zeebe.client.worker.hazelcast.connection=zeebe
|
31
|
+
- zeebe.client.broker.contactPoint=zeebe:26500
|
32
|
+
- zeebe.client.worker.hazelcast.connection=zeebe:5701
|
33
33
|
ports:
|
34
34
|
- "8082:8082"
|
35
35
|
depends_on:
|
@@ -66,16 +66,18 @@ module ZeebeBpmnRspec
|
|
66
66
|
}.compact
|
67
67
|
))
|
68
68
|
end
|
69
|
+
alias throw_error and_throw_error
|
69
70
|
|
70
|
-
def and_fail(message = nil)
|
71
|
+
def and_fail(message = nil, retries: nil)
|
71
72
|
client.fail_job(FailJobRequest.new(
|
72
73
|
{
|
73
74
|
jobKey: job.key,
|
74
|
-
retries: 0,
|
75
|
+
retries: retries || 0,
|
75
76
|
errorMessage: message,
|
76
77
|
}.compact
|
77
78
|
))
|
78
79
|
end
|
80
|
+
alias fail and_fail
|
79
81
|
|
80
82
|
def and_complete(variables = {})
|
81
83
|
client.complete_job(CompleteJobRequest.new(
|
@@ -83,6 +85,7 @@ module ZeebeBpmnRspec
|
|
83
85
|
variables: variables.to_json
|
84
86
|
))
|
85
87
|
end
|
88
|
+
alias complete and_complete
|
86
89
|
|
87
90
|
private
|
88
91
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zeebe_bpmn_rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ezCater, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
|
-
rubygems_version: 3.
|
177
|
+
rubygems_version: 3.0.3
|
178
178
|
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: Zeebe BPMN testing using RSpec
|