pact-provider-verifier 1.10.0 → 1.11.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 +9 -0
- data/README.md +48 -12
- data/lib/pact/provider_verifier/app.rb +1 -1
- data/lib/pact/provider_verifier/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: 92bf234cf9e7a504348192720df8de381b66fadfc53c871c6ec24f009b084b03
|
4
|
+
data.tar.gz: c9fb9ee424d70abedb986251beb4adb1caddd0acef2edeef1a662b2fc4013a3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ef9c0d39e8bc82e710df3b9fc57f68d37cca7f3a95c61c38ee760461dbf41d3fab65e744984f3f5a9b2186e88d4cdeed8f606909dccde82ba850347d73c6aeb
|
7
|
+
data.tar.gz: fc1265d71177994ca48f88c270ab9a5fc7f671f7a1b6be4a667c23c131b545c682258e5681f63c3c596760f45be935dcfc5246700386e31ffb26d246d881a7ff
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -11,6 +11,7 @@ binary-like CLI tool.
|
|
11
11
|
* Verify Pacts against Pacts published to an http endpoint, such as a [Pact Broker](https://github.com/pact-foundation/pact_broker)
|
12
12
|
* Verify local `*.json` Pacts on the file system
|
13
13
|
* Works with Pact [provider states](https://docs.pact.io/documentation/provider_states.html) should you need them
|
14
|
+
* Publishes the verification results back to the pact broker if the pact was retrieved from a broker.
|
14
15
|
|
15
16
|
## Installation
|
16
17
|
|
@@ -20,7 +21,7 @@ Take a look at https://github.com/DiUS/pact-provider-verifier-docker.
|
|
20
21
|
|
21
22
|
### Native Installation
|
22
23
|
|
23
|
-
Download the appropriate [release](https://github.com/pact-foundation/pact-
|
24
|
+
Download the appropriate [release](https://github.com/pact-foundation/pact-ruby-standalone/releases)
|
24
25
|
for your OS and put somewhere on your `PATH`.
|
25
26
|
|
26
27
|
### With Ruby on Mac OSX and Linux
|
@@ -32,6 +33,27 @@ pact-provider-verifier <args>
|
|
32
33
|
|
33
34
|
Run `pact-provider-verifier help` for command line options.
|
34
35
|
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
```
|
39
|
+
Usage:
|
40
|
+
pact-provider-verifier PACT_URL ... -h, --provider-base-url=PROVIDER_BASE_URL
|
41
|
+
|
42
|
+
Options:
|
43
|
+
-h, --provider-base-url=PROVIDER_BASE_URL # Provider host URL
|
44
|
+
-c, [--provider-states-setup-url=PROVIDER_STATES_SETUP_URL] # Base URL to setup the provider states at
|
45
|
+
-a, [--provider-app-version=PROVIDER_APP_VERSION] # Provider application version, required when publishing verification results
|
46
|
+
-r, [--publish-verification-results=PUBLISH_VERIFICATION_RESULTS] # Publish verification results to the broker
|
47
|
+
-n, [--broker-username=BROKER_USERNAME] # Pact Broker basic auth username
|
48
|
+
-p, [--broker-password=BROKER_PASSWORD] # Pact Broker basic auth password
|
49
|
+
[--custom-provider-header=CUSTOM_PROVIDER_HEADER] # Header to add to provider state set up and pact verification requests. eg 'Authorization: Basic cGFjdDpwYWN0'. May be specified multiple times.
|
50
|
+
-v, [--verbose=VERBOSE] # Verbose output
|
51
|
+
-f, [--format=FORMATTER] # RSpec formatter. Defaults to custom Pact formatter. json and RspecJunitFormatter may also be used.
|
52
|
+
-u, [--pact-urls=PACT_URLS] # DEPRECATED. Please provide as space separated arguments.
|
53
|
+
|
54
|
+
Verify pact(s) against a provider. Supports local and networked (http-based) files.
|
55
|
+
```
|
56
|
+
|
35
57
|
## Examples
|
36
58
|
|
37
59
|
See the [example](examples) for a demonstration with a [Sinatra](http://www.sinatrarb.com/) API:
|
@@ -48,10 +70,15 @@ bundle install
|
|
48
70
|
|
49
71
|
1. Create an API and a corresponding Docker image for it
|
50
72
|
1. Publish Pacts to the Pact broker (or create local ones)
|
51
|
-
1. Run the CLI tool for your OS, passing the appropriate
|
52
|
-
*
|
53
|
-
* `--
|
54
|
-
|
73
|
+
1. Run the CLI tool for your OS, passing the appropriate arguments:
|
74
|
+
* a space delimited list of local Pact file URLs or Pact Broker URLs.
|
75
|
+
* `--provider-base-url` - the base url of the provider (i.e. your API)
|
76
|
+
|
77
|
+
eg.
|
78
|
+
|
79
|
+
```
|
80
|
+
pact-provider-verifier foo-bar.json --provider-base-url http://localhost:9292
|
81
|
+
```
|
55
82
|
|
56
83
|
### Setting a custom Authentication header
|
57
84
|
|
@@ -61,17 +88,26 @@ Modification of the request headers is sometimes necessary, but be aware that an
|
|
61
88
|
|
62
89
|
### API with Provider States
|
63
90
|
|
64
|
-
|
91
|
+
Read the [Provider States section on docs.pact.io](https://docs.pact.io/documentation/provider_states.html) for an introduction to provider states.
|
92
|
+
|
93
|
+
To allow the correct data to be set up before each interaction is replayed, you will need to create a dev/test only HTTP endpoint that accepts a JSON document that looks like:
|
94
|
+
|
95
|
+
```json
|
96
|
+
{
|
97
|
+
"consumer": "CONSUMER_NAME",
|
98
|
+
"state": "PROVIDER_STATE"
|
99
|
+
}
|
100
|
+
```
|
101
|
+
|
102
|
+
The endpoint should set up the given provider state for the given consumer synchronously, and return an error if the provider state is not recognised. Namespacing your provider states within each consumer will avoid clashes if more than one consumer defines the same provider state with different data.
|
65
103
|
|
66
|
-
|
104
|
+
The following flag is required when running the CLI:
|
67
105
|
|
68
|
-
|
106
|
+
* `--provider-states-setup-url` - the full url of the endpoint which sets the active consumer and provider state.
|
69
107
|
|
70
|
-
|
108
|
+
Rather than tearing down the specific test data created after each interaction, you should clear all the existing data at the start of each set up call. This is a more reliable method of ensuring that your test data does not leak from one test to another.
|
71
109
|
|
72
|
-
|
73
|
-
* `--provider-base-url` - the base url of the pact provider
|
74
|
-
* `--provider-states-setup-url` - the full url of the endpoint which sets the active pact consumer and provider state
|
110
|
+
Note that the HTTP endpoint does not have to actually be within your application - it just has to have access to the same data store. So if you cannot add "test only" endpoints during your verification, consider making a separate app which shares credentials to your app's datastore. It is highly recommended that you run your verifications against a locally running provider, rather than a deployed one, as this will make it much easier to stub any downstream calls, debug issues, and it will make your tests run as fast as possible.
|
75
111
|
|
76
112
|
### Using the Pact Broker with Basic authentication
|
77
113
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact-provider-verifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Fellows
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -303,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
303
303
|
version: '0'
|
304
304
|
requirements: []
|
305
305
|
rubyforge_project:
|
306
|
-
rubygems_version: 2.7.
|
306
|
+
rubygems_version: 2.7.3
|
307
307
|
signing_key:
|
308
308
|
specification_version: 4
|
309
309
|
summary: Provides a Pact verification service for use with Pact
|