pact_broker-client 1.13.1 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/CHANGELOG.md +17 -0
  4. data/README.md +28 -17
  5. data/doc/markdown/Pact Broker Client - Pact Broker.md +582 -0
  6. data/doc/markdown/README.md +3 -0
  7. data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +1174 -0
  8. data/doc/pacts/markdown/README.md +3 -0
  9. data/example/scripts/README.md +13 -0
  10. data/example/scripts/deploy-consumer.sh +26 -0
  11. data/example/scripts/pact.json +67 -0
  12. data/example/scripts/publish-pact.sh +3 -0
  13. data/example/scripts/publish-verification.sh +3 -0
  14. data/example/scripts/verification.json +4 -0
  15. data/lib/pact_broker/client/base_client.rb +17 -1
  16. data/lib/pact_broker/client/cli/broker.rb +27 -0
  17. data/lib/pact_broker/client/cli/can_i_deploy_long_desc.txt +13 -3
  18. data/lib/pact_broker/client/error.rb +2 -0
  19. data/lib/pact_broker/client/matrix.rb +0 -2
  20. data/lib/pact_broker/client/version.rb +1 -1
  21. data/lib/pact_broker/client/versions.rb +15 -5
  22. data/lib/pact_broker/client/versions/describe.rb +60 -0
  23. data/lib/pact_broker/client/versions/formatter.rb +20 -0
  24. data/lib/pact_broker/client/versions/json_formatter.rb +13 -0
  25. data/lib/pact_broker/client/versions/text_formatter.rb +31 -0
  26. data/spec/integration/can_i_deploy_spec.rb +2 -2
  27. data/spec/integration/create_version_tag_spec.rb +1 -1
  28. data/spec/lib/pact_broker/client/base_client_spec.rb +28 -0
  29. data/spec/lib/pact_broker/client/versions/describe_spec.rb +65 -0
  30. data/spec/pacts/pact_broker_client-pact_broker.json +118 -0
  31. data/spec/service_providers/pact_broker_client_versions_spec.rb +114 -0
  32. data/spec/service_providers/pact_helper.rb +1 -0
  33. metadata +19 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04be89acaef17f512ad8aab983fe3dfb4d6e9413
4
- data.tar.gz: 38e3dafaa69d47aa311725647178120a1e25e5f1
3
+ metadata.gz: 3be2902ef57a2367371bbc65a68394875f91e2c2
4
+ data.tar.gz: 2717b8043ad6ea83c97668153b4ed1ec644f20ce
5
5
  SHA512:
6
- metadata.gz: 863e8363bc8ae586f3975f400ce73a8fed77ea952ce450de96c04d5246a43c7b9b7a93a3c58c2a796cb43da9e7fae06a22f5fa951320c8be057931b0c0e7e361
7
- data.tar.gz: 7ab61062adeebc8306a9b169fb9c04cddfb777e1979cafc25409647eba8448f11b8f45c7cd6a3accc40d87ec69cc525b2635f5f62bae5f43b66dc713311beed0
6
+ metadata.gz: 23f6c7c6cbd7910dd3bc27f704cd6e8e8cb69c27587c6c5f49c20d63cc158a4879ff6483bc43088441ed066f74edaf6e467878dbff3198eb25bc31e362c6d20d
7
+ data.tar.gz: 88e25959d7e6c29b405ef277ca40544287a32c3453774f993d639651dc1fb5e815f7b59e08c1dab12bf0bd13c246baf448bfe0a454ef802fb6a89f001e9af701
data/.gitignore CHANGED
@@ -17,7 +17,6 @@ reports
17
17
  # YARD artifacts
18
18
  .yardoc
19
19
  _yardoc
20
- doc/
21
20
  .bin
22
21
 
23
22
  # Editor files
