pact-provider-verifier 1.32.0 → 1.35.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c886b7356a0fa2d7750fb31bbbc9f7854788dff7dd8d28749ea4b5c89c5689e6
4
- data.tar.gz: 956fb187e48661027ecdcda1197e6ccecd1ebd172b8eba29993a6ddd38b0976c
3
+ metadata.gz: 28573f8fe893fbf9a191616d9bdeee07eba3dbf3202eda14695299f31225eb88
4
+ data.tar.gz: b7bcc78dde971c1108b4880d4ed286000ce7a8b2a3f0bb55f49069e9c177a534
5
5
  SHA512:
6
- metadata.gz: 91ea65f6b83fd5940a30d85c40a1c02e3aac44431eb0aa27904752865c9bdc2e0a500d4a2e3c753d617b3a84bb97eddae4bc3ff02ff33110dc6d76f493d730b7
7
- data.tar.gz: 166d2b4da14375b27712ed057bef42ee29e5eeeca62702078f26bd03eab1bb91e7c1fcde0170e9696ea0065539c1ecfebecfb0d0c9871e4a615daa33c03676d9
6
+ metadata.gz: 11715e836ed1ad1262a9c782be06db924ade279fe51d4ef3edecd077f2ad173de0f02dc2e71f23beb3c4e2b73d2d161df0e7c6d945de02fa77504699d6449e40
7
+ data.tar.gz: d873504497c993e66a07a5bc8317f137dd2ad7c97f6ff27966c2c7e6012b215278f684a2d76e98e7dfd6ea6320232370249636b013eacade527910f6dee80648
data/CHANGELOG.md CHANGED
@@ -1,3 +1,40 @@
1
+ <a name="v1.35.1"></a>
2
+ ### v1.35.1 (2021-07-01)
3
+
4
+ #### Bug Fixes
5
+
6
+ * exit with correct exit code on failure ([a8a2144](/../../commit/a8a2144))
7
+
8
+ <a name="v1.35.0"></a>
9
+ ### v1.35.0 (2021-03-20)
10
+
11
+ #### Features
12
+
13
+ * Optionally fail when no pacts are found ([772e8fb](/../../commit/772e8fb))
14
+
15
+ <a name="v1.34.0"></a>
16
+ ### v1.34.0 (2021-02-01)
17
+
18
+ #### Features
19
+
20
+ * Allow for newer versions of faraday ([c37f04f](/../../commit/c37f04f))
21
+
22
+ <a name="v1.33.0"></a>
23
+ ### v1.33.0 (2021-01-27)
24
+
25
+ #### Features
26
+
27
+ * pass through verbose flag to verification ([a091705](/../../commit/a091705))
28
+
29
+ <a name="v1.32.1"></a>
30
+ ### v1.32.1 (2020-07-18)
31
+
32
+
33
+ #### Bug Fixes
34
+
35
+ * change rake to a development dependency ([6249a03](/../../commit/6249a03))
36
+
37
+
1
38
  <a name="v1.32.0"></a>
2
39
  ### v1.32.0 (2020-07-16)
3
40
 
