pact-provider-verifier 1.33.0 → 1.35.2

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: 19a73b344452f633690908ead759a85349e8e353013434d55768b52cf10790a2
4
- data.tar.gz: a26ebbbc4c7c815f8d4371f542b7a776ccf106739d47fb1a923689734cb3eb0c
3
+ metadata.gz: 1da620e3bd8af64056ca56b69e7418fc553cf7f483c424663d4b83e8944a1553
4
+ data.tar.gz: 25457d2f283ad92249eb9b8ac043388502ebc7685ba9235124dcc561d19388e5
5
5
  SHA512:
6
- metadata.gz: a40905eb9fba372d57383e5d821c6b9e94db328961c3f269ebf8945d97f3c0c22d7940a7128b5f98913656828de7b28e2e9d56edec3b390abe0df5b0f5481cf4
7
- data.tar.gz: e733b80534460fb57f14d01b0af3a5fce0fb4f80e898082eb08826107d52d5754842cdd86f660190ed1891844f5479630b0d8e3c7d3c7ef3f202535392cd9b04
6
+ metadata.gz: a4e6573b850a10f7c4721d6809baf97eca0f7525c0ee23c33da8537ec4285c77530db7ca519c72be65ed691370df957bfb66dc95fdc0f79c511c9dff09e4f712
7
+ data.tar.gz: a63fb41d4e5f4f1f846f3b3badc8aa9d14b56eb805d4a1618879284e4f72c405d235160ea3c3ecb7bab60260c9d9ebdb76d65f5c07da9a43380f0d21e4ca55a9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ <a name="v1.35.2"></a>
2
+ ### v1.35.2 (2021-09-09)
3
+
4
+ #### Bug Fixes
5
+
6
+ * lock pact gem to compatible version ([b4db21e](/../../commit/b4db21e))
7
+
8
+ <a name="v1.35.1"></a>
9
+ ### v1.35.1 (2021-07-01)
10
+
11
+ #### Bug Fixes
12
+
13
+ * exit with correct exit code on failure ([a8a2144](/../../commit/a8a2144))
14
+
15
+ <a name="v1.35.0"></a>
16
+ ### v1.35.0 (2021-03-20)
17
+
18
+ #### Features
19
+
20
+ * Optionally fail when no pacts are found ([772e8fb](/../../commit/772e8fb))
21
+
22
+ <a name="v1.34.0"></a>
23
+ ### v1.34.0 (2021-02-01)
24
+
25
+ #### Features
26
+
27
+ * Allow for newer versions of faraday ([c37f04f](/../../commit/c37f04f))
28
+
1
29
  <a name="v1.33.0"></a>
2
30
  ### v1.33.0 (2021-01-27)
3
31
 
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
@@ -187,25 +192,34 @@ module Pact
187
192
  end
188
193
 
189
194
  def all_pact_urls
190
- http_client_options = {
191
- username: options.broker_username || ENV['PACT_BROKER_USERNAME'],
192
- password: options.broker_password || ENV['PACT_BROKER_PASSWORD'],
193
- token: options.broker_token || ENV['PACT_BROKER_TOKEN'],
194
- verbose: verbose?
195
- }
196
- opts = {
197
- enable_pending: options.enable_pending,
198
- include_wip_pacts_since: options.include_wip_pacts_since
199
- }
200
- AggregatePactConfigs.call(
201
- pact_urls,
202
- options.provider,
203
- consumer_version_tags,
204
- consumer_version_selectors,
205
- provider_version_tags,
206
- options.pact_broker_base_url || ENV['PACT_BROKER_BASE_URL'],
207
- http_client_options,
208
- 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
209
223
  end
210
224
 
211
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
 
@@ -38,6 +38,7 @@ module Pact
38
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
39
39
  method_option :log_dir, desc: "The directory for the pact.log file"
40
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
41
42
 
42
43
  def verify(*pact_urls)
43
44
  require 'pact/provider_verifier/app'
@@ -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.33.0"
3
+ VERSION = "1.35.2"
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.33.0
4
+ version: 1.35.2
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: 2021-01-26 00:00:00.000000000 Z
12
+ date: 2021-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -32,6 +32,9 @@ dependencies:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1.55'
35
+ - - "<"
36
+ - !ruby/object:Gem::Version
37
+ version: '1.58'
35
38
  type: :runtime
36
39
  prerelease: false
37
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -39,6 +42,9 @@ dependencies:
39
42
  - - "~>"
40
43
  - !ruby/object:Gem::Version
41
44
  version: '1.55'
45
+ - - "<"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.58'
42
48
  - !ruby/object:Gem::Dependency
43
49
  name: pact-message
44
50
  requirement: !ruby/object:Gem::Requirement
@@ -57,36 +63,42 @@ dependencies:
57
63
  name: faraday
58
64
  requirement: !ruby/object:Gem::Requirement
59
65
  requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '0.9'
63
66
  - - ">="
64
67
  - !ruby/object:Gem::Version
65
68
  version: 0.9.0
69
+ - - "<="
70
+ - !ruby/object:Gem::Version
71
+ version: '2.0'
66
72
  type: :runtime
67
73
  prerelease: false
68
74
  version_requirements: !ruby/object:Gem::Requirement
69
75
  requirements:
70
- - - "~>"
71
- - !ruby/object:Gem::Version
72
- version: '0.9'
73
76
  - - ">="
74
77
  - !ruby/object:Gem::Version
75
78
  version: 0.9.0
79
+ - - "<="
80
+ - !ruby/object:Gem::Version
81
+ version: '2.0'
76
82
  - !ruby/object:Gem::Dependency
77
83
  name: faraday_middleware
78
84
  requirement: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - "~>"
86
+ - - ">="
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0.10'
89
+ - - "<="
90
+ - !ruby/object:Gem::Version
91
+ version: '2.0'
83
92
  type: :runtime
84
93
  prerelease: false
85
94
  version_requirements: !ruby/object:Gem::Requirement
86
95
  requirements:
87
- - - "~>"
96
+ - - ">="
88
97
  - !ruby/object:Gem::Version
89
98
  version: '0.10'
99
+ - - "<="
100
+ - !ruby/object:Gem::Version
101
+ version: '2.0'
90
102
  - !ruby/object:Gem::Dependency
91
103
  name: json
92
104
  requirement: !ruby/object:Gem::Requirement
@@ -336,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
336
348
  - !ruby/object:Gem::Version
337
349
  version: '0'
338
350
  requirements: []
339
- rubygems_version: 3.2.6
351
+ rubygems_version: 3.2.27
340
352
  signing_key:
341
353
  specification_version: 4
342
354
  summary: Provides a Pact verification service for use with Pact