pact-provider-verifier 1.34.0 → 1.35.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 +7 -0
- data/README.md +5 -3
- data/lib/pact/provider_verifier/app.rb +38 -24
- data/lib/pact/provider_verifier/cli/long_desc.txt +1 -1
- data/lib/pact/provider_verifier/cli/verify.rb +1 -0
- 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: 40aec54d6032b2a63f96e834a0308e98f6093af635bf5450b6575d05eb7a8549
|
4
|
+
data.tar.gz: f445fbe3035fc931018214d5bad5f8e616e8dda0ba682a8051081505503796a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d9941c91fed0ca20106fc24077c20556ea3757aa3ca176718e50d1c903e5d6608620c5160916c5396908e30ecd01fa58e4c4a1e25654cbbe26cfaf1da312c61
|
7
|
+
data.tar.gz: 1317675953ae4ebecaa9c289deac2a7f09fda5ef3778f6dfada6651d5bc52a49ae5629fa8b55b63ea1d0755942be26b151ec0ad0a7ac6687d1f8b5bb77f2e036
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -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
|
112
|
-
|
113
|
-
|
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
|
|
@@ -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
|
-
|
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
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
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
|
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'
|
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.
|
4
|
+
version: 1.35.0
|
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-
|
12
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -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.2.
|
345
|
+
rubygems_version: 3.2.15
|
346
346
|
signing_key:
|
347
347
|
specification_version: 4
|
348
348
|
summary: Provides a Pact verification service for use with Pact
|