data/README.md CHANGED
@@ -10,7 +10,7 @@ binary-like CLI tool.
10
10
 
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
- * Works with Pact [provider states](https://docs.pact.io/documentation/provider_states.html) should you need them
13
+ * Works with Pact [provider states](https://docs.pact.io/getting_started/provider_states) should you need them
14
14
  * Publishes the verification results back to the pact broker if the pact was retrieved from a broker.
15
15
 
16
16
  ## Installation
@@ -97,6 +97,8 @@ Options:
97
97
  # The log level
98
98
 
99
99
  # Default: debug
100
+ [--fail-if-no-pacts-found]
101
+ # If specified, will fail when no pacts are found
100
102
 
101
103
  Description:
102
104
  The parameters used when fetching pacts dynamically from a Pact Broker are:
@@ -108,9 +110,9 @@ Description:
108
110
  --enable-pending
109
111
  --include-wip-pacts-since
110
112
 
111
- To fetch a pact from a known URL (eg. when a
112
- verification is triggered by a 'contract content changed' webhook), pass in the pact URL(s) as
113
- the first argument(s) to the command.
113
+ To verify a pact at a known URL (eg. when a verification is triggered by a 'contract content changed'
114
+ webhook), pass in the pact URL(s) as the first argument(s) to the command, and do NOT set any of the
115
+ other parameters apart from the base URL and credentials.
114
116
 
115
117
  To publish verification results for either of the above scenarios, set:
116
118
 
@@ -159,7 +161,7 @@ Modification of the request headers is sometimes necessary, but be aware that an
159
161
 
160
162
  ### API with Provider States
161
163
 
162
- Read the [Provider States section on docs.pact.io](https://docs.pact.io/documentation/provider_states.html) for an introduction to provider states.
164
+ Read the [Provider States section on docs.pact.io](https://docs.pact.io/getting_started/provider_states) for an introduction to provider states.
163
165
 
164
166
  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:
165
167
 
@@ -36,18 +36,23 @@ module Pact
36
36
 
37
37
  def call
38
38
  setup
39
-
40
- pact_urls = all_pact_urls
39
+ warn_empty_pact_set
41
40
  wait_until_provider_available
42
- exit_statuses = pact_urls.collect do |pact_uri|
41
+ pacts_pass_verification?
42
+ end
43
+
44
+ private
45
+
46
+ def pacts_pass_verification?
47
+ return false if all_pact_urls.empty? && options.fail_if_no_pacts_found
48
+
49
+ exit_statuses = all_pact_urls.collect do |pact_uri|
43
50
  verify_pact pact_uri
44
51
  end
45
52
 
46
53
  exit_statuses.all?{ | status | status == 0 }
47
54
  end
48
55
 
49
- private
50
-
51
56
 
52
57
  def setup
53
58
  configure_output
@@ -159,6 +164,7 @@ module Pact
159
164
  pact_helper: PROXY_PACT_HELPER,
160
165
  pact_uri: pact_uri,
161
166
  backtrace: ENV['BACKTRACE'] == 'true',
167
+ verbose: verbose?,
162
168
  format: options.format,
163
169
  out: options.out,
164
170
  request_customizer: ProviderStates::AddProviderStatesHeader
@@ -186,25 +192,34 @@ module Pact
186
192
  end
187
193
 
188
194
  def all_pact_urls
189
- http_client_options = {
190
- username: options.broker_username || ENV['PACT_BROKER_USERNAME'],
191
- password: options.broker_password || ENV['PACT_BROKER_PASSWORD'],
192
- token: options.broker_token || ENV['PACT_BROKER_TOKEN'],
193
- verbose: verbose?
194
- }
195
- opts = {
196
- enable_pending: options.enable_pending,
197
- include_wip_pacts_since: options.include_wip_pacts_since
198
- }
199
- AggregatePactConfigs.call(
200
- pact_urls,
201
- options.provider,
202
- consumer_version_tags,
203
- consumer_version_selectors,
204
- provider_version_tags,
205
- options.pact_broker_base_url || ENV['PACT_BROKER_BASE_URL'],
206
- http_client_options,
207
- opts)
195
+ @all_pact_urls ||= begin
196
+ http_client_options = {
197
+ username: options.broker_username || ENV['PACT_BROKER_USERNAME'],
198
+ password: options.broker_password || ENV['PACT_BROKER_PASSWORD'],
199
+ token: options.broker_token || ENV['PACT_BROKER_TOKEN'],
200
+ verbose: verbose?
201
+ }
202
+ opts = {
203
+ enable_pending: options.enable_pending,
204
+ include_wip_pacts_since: options.include_wip_pacts_since
205
+ }
206
+ AggregatePactConfigs.call(
207
+ pact_urls,
208
+ options.provider,
209
+ consumer_version_tags,
210
+ consumer_version_selectors,
211
+ provider_version_tags,
212
+ options.pact_broker_base_url || ENV['PACT_BROKER_BASE_URL'],
213
+ http_client_options,
214
+ opts)
215
+ end
216
+ end
217
+
218
+ def warn_empty_pact_set
219
+ if all_pact_urls.empty?
220
+ level = options.fail_if_no_pacts_found ? "ERROR" : "WARN"
221
+ $stderr.puts "#{level}: No pacts were found for the consumer versions selected"
222
+ end
208
223
  end
209
224
 
210
225
  def require_pact_project_pact_helper
@@ -7,7 +7,7 @@ The parameters used when fetching pacts dynamically from a Pact Broker are:
7
7
  --enable-pending
8
8
  --include-wip-pacts-since
9
9
 
10
- To fetch a pact from a known URL (eg. when a verification is triggered by a 'contract content changed' webhook), pass in the pact URL(s) as the first argument(s) to the command.
10
+ To verify a pact at a known URL (eg. when a verification is triggered by a 'contract content changed' webhook), pass in the pact URL(s) as the first argument(s) to the command, and do NOT set any of the other parameters apart from the base URL and credentials.
11
11
 
12
12
  To publish verification results for either of the above scenarios, set:
13
13
 
@@ -1,6 +1,4 @@
1
1
  require 'thor'
2
- require 'socket'
3
- require 'pact/provider_verifier/app'
4
2
  require 'pact/provider_verifier/cli/custom_thor'
5
3
 
6
4
  module Pact
@@ -40,8 +38,11 @@ module Pact
40
38
  method_option :wait, banner: "SECONDS", required: false, type: :numeric, desc: "The number of seconds to poll for the provider to become available before running the verification", default: 0
41
39
  method_option :log_dir, desc: "The directory for the pact.log file"
42
40
  method_option :log_level, desc: "The log level", default: "debug"
41
+ method_option :fail_if_no_pacts_found, desc: "If specified, will fail when no pacts are found", required: false, type: :boolean, default: false
43
42
 
44
43
  def verify(*pact_urls)
44
+ require 'pact/provider_verifier/app'
45
+ require 'socket'
45
46
  validate_verify
46
47
  print_deprecation_warnings
47
48
  success = Pact::ProviderVerifier::App.call(merged_urls(pact_urls), options)
@@ -124,7 +125,7 @@ module Pact
124
125
  exit 1
125
126
  end
126
127
 
127
- def exit_on_failure?
128
+ def self.exit_on_failure?
128
129
  true
129
130
  end
130
131
  end
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module ProviderVerifier
3
- VERSION = "1.32.0"
3
+ VERSION = "1.35.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-provider-verifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.32.0
4
+ version: 1.35.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Fellows
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-16 00:00:00.000000000 Z
12
+ date: 2021-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.49'
34
+ version: '1.55'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.49'
41
+ version: '1.55'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: pact-message
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -57,36 +57,42 @@ dependencies:
57
57
  name: faraday
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '0.9'
63
60
  - - ">="
64
61
  - !ruby/object:Gem::Version
65
62
  version: 0.9.0
63
+ - - "<="
64
+ - !ruby/object:Gem::Version
65
+ version: '2.0'
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - "~>"
71
- - !ruby/object:Gem::Version
72
- version: '0.9'
73
70
  - - ">="
74
71
  - !ruby/object:Gem::Version
75
72
  version: 0.9.0
73
+ - - "<="
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: faraday_middleware
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.10'
83
+ - - "<="
84
+ - !ruby/object:Gem::Version
85
+ version: '2.0'
83
86
  type: :runtime
84
87
  prerelease: false
85
88
  version_requirements: !ruby/object:Gem::Requirement
86
89
  requirements:
87
- - - "~>"
90
+ - - ">="
88
91
  - !ruby/object:Gem::Version
89
92
  version: '0.10'
93
+ - - "<="
94
+ - !ruby/object:Gem::Version
95
+ version: '2.0'
90
96
  - !ruby/object:Gem::Dependency
91
97
  name: json
92
98
  requirement: !ruby/object:Gem::Requirement
@@ -116,53 +122,47 @@ dependencies:
116
122
  - !ruby/object:Gem::Version
117
123
  version: '2.1'
118
124
  - !ruby/object:Gem::Dependency
119
- name: rake
125
+ name: rack-reverse-proxy
120
126
  requirement: !ruby/object:Gem::Requirement
121
127
  requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '10.4'
125
128
  - - ">="
126
129
  - !ruby/object:Gem::Version
127
- version: 10.4.2
130
+ version: '0'
128
131
  type: :runtime
129
132
  prerelease: false
130
133
  version_requirements: !ruby/object:Gem::Requirement
131
134
  requirements:
132
- - - "~>"
133
- - !ruby/object:Gem::Version
134
- version: '10.4'
135
135
  - - ">="
136
136
  - !ruby/object:Gem::Version
137
- version: 10.4.2
137
+ version: '0'
138
138
  - !ruby/object:Gem::Dependency
139
- name: rack-reverse-proxy
139
+ name: rspec_junit_formatter
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - ">="
142
+ - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '0'
144
+ version: '0.3'
145
145
  type: :runtime
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ">="
149
+ - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '0'
151
+ version: '0.3'
152
152
  - !ruby/object:Gem::Dependency
153
- name: rspec_junit_formatter
153
+ name: rake
154
154
  requirement: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: '0.3'
159
- type: :runtime
158
+ version: '13.0'
159
+ type: :development
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: '0.3'
165
+ version: '13.0'
166
166
  - !ruby/object:Gem::Dependency
167
167
  name: sinatra
168
168
  requirement: !ruby/object:Gem::Requirement
@@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
342
  - !ruby/object:Gem::Version
343
343
  version: '0'
344
344
  requirements: []
345
- rubygems_version: 3.1.4
345
+ rubygems_version: 3.2.21
346
346
  signing_key:
347
347
  specification_version: 4
348
348
  summary: Provides a Pact verification service for use with Pact