@@ -1,3 +1,20 @@
1
+ <a name="v1.14.0"></a>
2
+ ### v1.14.0 (2018-01-25)
3
+
4
+
5
+ #### Features
6
+
7
+ * **describe-version**
8
+ * allow retrieving latest pacticipant version ([7679f61](/../../commit/7679f61))
9
+
10
+ * update help text for can-i-deploy ([7d3f3e1](/../../commit/7d3f3e1))
11
+ * add example showing how to use can-i-deploy and describe-version as a verification webhook endpoint ([ec83387](/../../commit/ec83387))
12
+
13
+ * **cli**
14
+ * add describe-version ([6e12478](/../../commit/6e12478))
15
+ * output HTTP request and response debugging when verbose mode enabled ([f487714](/../../commit/f487714))
16
+
17
+
1
18
  <a name="v1.13.0"></a>
2
19
  ### v1.13.0 (2017-11-09)
3
20
 
data/README.md CHANGED
@@ -55,8 +55,7 @@ Add a tag to a pacticipant version
55
55
 
56
56
  ### can-i-deploy
57
57
 
58
- *This feature is in beta release, and backwards compatibility is NOT guaranteed.*
59
- You will need the latest version of the Pact Broker for this feature to work.
58
+ You will need >= v2.13.0 of the Pact Broker for this feature to work.
60
59
 
61
60
  ```
62
61
  Usage:
@@ -74,40 +73,52 @@ Options:
74
73
  -v, [--verbose], [--no-verbose] # Verbose output. Default: false
75
74
 
76
75
  Description:
77
- Returns exit code 0 or 1, indicating whether or not the specified pacticipant versions are compatible. Prints out the
78
- relevant pact/verification details.
76
+ Returns exit code 0 or 1, indicating whether or not the specified pacticipant versions are compatible. Prints out the relevant pact/verification details.
79
77
 
80
- The environment variables PACT_BROKER_BASE_URL, PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD may be used instead of
81
- their respective command line options.
78
+ The environment variables PACT_BROKER_BASE_URL_BASE_URL, PACT_BROKER_BASE_URL_USERNAME and PACT_BROKER_BASE_URL_PASSWORD may be used instead of their respective command line options.
82
79
 
83
80
  SCENARIOS
84
81
 
85
- Check the status of the pacts for a pacticipant version:
82
+ # If every build goes straight to production
86
83
 
87
- $ pact-broker can-i-deploy --pacticipant PACTICIPANT --version VERSION --broker-base-url BROKER_BASE_URL
84
+ Check the status of the pacts for a pacticipant version. Note that this only checks that the most recent verification for each pact is successful. It doesn't provide any assurance that the pact has been verified by the *production* version of the provider, however, it is sufficient if you are doing true continuous deployment.
88
85
 
89
- Check the status of the pacts for the latest pacticipant version:
86
+ $ pact-broker can-i-deploy --pacticipant PACTICIPANT --version VERSION --broker-base-url BROKER_BASE_URL
90
87
 
91
- $ pact-broker can-i-deploy --pacticipant PACTICIPANT --latest --broker-base-url BROKER_BASE_URL
88
+ # If every build does NOT go straight to production
89
+
90
+ ## Recommended approach
91
+
92
+ If all applications within the pact network are not being deployed continuously (ie. if there is a gap between pact verification and actual deployment) then the following strategy is recommended. Each application version should be tagged in the broker with the name of the stage (eg. test, staging, production) as it is deployed (see the pact-broker create-version-tag CLI). This enables you to use the following very simple command to check if the application version you are about to deploy is compatible with every other application version already deployed in that environment.
93
+
94
+ $ pact-broker can-i-deploy --pacticipant PACTICIPANT --version VERSION --to TAG --broker-base-url BROKER_BASE_URL
95
+
96
+ ## Other approaches
97
+
98
+ If you do not/cannot tag every application at deployment, you have two options. You can either use the very first form of this command which just checks that the *latest* verification is successful (not recommended as it's the production version that you really care about) or you will need to determine the production versions of each collaborating application from some other source (eg. git) and explictly reference each one using one using the format `--pacticipant PACTICIPANT1 --version VERSION1 --pacticipant PACTICIPANT2 --version VERSION2 ...`
99
+
100
+ # Other commands
101
+
102
+ Check the status of the pacts for the latest pacticipant version. This form is not recommended for use in your CI as it is possible that the version you are about to deploy is not the the version that the Broker considers the latest. It's best to specify the version explictly.
103
+
104
+ $ pact-broker can-i-deploy --pacticipant PACTICIPANT --latest --broker-base-url BROKER_BASE_URL
92
105
 
93
106
  Check the status of the pacts for the latest pacticipant version for a given tag:
94
107
 
95
- $ pact-broker can-i-deploy --pacticipant PACTICIPANT --latest TAG --broker-base-url BROKER_BASE_URL
108
+ $ pact-broker can-i-deploy --pacticipant PACTICIPANT --latest TAG --broker-base-url BROKER_BASE_URL
96
109
 
97
110
  Check the status of the pacts between two (or more) specific pacticipant versions:
98
111
 
99
- $ pact-broker can-i-deploy --pacticipant PACTICIPANT1 --version VERSION1 --pacticipant PACTICIPANT2 --version VERSION2
100
- --broker-base-url BROKER_BASE_URL
112
+ $ pact-broker can-i-deploy --pacticipant PACTICIPANT1 --version VERSION1 --pacticipant PACTICIPANT2 --version VERSION2 --broker-base-url BROKER_BASE_URL
101
113
 
102
114
  Check the status of the pacts between the latest versions of two (or more) pacticipants:
103
115
 
104
- $ pact-broker can-i-deploy --pacticipant PACTICIPANT1 --latest --pacticipant PACTICIPANT2 --latest --broker-base-url
105
- BROKER
116
+ $ pact-broker can-i-deploy --pacticipant PACTICIPANT1 --latest --pacticipant PACTICIPANT2 --latest --broker-base-url BROKER_BASE_URL
106
117
 
107
118
  Check the status of the pacts between the latest versions of two (or more) pacticipants with a given tag:
108
119
 
109
- $ pact-broker can-i-deploy --pacticipant PACTICIPANT1 --latest TAG1 --pacticipant PACTICIPANT2 --latest TAG2
110
- --broker-base-url BROKER_BASE_URL
120
+ $ pact-broker can-i-deploy --pacticipant PACTICIPANT1 --latest TAG1 --pacticipant PACTICIPANT2 --latest TAG2 --broker-base-url BROKER_BASE_URL
121
+
111
122
  ```
