pact 1.28.0 → 1.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +408 -0
- data/lib/pact/cli/run_pact_verification.rb +26 -7
- data/lib/pact/cli/spec_criteria.rb +3 -0
- data/lib/pact/cli.rb +7 -1
- data/lib/pact/consumer/configuration/dsl.rb +0 -1
- data/lib/pact/consumer/configuration/mock_service.rb +9 -3
- data/lib/pact/consumer/consumer_contract_builder.rb +6 -2
- data/lib/pact/consumer/interaction_builder.rb +6 -0
- data/lib/pact/consumer/spec_hooks.rb +4 -4
- data/lib/pact/doc/sort_interactions.rb +2 -3
- data/lib/pact/hal/authorization_header_redactor.rb +32 -0
- data/lib/pact/hal/entity.rb +27 -5
- data/lib/pact/hal/http_client.rb +25 -7
- data/lib/pact/hal/link.rb +67 -20
- data/lib/pact/hal/non_json_entity.rb +28 -0
- data/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb +93 -0
- data/lib/pact/pact_broker/fetch_pacts.rb +20 -18
- data/lib/pact/pact_broker/notices.rb +34 -0
- data/lib/pact/pact_broker/pact_selection_description.rb +24 -0
- data/lib/pact/pact_broker.rb +25 -0
- data/lib/pact/provider/configuration/dsl.rb +6 -1
- data/lib/pact/provider/configuration/message_provider_dsl.rb +59 -0
- data/lib/pact/provider/configuration/pact_verification_from_broker.rb +29 -4
- data/lib/pact/provider/configuration/service_provider_dsl.rb +1 -1
- data/lib/pact/provider/help/content.rb +4 -4
- data/lib/pact/provider/help/pact_diff.rb +10 -34
- data/lib/pact/provider/help/write.rb +6 -7
- data/lib/pact/provider/pact_helper_locator.rb +13 -11
- data/lib/pact/provider/pact_source.rb +10 -1
- data/lib/pact/provider/pact_spec_runner.rb +26 -13
- data/lib/pact/provider/pact_uri.rb +8 -6
- data/lib/pact/provider/request.rb +1 -1
- data/lib/pact/provider/rspec/formatter_rspec_3.rb +39 -8
- data/lib/pact/provider/rspec/json_formatter.rb +100 -0
- data/lib/pact/provider/rspec/pact_broker_formatter.rb +7 -17
- data/lib/pact/provider/rspec.rb +24 -11
- data/lib/pact/provider/state/provider_state.rb +6 -7
- data/lib/pact/provider/state/provider_state_manager.rb +10 -10
- data/lib/pact/provider/state/set_up.rb +1 -1
- data/lib/pact/provider/state/tear_down.rb +1 -1
- data/lib/pact/provider/test_methods.rb +22 -7
- data/lib/pact/provider/verification_results/create.rb +6 -0
- data/lib/pact/provider/verification_results/publish.rb +5 -8
- data/lib/pact/provider/verification_results/publish_all.rb +14 -1
- data/lib/pact/provider/verification_results/verification_result.rb +2 -5
- data/lib/pact/provider/world.rb +1 -1
- data/lib/pact/retry.rb +2 -0
- data/lib/pact/tasks/task_helper.rb +10 -4
- data/lib/pact/tasks/verification_task.rb +3 -1
- data/lib/pact/version.rb +1 -1
- data/pact.gemspec +19 -15
- metadata +75 -80
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 36cdbcc7291013248a5b691e8dec77f7153fd3c5c75d664e5da651943a8673dc
|
|
4
|
+
data.tar.gz: 0a75d19524d85f5623f6f8f9b042b1e481f551a5784cb2c48e86633f2d3d7329
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: faa46bb073cdacca555022ee518d15e13182f286f1b6d75f309f7f5d6d6692674c046ced1d3b8598d10772b7dc25d3157aa556d6ac47453753dc90607ed8575b
|
|
7
|
+
data.tar.gz: 360a99577f6925e21ab6ce0949bca79a3309c1a16e7dbd21ae72fe20b7c46a87eca0f422d810061d2adc594141b76ca4be831eeb8859aff29eca00fe9227f78e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,411 @@
|
|
|
1
|
+
<a name="v1.53.0"></a>
|
|
2
|
+
### v1.53.0 (2020-09-11)
|
|
3
|
+
|
|
4
|
+
#### Features
|
|
5
|
+
|
|
6
|
+
* add support for the enable_pending flag ([16866f4](/../../commit/16866f4))
|
|
7
|
+
|
|
8
|
+
<a name="v1.52.0"></a>
|
|
9
|
+
### v1.52.0 (2020-09-10)
|
|
10
|
+
|
|
11
|
+
#### Features
|
|
12
|
+
|
|
13
|
+
* support webdav http methods ([fa1d712](/../../commit/fa1d712))
|
|
14
|
+
|
|
15
|
+
<a name="v1.51.1"></a>
|
|
16
|
+
### v1.51.1 (2020-08-12)
|
|
17
|
+
|
|
18
|
+
#### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* update thor dependency (#218) ([bf3ce69](/../../commit/bf3ce69))
|
|
21
|
+
* bump rake dependency per CVE-2020-8130 (#219) ([09feaa6](/../../commit/09feaa6))
|
|
22
|
+
|
|
23
|
+
<a name="v1.51.0"></a>
|
|
24
|
+
### v1.51.0 (2020-06-24)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
#### Features
|
|
28
|
+
|
|
29
|
+
* allow individual interactions to be re-run by setting PACT_BROKER_INTERACTION_ID ([a586d80](/../../commit/a586d80))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<a name="v1.50.1"></a>
|
|
33
|
+
### v1.50.1 (2020-06-15)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
#### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* fix integration with pact-message-ruby (#216) ([d2da13e](/../../commit/d2da13e))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
<a name="v1.50.0"></a>
|
|
42
|
+
### v1.50.0 (2020-04-25)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
#### Features
|
|
46
|
+
|
|
47
|
+
* Set expected interactions on mock service but without writing them to pact file (#210) ([14f5327](/../../commit/14f5327))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<a name="v1.49.3"></a>
|
|
51
|
+
### v1.49.3 (2020-04-22)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
#### Bug Fixes
|
|
55
|
+
|
|
56
|
+
* pact selection verification options logging ([9ff59f4](/../../commit/9ff59f4))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
<a name="v1.49.2"></a>
|
|
60
|
+
### v1.49.2 (2020-04-08)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
#### Bug Fixes
|
|
64
|
+
|
|
65
|
+
* json parser error for top level JSON values ([dafbc35](/../../commit/dafbc35))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
<a name="v1.49.1"></a>
|
|
69
|
+
### v1.49.1 (2020-03-21)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
#### Bug Fixes
|
|
73
|
+
|
|
74
|
+
* ensure diff is included in the json output ([0bd9753](/../../commit/0bd9753))
|
|
75
|
+
* ensure the presence of basic auth credentials does not cause an error when displaying the path of a pact on the local filesystem ([f6a0b4d](/../../commit/f6a0b4d))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
<a name="v1.49.0"></a>
|
|
79
|
+
### v1.49.0 (2020-02-18)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
#### Features
|
|
83
|
+
|
|
84
|
+
* use environment variables PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD when verifying a pact by URL, if the environment variables are present ([308f25d](/../../commit/308f25d))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
<a name="v1.48.0"></a>
|
|
88
|
+
### v1.48.0 (2020-02-13)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
#### Features
|
|
92
|
+
|
|
93
|
+
* use certificates from SSL_CERT_FILE and SSL_CERT_DIR environment variables in HTTP connections ([164912b](/../../commit/164912b))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
<a name="v1.47.0"></a>
|
|
97
|
+
### v1.47.0 (2020-02-08)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
#### Features
|
|
101
|
+
|
|
102
|
+
* update json formatter output ([376e47a](/../../commit/376e47a))
|
|
103
|
+
* add pact metadata to json formatter ([6c6ddb8](/../../commit/6c6ddb8))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
<a name="v1.46.1"></a>
|
|
107
|
+
### v1.46.1 (2020-01-22)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
#### Bug Fixes
|
|
111
|
+
|
|
112
|
+
* send output messages to the correct stream when using the XML formatter ([e768a33](/../../commit/e768a33))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
<a name="v1.46.0"></a>
|
|
116
|
+
### v1.46.0 (2020-01-22)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
#### Features
|
|
120
|
+
|
|
121
|
+
* expose full notice object in JSON output ([bdc2711](/../../commit/bdc2711))
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
#### Bug Fixes
|
|
125
|
+
|
|
126
|
+
* remove accidentally committed verbose: true ([498518c](/../../commit/498518c))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
<a name="v1.45.0"></a>
|
|
130
|
+
### v1.45.0 (2020-01-21)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
#### Features
|
|
134
|
+
|
|
135
|
+
* use custom json formatter when --format json is specified and send it straight to stdout or the configured file ([6c703a1](/../../commit/6c703a1))
|
|
136
|
+
* support pending pacts in json formatter ([2c0d20d](/../../commit/2c0d20d))
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
#### Bug Fixes
|
|
140
|
+
|
|
141
|
+
* show pending test output in yellow instead of red ([e8d4a55](/../../commit/e8d4a55))
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
<a name="v1.44.1"></a>
|
|
145
|
+
### v1.44.1 (2020-01-20)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
#### Bug Fixes
|
|
149
|
+
|
|
150
|
+
* print notices from 'pacts for verification' response to indicate why pacts are included an/or pending ([b107348](/../../commit/b107348))
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
<a name="v1.44.0"></a>
|
|
154
|
+
### v1.44.0 (2020-01-16)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
#### Features
|
|
158
|
+
|
|
159
|
+
* **message pact**
|
|
160
|
+
* add DSL for configuring Message Pact verifications ([a5181b6](/../../commit/a5181b6))
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
<a name="v1.43.1"></a>
|
|
164
|
+
### v1.43.1 (2020-01-11)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
#### Bug Fixes
|
|
168
|
+
|
|
169
|
+
* use configured credentials when fetching the diff with previous version ([b9deb09](/../../commit/b9deb09))
|
|
170
|
+
* use URI.open instead of Kernel.open ([7b3ea81](/../../commit/7b3ea81))
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
<a name="v1.43.0"></a>
|
|
174
|
+
### v1.43.0 (2020-01-11)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
#### Features
|
|
178
|
+
|
|
179
|
+
* **verify**
|
|
180
|
+
* allow includePendingStatus to be specified when fetching pacts ([1f5fc9c](/../../commit/1f5fc9c))
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
<a name="v1.42.3"></a>
|
|
184
|
+
### v1.42.3 (2019-11-15)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
#### Bug Fixes
|
|
188
|
+
|
|
189
|
+
* **verify**
|
|
190
|
+
* exit with status 0 if all pacts are in pending state ([2f7110b](/../../commit/2f7110b))
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
<a name="v1.42.2"></a>
|
|
194
|
+
### v1.42.2 (2019-11-09)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
#### Bug Fixes
|
|
198
|
+
|
|
199
|
+
* remove missed &. ([be700d8](/../../commit/be700d8))
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
<a name="v1.42.1"></a>
|
|
203
|
+
### v1.42.1 (2019-11-09)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
#### Bug Fixes
|
|
207
|
+
|
|
208
|
+
* can't use safe navigation operator because of Ruby 2.2 in Travelling Ruby for the pact-ruby-standalone ([3068ceb](/../../commit/3068ceb))
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
<a name="v1.42.0"></a>
|
|
212
|
+
### v1.42.0 (2019-09-26)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
#### Features
|
|
216
|
+
|
|
217
|
+
* use new 'pacts for verification' endpoint to retrieve pacts (#199) ([55bb935](/../../commit/55bb935))
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
<a name="v1.41.2"></a>
|
|
221
|
+
### v1.41.2 (2019-09-10)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
#### Bug Fixes
|
|
225
|
+
|
|
226
|
+
* **pact_helper_locator**
|
|
227
|
+
* add 'test' dir to file patterns (#196) ([746883d](/../../commit/746883d))
|
|
228
|
+
|
|
229
|
+
* file upload spec ([0fe072c](/../../commit/0fe072c))
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
<a name="v1.41.1"></a>
|
|
233
|
+
### v1.41.1 (2019-09-04)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
#### Bug Fixes
|
|
237
|
+
|
|
238
|
+
* use to_json instead of JSON.dump because it generates different JSON when used in conjuction with other libraries (eg. Oj) ([14566fb](/../../commit/14566fb))
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
<a name="v1.41.0"></a>
|
|
242
|
+
### v1.41.0 (2019-05-22)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
#### Features
|
|
246
|
+
|
|
247
|
+
* redact Authorization header from HTTP client debug output ([c48c991](/../../commit/c48c991))
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
<a name="v1.40.0"></a>
|
|
251
|
+
### v1.40.0 (2019-02-22)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
#### Features
|
|
255
|
+
|
|
256
|
+
* remove ruby 2.2 tests ([4a30791](/../../commit/4a30791))
|
|
257
|
+
* add support for bearer token ([297268d](/../../commit/297268d))
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
<a name="v1.39.0"></a>
|
|
261
|
+
### v1.39.0 (2019-02-21)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
#### Features
|
|
265
|
+
|
|
266
|
+
* allow host of mock service to be specified ([de267bd](/../../commit/de267bd))
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
<a name="v1.38.0"></a>
|
|
270
|
+
### v1.38.0 (2019-02-11)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
#### Features
|
|
274
|
+
|
|
275
|
+
* unlock rack-test dependency to allow version 1.1.0 ([b0c40f6](/../../commit/b0c40f6))
|
|
276
|
+
* update http client code ([bba3a08](/../../commit/bba3a08))
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
<a name="v1.37.0"></a>
|
|
280
|
+
### v1.37.0 (2018-11-15)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
#### Features
|
|
284
|
+
|
|
285
|
+
* **hal client**
|
|
286
|
+
* ensure meaningful error is displayed when HTTP errors are returned ([9244c14](/../../commit/9244c14))
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
#### Bug Fixes
|
|
290
|
+
|
|
291
|
+
* correct url encoding for expanded HAL links ([4abfe7d](/../../commit/4abfe7d))
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
<a name="v1.36.2"></a>
|
|
295
|
+
### v1.36.2 (2018-10-22)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
#### Bug Fixes
|
|
299
|
+
|
|
300
|
+
* always execute global and base states ([8317fe3](/../../commit/8317fe3))
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
<a name="v1.36.0"></a>
|
|
304
|
+
### v1.36.0 (2018-10-04)
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
#### Features
|
|
308
|
+
|
|
309
|
+
* **v3**
|
|
310
|
+
* make provider state params available to set up and tear down blocks ([9593730](/../../commit/9593730))
|
|
311
|
+
* support set up and tear down of multiple provider states ([cbad0be](/../../commit/cbad0be))
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
<a name="v1.34.0"></a>
|
|
315
|
+
### v1.34.0 (2018-09-06)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
#### Features
|
|
319
|
+
|
|
320
|
+
* **verify**
|
|
321
|
+
* add request customizer for pact-provider-verifier ([4ae0b58](/../../commit/4ae0b58))
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
#### Bug Fixes
|
|
325
|
+
|
|
326
|
+
* add missing require for net/http ([fe2ebb1](/../../commit/fe2ebb1))
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
<a name="v1.33.2"></a>
|
|
330
|
+
### v1.33.2 (2018-09-06)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
#### Bug Fixes
|
|
334
|
+
|
|
335
|
+
* add missing requires for pact/errors ([0e01451](/../../commit/0e01451))
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
<a name="v1.33.1"></a>
|
|
339
|
+
### v1.33.1 (2018-08-28)
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
#### Features
|
|
343
|
+
|
|
344
|
+
* rename 'wip pacts' to 'pending pacts' ([6a46ebb](/../../commit/6a46ebb))
|
|
345
|
+
|
|
346
|
+
* **verify cli**
|
|
347
|
+
* rename --wip to --ignore-failures ([8e2dffd](/../../commit/8e2dffd))
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
#### Bug Fixes
|
|
351
|
+
|
|
352
|
+
* correct version for dependency on pact-mock_service ([01c0df7](/../../commit/01c0df7))
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
<a name="v1.33.0"></a>
|
|
356
|
+
### v1.33.0 (2018-08-07)
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
#### Features
|
|
360
|
+
|
|
361
|
+
* update version of pact-mock_service ([25a04fb](/../../commit/25a04fb))
|
|
362
|
+
* add support for multipart/form requests ([7a16ab1](/../../commit/7a16ab1))
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
<a name="v1.32.0"></a>
|
|
366
|
+
### v1.32.0 (2018-07-25)
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
#### Features
|
|
370
|
+
|
|
371
|
+
* add actual pact message contents to results published to Pact Broker ([09e9d89](/../../commit/09e9d89))
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
<a name="v1.31.0"></a>
|
|
375
|
+
### v1.31.0 (2018-07-25)
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
#### Features
|
|
379
|
+
|
|
380
|
+
* publish beta format of individual interaction results to Pact Broker ([6742afa](/../../commit/6742afa))
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
<a name="v1.30.0"></a>
|
|
384
|
+
### v1.30.0 (2018-07-24)
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
#### Features
|
|
388
|
+
|
|
389
|
+
* raise error when an expected HAL relation cannot be found in a resource ([5db4134](/../../commit/5db4134))
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
<a name="v1.29.0"></a>
|
|
393
|
+
### v1.29.0 (2018-07-24)
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
#### Features
|
|
397
|
+
|
|
398
|
+
* return plain string URLs from Pact::PactBroker.fetch_pact_uris ([1aa1989](/../../commit/1aa1989))
|
|
399
|
+
* use beta:wip-provider-pacts rather than pb:wip-provider-pacts to fetch WIP pacts ([3bb0501](/../../commit/3bb0501))
|
|
400
|
+
* allow WIP pacts to be verified without causing the process to return an non zero exit code ([9e6de46](/../../commit/9e6de46))
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
#### Bug Fixes
|
|
404
|
+
|
|
405
|
+
* add missing require ([0aa2d2a](/../../commit/0aa2d2a))
|
|
406
|
+
* default pact specification version to 2 ([917891a](/../../commit/917891a))
|
|
407
|
+
|
|
408
|
+
|
|
1
409
|
<a name="v1.28.0"></a>
|
|
2
410
|
### v1.28.0 (2018-06-24)
|
|
3
411
|
|
|
@@ -3,7 +3,6 @@ require 'pact/cli/spec_criteria'
|
|
|
3
3
|
module Pact
|
|
4
4
|
module Cli
|
|
5
5
|
class RunPactVerification
|
|
6
|
-
|
|
7
6
|
attr_reader :options
|
|
8
7
|
|
|
9
8
|
def initialize options
|
|
@@ -15,6 +14,7 @@ module Pact
|
|
|
15
14
|
end
|
|
16
15
|
|
|
17
16
|
def call
|
|
17
|
+
configure_output
|
|
18
18
|
initialize_rspec
|
|
19
19
|
setup_load_path
|
|
20
20
|
load_pact_helper
|
|
@@ -44,23 +44,32 @@ module Pact
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def run_specs
|
|
47
|
-
exit_code = if options[:pact_uri]
|
|
48
|
-
|
|
47
|
+
exit_code = if options[:pact_uri].is_a?(String)
|
|
48
|
+
run_with_pact_url_string
|
|
49
|
+
elsif options[:pact_uri]
|
|
50
|
+
run_with_pact_uri_object # from pact-provider-verifier
|
|
49
51
|
else
|
|
50
|
-
|
|
52
|
+
run_with_configured_pacts_from_pact_helper
|
|
51
53
|
end
|
|
52
54
|
exit exit_code
|
|
53
55
|
end
|
|
54
56
|
|
|
55
|
-
def
|
|
57
|
+
def run_with_pact_url_string
|
|
56
58
|
pact_repository_uri_options = {}
|
|
59
|
+
pact_repository_uri_options[:username] = ENV['PACT_BROKER_USERNAME'] if ENV['PACT_BROKER_USERNAME']
|
|
60
|
+
pact_repository_uri_options[:password] = ENV['PACT_BROKER_PASSWORD'] if ENV['PACT_BROKER_PASSWORD']
|
|
61
|
+
pact_repository_uri_options[:token] = ENV['PACT_BROKER_TOKEN']
|
|
57
62
|
pact_repository_uri_options[:username] = options[:pact_broker_username] if options[:pact_broker_username]
|
|
58
63
|
pact_repository_uri_options[:password] = options[:pact_broker_password] if options[:pact_broker_password]
|
|
59
64
|
pact_uri = ::Pact::Provider::PactURI.new(options[:pact_uri], pact_repository_uri_options)
|
|
60
65
|
Pact::Provider::PactSpecRunner.new([pact_uri], pact_spec_options).run
|
|
61
66
|
end
|
|
62
67
|
|
|
63
|
-
def
|
|
68
|
+
def run_with_pact_uri_object
|
|
69
|
+
Pact::Provider::PactSpecRunner.new([options[:pact_uri]], pact_spec_options).run
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def run_with_configured_pacts_from_pact_helper
|
|
64
73
|
pact_urls = Pact.provider_world.pact_urls
|
|
65
74
|
raise "Please configure a pact to verify" if pact_urls.empty?
|
|
66
75
|
Pact::Provider::PactSpecRunner.new(pact_urls, pact_spec_options).run
|
|
@@ -71,9 +80,19 @@ module Pact
|
|
|
71
80
|
full_backtrace: options[:backtrace],
|
|
72
81
|
criteria: SpecCriteria.call(options),
|
|
73
82
|
format: options[:format],
|
|
74
|
-
out: options[:out]
|
|
83
|
+
out: options[:out],
|
|
84
|
+
ignore_failures: options[:ignore_failures],
|
|
85
|
+
request_customizer: options[:request_customizer]
|
|
75
86
|
}
|
|
76
87
|
end
|
|
88
|
+
|
|
89
|
+
def configure_output
|
|
90
|
+
if options[:format] == 'json' && !options[:out]
|
|
91
|
+
# Don't want to mess up the JSON parsing with messages to stdout, so send it to stderr
|
|
92
|
+
require 'pact/configuration'
|
|
93
|
+
Pact.configuration.output_stream = Pact.configuration.error_stream
|
|
94
|
+
end
|
|
95
|
+
end
|
|
77
96
|
end
|
|
78
97
|
end
|
|
79
98
|
end
|
|
@@ -6,8 +6,11 @@ module Pact
|
|
|
6
6
|
criteria = {}
|
|
7
7
|
|
|
8
8
|
criteria[:description] = Regexp.new(options[:description]) if options[:description]
|
|
9
|
+
criteria[:_id] = options[:pact_broker_interaction_id] if options[:pact_broker_interaction_id]
|
|
10
|
+
criteria[:index] = options[:interaction_index] if options[:interaction_index]
|
|
9
11
|
|
|
10
12
|
provider_state = options[:provider_state]
|
|
13
|
+
|
|
11
14
|
if provider_state
|
|
12
15
|
if provider_state.length == 0
|
|
13
16
|
criteria[:provider_state] = nil #Allow PACT_PROVIDER_STATE="" to mean no provider state
|
data/lib/pact/cli.rb
CHANGED
|
@@ -4,18 +4,25 @@ require 'pact/provider/configuration'
|
|
|
4
4
|
|
|
5
5
|
module Pact
|
|
6
6
|
class CLI < Thor
|
|
7
|
+
def self.exit_on_failure? # Thor 1.0 deprecation guard
|
|
8
|
+
false
|
|
9
|
+
end
|
|
7
10
|
|
|
8
11
|
desc 'verify', "Verify a pact"
|
|
9
12
|
method_option :pact_helper, aliases: "-h", desc: "Pact helper file", :required => true
|
|
10
13
|
method_option :pact_uri, aliases: "-p", desc: "Pact URI"
|
|
14
|
+
method_option :ignore_failures, type: :boolean, default: false, desc: "Process will always exit with exit code 0", hide: true
|
|
11
15
|
method_option :pact_broker_username, aliases: "-u", desc: "Pact broker user name"
|
|
12
16
|
method_option :pact_broker_password, aliases: "-w", desc: "Pact broker password"
|
|
17
|
+
method_option :pact_broker_token, aliases: "-k", desc: "Pact broker token"
|
|
13
18
|
method_option :backtrace, aliases: "-b", desc: "Show full backtrace", :default => false, :type => :boolean
|
|
14
19
|
method_option :interactions_replay_order, aliases: "-o",
|
|
15
20
|
desc: "Interactions replay order: randomised or recorded (default)",
|
|
16
21
|
default: Pact.configuration.interactions_replay_order
|
|
17
22
|
method_option :description, aliases: "-d", desc: "Interaction description filter"
|
|
18
23
|
method_option :provider_state, aliases: "-s", desc: "Provider state filter"
|
|
24
|
+
method_option :interaction_index, type: :numeric, desc: "Index filter"
|
|
25
|
+
method_option :pact_broker_interaction_id, desc: "Pact Broker interaction ID filter"
|
|
19
26
|
method_option :format, aliases: "-f", banner: "FORMATTER", desc: "RSpec formatter. Defaults to custom Pact formatter. [j]son may also be used."
|
|
20
27
|
method_option :out, aliases: "-o", banner: "FILE", desc: "Write output to a file instead of $stdout."
|
|
21
28
|
|
|
@@ -33,6 +40,5 @@ module Pact
|
|
|
33
40
|
require 'pact/doc/generator'
|
|
34
41
|
Pact::Doc::Generate.call(options[:pact_dir], options[:doc_dir], [Pact::Doc::Markdown::Generator])
|
|
35
42
|
end
|
|
36
|
-
|
|
37
43
|
end
|
|
38
44
|
end
|
|
@@ -11,16 +11,17 @@ module Pact
|
|
|
11
11
|
|
|
12
12
|
extend Pact::DSL
|
|
13
13
|
|
|
14
|
-
attr_accessor :port, :standalone, :verify, :provider_name, :consumer_name, :pact_specification_version
|
|
14
|
+
attr_accessor :port, :host, :standalone, :verify, :provider_name, :consumer_name, :pact_specification_version
|
|
15
15
|
|
|
16
16
|
def initialize name, consumer_name, provider_name
|
|
17
17
|
@name = name
|
|
18
18
|
@consumer_name = consumer_name
|
|
19
19
|
@provider_name = provider_name
|
|
20
20
|
@port = nil
|
|
21
|
+
@host = "localhost"
|
|
21
22
|
@standalone = false
|
|
22
23
|
@verify = true
|
|
23
|
-
@pact_specification_version =
|
|
24
|
+
@pact_specification_version = '2'
|
|
24
25
|
@finalized = false
|
|
25
26
|
end
|
|
26
27
|
|
|
@@ -29,6 +30,10 @@ module Pact
|
|
|
29
30
|
self.port = port
|
|
30
31
|
end
|
|
31
32
|
|
|
33
|
+
def host host
|
|
34
|
+
self.host = host
|
|
35
|
+
end
|
|
36
|
+
|
|
32
37
|
def standalone standalone
|
|
33
38
|
self.standalone = standalone
|
|
34
39
|
end
|
|
@@ -53,7 +58,7 @@ module Pact
|
|
|
53
58
|
|
|
54
59
|
def register_mock_service
|
|
55
60
|
unless standalone
|
|
56
|
-
url = "http
|
|
61
|
+
url = "http://#{host}#{port.nil? ? '' : ":#{port}"}"
|
|
57
62
|
ret = Pact::MockService::AppManager.instance.register_mock_service_for(provider_name, url, mock_service_options)
|
|
58
63
|
raise "pact-mock_service(v#{Pact::MockService::VERSION}) does not support 'find available port' feature" unless ret
|
|
59
64
|
@port = ret
|
|
@@ -73,6 +78,7 @@ module Pact
|
|
|
73
78
|
:provider_name => provider_name,
|
|
74
79
|
:pactfile_write_mode => Pact.configuration.pactfile_write_mode,
|
|
75
80
|
:port => port,
|
|
81
|
+
:host => host,
|
|
76
82
|
:pact_dir => Pact.configuration.pact_dir
|
|
77
83
|
}
|
|
78
84
|
Pact::Consumer::ConsumerContractBuilder.new consumer_contract_builder_fields
|
|
@@ -21,8 +21,12 @@ module Pact
|
|
|
21
21
|
pactfile_write_mode: attributes[:pactfile_write_mode].to_s,
|
|
22
22
|
pact_dir: attributes.fetch(:pact_dir)
|
|
23
23
|
}
|
|
24
|
-
@mock_service_client = Pact::MockService::Client.new(attributes[:port])
|
|
25
|
-
@mock_service_base_url = "http
|
|
24
|
+
@mock_service_client = Pact::MockService::Client.new(attributes[:port], attributes[:host])
|
|
25
|
+
@mock_service_base_url = "http://#{attributes[:host]}:#{attributes[:port]}"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def without_writing_to_pact
|
|
29
|
+
interaction_builder.without_writing_to_pact
|
|
26
30
|
end
|
|
27
31
|
|
|
28
32
|
def given(provider_state)
|
|
@@ -13,6 +13,12 @@ module Pact
|
|
|
13
13
|
@callback = block
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
def without_writing_to_pact
|
|
17
|
+
interaction.metadata ||= {}
|
|
18
|
+
interaction.metadata[:write_to_pact] = false
|
|
19
|
+
self
|
|
20
|
+
end
|
|
21
|
+
|
|
16
22
|
def upon_receiving description
|
|
17
23
|
@interaction.description = description
|
|
18
24
|
self
|
|
@@ -15,8 +15,8 @@ module Pact
|
|
|
15
15
|
def before_each example_description
|
|
16
16
|
Pact.consumer_world.register_pact_example_ran
|
|
17
17
|
Pact.configuration.logger.info "Clearing all expectations"
|
|
18
|
-
Pact::MockService::AppManager.instance.
|
|
19
|
-
Pact::MockService::Client.clear_interactions
|
|
18
|
+
Pact::MockService::AppManager.instance.urls_of_mock_services.each do | url |
|
|
19
|
+
Pact::MockService::Client.clear_interactions url, example_description
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ module Pact
|
|
|
29
29
|
|
|
30
30
|
def after_suite
|
|
31
31
|
if Pact.consumer_world.any_pact_examples_ran?
|
|
32
|
-
Pact.consumer_world.consumer_contract_builders.each
|
|
32
|
+
Pact.consumer_world.consumer_contract_builders.each(&:write_pact)
|
|
33
33
|
Pact::Doc::Generate.call
|
|
34
34
|
Pact::MockService::AppManager.instance.kill_all
|
|
35
35
|
Pact::MockService::AppManager.instance.clear_all
|
|
@@ -37,4 +37,4 @@ module Pact
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
|
-
end
|
|
40
|
+
end
|
|
@@ -3,7 +3,7 @@ module Pact
|
|
|
3
3
|
class SortInteractions
|
|
4
4
|
|
|
5
5
|
def self.call interactions
|
|
6
|
-
interactions.
|
|
6
|
+
interactions.sort_by { |interaction| sortable_id(interaction) }
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
private
|
|
@@ -11,7 +11,6 @@ module Pact
|
|
|
11
11
|
def self.sortable_id interaction
|
|
12
12
|
"#{interaction.description.downcase} #{interaction.response.status} #{(interaction.provider_state || '').downcase}"
|
|
13
13
|
end
|
|
14
|
-
|
|
15
14
|
end
|
|
16
15
|
end
|
|
17
|
-
end
|
|
16
|
+
end
|