112
123
 
113
124
  ## Usage - Ruby
@@ -0,0 +1,582 @@
1
+ ### A pact between Pact Broker Client and Pact Broker
2
+
3
+ #### Requests from Pact Broker Client to Pact Broker
4
+
5
+ * [A request for the latest version](#a_request_for_the_latest_version_given_no_version_exists_for_the_Pricing_Service) given no version exists for the Pricing Service
6
+
7
+ * [A request for the latest version tagged with 'prod'](#a_request_for_the_latest_version_tagged_with_'prod'_given_a_version_with_production_details_exists_for_the_Pricing_Service) given a version with production details exists for the Pricing Service
8
+
9
+ * [A request retrieve a pact for a specific version](#a_request_retrieve_a_pact_for_a_specific_version_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0) given the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0
10
+
11
+ * [A request to get the Pricing Service](#a_request_to_get_the_Pricing_Service_given_the_'Pricing_Service'_already_exists_in_the_pact-broker) given the 'Pricing Service' already exists in the pact-broker
12
+
13
+ * [A request to get the Pricing Service](#a_request_to_get_the_Pricing_Service_given_the_'Pricing_Service'_does_not_exist_in_the_pact-broker) given the 'Pricing Service' does not exist in the pact-broker
14
+
15
+ * [A request to list pacticipants](#a_request_to_list_pacticipants_given_'Condor'_exists_in_the_pact-broker) given 'Condor' exists in the pact-broker
16
+
17
+ * [A request to list the latest pacts](#a_request_to_list_the_latest_pacts_given_a_pact_between_Condor_and_the_Pricing_Service_exists) given a pact between Condor and the Pricing Service exists
18
+
19
+ * [A request to publish a pact](#a_request_to_publish_a_pact_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0) given the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0
20
+
21
+ * [A request to publish a pact](#a_request_to_publish_a_pact_given_'Condor'_already_exist_in_the_pact-broker,_but_the_'Pricing_Service'_does_not) given 'Condor' already exist in the pact-broker, but the 'Pricing Service' does not
22
+
23
+ * [A request to publish a pact](#a_request_to_publish_a_pact_given_the_'Pricing_Service'_already_exists_in_the_pact-broker) given the 'Pricing Service' already exists in the pact-broker
24
+
25
+ * [A request to publish a pact](#a_request_to_publish_a_pact_given_an_error_occurs_while_publishing_a_pact) given an error occurs while publishing a pact
26
+
27
+ * [A request to register the repository URL of a pacticipant](#a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_already_exists_in_the_pact-broker) given the 'Pricing Service' already exists in the pact-broker
28
+
29
+ * [A request to register the repository URL of a pacticipant](#a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_does_not_exist_in_the_pact-broker) given the 'Pricing Service' does not exist in the pact-broker
30
+
31
+ * [A request to retrieve the latest pact between Condor and the Pricing Service](#a_request_to_retrieve_the_latest_pact_between_Condor_and_the_Pricing_Service_given_a_pact_between_Condor_and_the_Pricing_Service_exists) given a pact between Condor and the Pricing Service exists
32
+
33
+ * [A request to retrieve the latest pact between Condor and the Pricing Service](#a_request_to_retrieve_the_latest_pact_between_Condor_and_the_Pricing_Service_given_no_pact_between_Condor_and_the_Pricing_Service_exists) given no pact between Condor and the Pricing Service exists
34
+
35
+ * [A request to retrieve the pact between the production verison of Condor and the Pricing Service](#a_request_to_retrieve_the_pact_between_the_production_verison_of_Condor_and_the_Pricing_Service_given_a_pact_between_Condor_and_the_Pricing_Service_exists_for_the_production_version_of_Condor) given a pact between Condor and the Pricing Service exists for the production version of Condor
36
+
37
+ * [A request to tag the production version of Condor](#a_request_to_tag_the_production_version_of_Condor_given_'Condor'_exists_in_the_pact-broker_with_version_1.3.0,_tagged_with_'prod') given 'Condor' exists in the pact-broker with version 1.3.0, tagged with 'prod'
38
+
39
+ * [A request to tag the production version of Condor](#a_request_to_tag_the_production_version_of_Condor_given_'Condor'_does_not_exist_in_the_pact-broker) given 'Condor' does not exist in the pact-broker
40
+
41
+ * [A request to tag the production version of Condor](#a_request_to_tag_the_production_version_of_Condor_given_'Condor'_exists_in_the_pact-broker) given 'Condor' exists in the pact-broker
42
+
43
+ #### Interactions
44
+
45
+ <a name="a_request_for_the_latest_version_given_no_version_exists_for_the_Pricing_Service"></a>
46
+ Given **no version exists for the Pricing Service**, upon receiving **a request for the latest version** from Pact Broker Client, with
47
+ ```json
48
+ {
49
+ "method": "get",
50
+ "path": "/pacticipants/Pricing%20Service/versions/latest",
51
+ "headers": {
52
+ "Accept": "application/json"
53
+ }
54
+ }
55
+ ```
56
+ Pact Broker will respond with:
57
+ ```json
58
+ {
59
+ "status": 404
60
+ }
61
+ ```
62
+ <a name="a_request_for_the_latest_version_tagged_with_'prod'_given_a_version_with_production_details_exists_for_the_Pricing_Service"></a>
63
+ Given **a version with production details exists for the Pricing Service**, upon receiving **a request for the latest version tagged with 'prod'** from Pact Broker Client, with
64
+ ```json
65
+ {
66
+ "method": "get",
67
+ "path": "/pacticipants/Pricing%20Service/versions/latest",
68
+ "query": "tag=prod",
69
+ "headers": {
70
+ "Accept": "application/json"
71
+ }
72
+ }
73
+ ```
74
+ Pact Broker will respond with:
75
+ ```json
76
+ {
77
+ "status": 200,
78
+ "headers": {
79
+ "Content-Type": "application/json"
80
+ },
81
+ "body": {
82
+ "number": "1.2.3",
83
+ "repository_ref": "package/pricing-service-1.2.3",
84
+ "tags": [
85
+ "prod"
86
+ ]
87
+ }
88
+ }
89
+ ```
90
+ <a name="a_request_retrieve_a_pact_for_a_specific_version_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0"></a>
91
+ Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0**, upon receiving **a request retrieve a pact for a specific version** from Pact Broker Client, with
92
+ ```json
93
+ {
94
+ "method": "get",
95
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0"
96
+ }
97
+ ```
98
+ Pact Broker will respond with:
99
+ ```json
100
+ {
101
+ "status": 200,
102
+ "body": {
103
+ "consumer": {
104
+ "name": "Condor"
105
+ },
106
+ "provider": {
107
+ "name": "Pricing Service"
108
+ },
109
+ "interactions": [
110
+
111
+ ]
112
+ }
113
+ }
114
+ ```
115
+ <a name="a_request_to_get_the_Pricing_Service_given_the_'Pricing_Service'_already_exists_in_the_pact-broker"></a>
116
+ Given **the 'Pricing Service' already exists in the pact-broker**, upon receiving **a request to get the Pricing Service** from Pact Broker Client, with
117
+ ```json
118
+ {
119
+ "method": "get",
120
+ "path": "/pacticipants/Pricing%20Service"
121
+ }
122
+ ```
123
+ Pact Broker will respond with:
124
+ ```json
125
+ {
126
+ "status": 200,
127
+ "headers": {
128
+ "Content-Type": "application/hal+json"
129
+ },
130
+ "body": {
131
+ "_links": {
132
+ "self": {
133
+ "href": "http://example.org/pacticipants/Pricing%20Service"
134
+ },
135
+ "versions": {
136
+ "href": "http://example.org/pacticipants/Pricing%20Service/versions"
137
+ },
138
+ "latest_version": {
139
+ "href": "http://example.org/pacticipants/Pricing%20Service/versions/latest"
140
+ }
141
+ },
142
+ "name": "Pricing Service",
143
+ "repository_url": "git@git.realestate.com.au:business-systems/pricing-service",
144
+ "_embedded": {
145
+ "latest_version": {
146
+ "_links": {
147
+ "self": {
148
+ "href": "http://example.org/pacticipants/Pricing%20Service/versions/1.3.0"
149
+ }
150
+ },
151
+ "number": "1.3.0"
152
+ }
153
+ }
154
+ }
155
+ }
156
+ ```
157
+ <a name="a_request_to_get_the_Pricing_Service_given_the_'Pricing_Service'_does_not_exist_in_the_pact-broker"></a>
158
+ Given **the 'Pricing Service' does not exist in the pact-broker**, upon receiving **a request to get the Pricing Service** from Pact Broker Client, with
159
+ ```json
160
+ {
161
+ "method": "get",
162
+ "path": "/pacticipants/Pricing%20Service"
163
+ }
164
+ ```
165
+ Pact Broker will respond with:
166
+ ```json
167
+ {
168
+ "status": 404
169
+ }
170
+ ```
171
+ <a name="a_request_to_list_pacticipants_given_'Condor'_exists_in_the_pact-broker"></a>
172
+ Given **'Condor' exists in the pact-broker**, upon receiving **a request to list pacticipants** from Pact Broker Client, with
173
+ ```json
174
+ {
175
+ "method": "get",
176
+ "path": "/pacticipants"
177
+ }
178
+ ```
179
+ Pact Broker will respond with:
180
+ ```json
181
+ {
182
+ "status": 200,
183
+ "headers": {
184
+ "Content-Type": "application/hal+json"
185
+ },
186
+ "body": {
187
+ "_links": {
188
+ "self": {
189
+ "href": "http://example.org/pacticipants"
190
+ },
191
+ "pacticipants": [
192
+ {
193
+ "href": "http://example.org/pacticipants/Condor",
194
+ "title": "Condor"
195
+ }
196
+ ]
197
+ },
198
+ "pacticipants": [
199
+ {
200
+ "_links": {
201
+ "self": {
202
+ "href": "http://example.org/pacticipants/Condor"
203
+ }
204
+ },
205
+ "name": "Condor",
206
+ "_embedded": {
207
+ "latest_version": {
208
+ "_links": {
209
+ "self": {
210
+ "href": "http://example.org/pacticipants/Condor/versions/1.3.0"
211
+ }
212
+ },
213
+ "number": "1.3.0"
214
+ }
215
+ }
216
+ }
217
+ ]
218
+ }
219
+ }
220
+ ```
221
+ <a name="a_request_to_list_the_latest_pacts_given_a_pact_between_Condor_and_the_Pricing_Service_exists"></a>
222
+ Given **a pact between Condor and the Pricing Service exists**, upon receiving **a request to list the latest pacts** from Pact Broker Client, with
223
+ ```json
224
+ {
225
+ "method": "get",
226
+ "path": "/pacts/latest"
227
+ }
228
+ ```
229
+ Pact Broker will respond with:
230
+ ```json
231
+ {
232
+ "status": 200,
233
+ "headers": {
234
+ "Content-Type": "application/hal+json"
235
+ },
236
+ "body": {
237
+ "_links": {
238
+ "self": {
239
+ "href": "http://example.org/pacts/latest"
240
+ }
241
+ },
242
+ "pacts": [
243
+ {
244
+ "_links": {
245
+ "self": [
246
+ {
247
+ "href": "http://example.org/pact/provider/Pricing%20Service/consumer/Condor/latest"
248
+ },
249
+ {
250
+ "href": "http://example.org/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0"
251
+ }
252
+ ]
253
+ },
254
+ "_embedded": {
255
+ "consumer": {
256
+ "name": "Condor",
257
+ "_links": {
258
+ "self": {
259
+ "href": "http://example.org/pacticipants/Condor"
260
+ }
261
+ },
262
+ "_embedded": {
263
+ "version": {
264
+ "number": "1.3.0"
265
+ }
266
+ }
267
+ },
268
+ "provider": {
269
+ "_links": {
270
+ "self": {
271
+ "href": "http://example.org/pacticipants/Pricing%20Service"
272
+ }
273
+ },
274
+ "name": "Pricing Service"
275
+ }
276
+ }
277
+ }
278
+ ]
279
+ }
280
+ }
281
+ ```
282
+ <a name="a_request_to_publish_a_pact_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0"></a>
283
+ Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0**, upon receiving **a request to publish a pact** from Pact Broker Client, with
284
+ ```json
285
+ {
286
+ "method": "put",
287
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
288
+ "headers": {
289
+ "Content-Type": "application/json"
290
+ },
291
+ "body": {
292
+ "consumer": {
293
+ "name": "Condor"
294
+ },
295
+ "provider": {
296
+ "name": "Pricing Service"
297
+ },
298
+ "interactions": [
299
+
300
+ ]
301
+ }
302
+ }
303
+ ```
304
+ Pact Broker will respond with:
305
+ ```json
306
+ {
307
+ "status": 200
308
+ }
309
+ ```
310
+ <a name="a_request_to_publish_a_pact_given_'Condor'_already_exist_in_the_pact-broker,_but_the_'Pricing_Service'_does_not"></a>
311
+ Given **'Condor' already exist in the pact-broker, but the 'Pricing Service' does not**, upon receiving **a request to publish a pact** from Pact Broker Client, with
312
+ ```json
313
+ {
314
+ "method": "put",
315
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
316
+ "headers": {
317
+ "Content-Type": "application/json"
318
+ },
319
+ "body": {
320
+ "consumer": {
321
+ "name": "Condor"
322
+ },
323
+ "provider": {
324
+ "name": "Pricing Service"
325
+ },
326
+ "interactions": [
327
+
328
+ ]
329
+ }
330
+ }
331
+ ```
332
+ Pact Broker will respond with:
333
+ ```json
334
+ {
335
+ "status": 201
336
+ }
337
+ ```
338
+ <a name="a_request_to_publish_a_pact_given_the_'Pricing_Service'_already_exists_in_the_pact-broker"></a>
339
+ Given **the 'Pricing Service' already exists in the pact-broker**, upon receiving **a request to publish a pact** from Pact Broker Client, with
340
+ ```json
341
+ {
342
+ "method": "put",
343
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
344
+ "headers": {
345
+ "Content-Type": "application/json"
346
+ },
347
+ "body": {
348
+ "consumer": {
349
+ "name": "Condor"
350
+ },
351
+ "provider": {
352
+ "name": "Pricing Service"
353
+ },
354
+ "interactions": [
355
+
356
+ ]
357
+ }
358
+ }
359
+ ```
360
+ Pact Broker will respond with:
361
+ ```json
362
+ {
363
+ "status": 201
364
+ }
365
+ ```
366
+ <a name="a_request_to_publish_a_pact_given_an_error_occurs_while_publishing_a_pact"></a>
367
+ Given **an error occurs while publishing a pact**, upon receiving **a request to publish a pact** from Pact Broker Client, with
368
+ ```json
369
+ {
370
+ "method": "put",
371
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
372
+ "headers": {
373
+ "Content-Type": "application/json"
374
+ },
375
+ "body": {
376
+ "consumer": {
377
+ "name": "Condor"
378
+ },
379
+ "provider": {
380
+ "name": "Pricing Service"
381
+ },
382
+ "interactions": [
383
+
384
+ ]
385
+ }
386
+ }
387
+ ```
388
+ Pact Broker will respond with:
389
+ ```json
390
+ {
391
+ "status": 500,
392
+ "headers": {
393
+ "Content-Type": "application/json"
394
+ },
395
+ "body": {
396
+ "message": "An error occurred"
397
+ }
398
+ }
399
+ ```
400
+ <a name="a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_already_exists_in_the_pact-broker"></a>
401
+ Given **the 'Pricing Service' already exists in the pact-broker**, upon receiving **a request to register the repository URL of a pacticipant** from Pact Broker Client, with
402
+ ```json
403
+ {
404
+ "method": "patch",
405
+ "path": "/pacticipants/Pricing%20Service",
406
+ "headers": {
407
+ "Content-Type": "application/json"
408
+ },
409
+ "body": {
410
+ "repository_url": "git@git.realestate.com.au:business-systems/pricing-service"
411
+ }
412
+ }
413
+ ```
414
+ Pact Broker will respond with:
415
+ ```json
416
+ {
417
+ "status": 200
418
+ }
419
+ ```
420
+ <a name="a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_does_not_exist_in_the_pact-broker"></a>
421
+ Given **the 'Pricing Service' does not exist in the pact-broker**, upon receiving **a request to register the repository URL of a pacticipant** from Pact Broker Client, with
422
+ ```json
423
+ {
424
+ "method": "patch",
425
+ "path": "/pacticipants/Pricing%20Service",
426
+ "headers": {
427
+ "Content-Type": "application/json"
428
+ },
429
+ "body": {
430
+ "repository_url": "git@git.realestate.com.au:business-systems/pricing-service"
431
+ }
432
+ }
433
+ ```
434
+ Pact Broker will respond with:
435
+ ```json
436
+ {
437
+ "status": 201
438
+ }
439
+ ```
440
+ <a name="a_request_to_retrieve_the_latest_pact_between_Condor_and_the_Pricing_Service_given_a_pact_between_Condor_and_the_Pricing_Service_exists"></a>
441
+ Given **a pact between Condor and the Pricing Service exists**, upon receiving **a request to retrieve the latest pact between Condor and the Pricing Service** from Pact Broker Client, with
442
+ ```json
443
+ {
444
+ "method": "get",
445
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/latest"
446
+ }
447
+ ```
448
+ Pact Broker will respond with:
449
+ ```json
450
+ {
451
+ "status": 200,
452
+ "headers": {
453
+ "Content-Type": "application/json",
454
+ "X-Pact-Consumer-Version": "1.3.0"
455
+ },
456
+ "body": {
457
+ "consumer": {
458
+ "name": "Condor"
459
+ },
460
+ "provider": {
461
+ "name": "Pricing Service"
462
+ },
463
+ "interactions": [
464
+
465
+ ]
466
+ }
467
+ }
468
+ ```
469
+ <a name="a_request_to_retrieve_the_latest_pact_between_Condor_and_the_Pricing_Service_given_no_pact_between_Condor_and_the_Pricing_Service_exists"></a>
470
+ Given **no pact between Condor and the Pricing Service exists**, upon receiving **a request to retrieve the latest pact between Condor and the Pricing Service** from Pact Broker Client, with
471
+ ```json
472
+ {
473
+ "method": "get",
474
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/latest"
475
+ }
476
+ ```
477
+ Pact Broker will respond with:
478
+ ```json
479
+ {
480
+ "status": 404
481
+ }
482
+ ```
483
+ <a name="a_request_to_retrieve_the_pact_between_the_production_verison_of_Condor_and_the_Pricing_Service_given_a_pact_between_Condor_and_the_Pricing_Service_exists_for_the_production_version_of_Condor"></a>
484
+ Given **a pact between Condor and the Pricing Service exists for the production version of Condor**, upon receiving **a request to retrieve the pact between the production verison of Condor and the Pricing Service** from Pact Broker Client, with
485
+ ```json
486
+ {
487
+ "method": "get",
488
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/latest/prod",
489
+ "headers": {
490
+ "Accept": "application/json"
491
+ }
492
+ }
493
+ ```
494
+ Pact Broker will respond with:
495
+ ```json
496
+ {
497
+ "status": 200,
498
+ "body": {
499
+ "consumer": {
500
+ "name": "Condor"
501
+ },
502
+ "provider": {
503
+ "name": "Pricing Service"
504
+ },
505
+ "interactions": [
506
+
507
+ ]
508
+ }
509
+ }
510
+ ```
511
+ <a name="a_request_to_tag_the_production_version_of_Condor_given_'Condor'_exists_in_the_pact-broker_with_version_1.3.0,_tagged_with_'prod'"></a>
512
+ Given **'Condor' exists in the pact-broker with version 1.3.0, tagged with 'prod'**, upon receiving **a request to tag the production version of Condor** from Pact Broker Client, with
513
+ ```json
514
+ {
515
+ "method": "put",
516
+ "path": "/pacticipants/Condor/versions/1.3.0/tags/prod",
517
+ "headers": {
518
+ "Content-Type": "application/json"
519
+ }
520
+ }
521
+ ```
522
+ Pact Broker will respond with:
523
+ ```json
524
+ {
525
+ "status": 200,
526
+ "body": {
527
+ "_links": {
528
+ "self": {
529
+ "href": "http://localhost:1234/pacticipants/Condor/versions/1.3.0/tags/prod"
530
+ }
531
+ }
532
+ }
533
+ }
534
+ ```
535
+ <a name="a_request_to_tag_the_production_version_of_Condor_given_'Condor'_does_not_exist_in_the_pact-broker"></a>
536
+ Given **'Condor' does not exist in the pact-broker**, upon receiving **a request to tag the production version of Condor** from Pact Broker Client, with
537
+ ```json
538
+ {
539
+ "method": "put",
540
+ "path": "/pacticipants/Condor/versions/1.3.0/tags/prod",
541
+ "headers": {
542
+ "Content-Type": "application/json"
543
+ }
544
+ }
545
+ ```
546
+ Pact Broker will respond with:
547
+ ```json
548
+ {
549
+ "status": 201,
550
+ "body": {
551
+ "_links": {
552
+ "self": {
553
+ "href": "http://localhost:1234/pacticipants/Condor/versions/1.3.0/tags/prod"
554
+ }
555
+ }
556
+ }
557
+ }
558
+ ```
559
+ <a name="a_request_to_tag_the_production_version_of_Condor_given_'Condor'_exists_in_the_pact-broker"></a>
560
+ Given **'Condor' exists in the pact-broker**, upon receiving **a request to tag the production version of Condor** from Pact Broker Client, with
561
+ ```json
562
+ {
563
+ "method": "put",
564
+ "path": "/pacticipants/Condor/versions/1.3.0/tags/prod",
565
+ "headers": {
566
+ "Content-Type": "application/json"
567
+ }
568
+ }
569
+ ```
570
+ Pact Broker will respond with:
571
+ ```json
572
+ {
573
+ "status": 201,
574
+ "body": {
575
+ "_links": {
576
+ "self": {
577
+ "href": "http://localhost:1234/pacticipants/Condor/versions/1.3.0/tags/prod"
578
+ }
579
+ }
580
+ }
581
+ }
582
+ ```