pact-provider-verifier 1.31.0 → 1.32.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 +62 -27
- data/lib/pact/provider_verifier/app.rb +6 -2
- data/lib/pact/provider_verifier/cli/long_desc.txt +19 -0
- data/lib/pact/provider_verifier/cli/verify.rb +3 -14
- data/lib/pact/provider_verifier/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c886b7356a0fa2d7750fb31bbbc9f7854788dff7dd8d28749ea4b5c89c5689e6
|
4
|
+
data.tar.gz: 956fb187e48661027ecdcda1197e6ccecd1ebd172b8eba29993a6ddd38b0976c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91ea65f6b83fd5940a30d85c40a1c02e3aac44431eb0aa27904752865c9bdc2e0a500d4a2e3c753d617b3a84bb97eddae4bc3ff02ff33110dc6d76f493d730b7
|
7
|
+
data.tar.gz: 166d2b4da14375b27712ed057bef42ee29e5eeeca62702078f26bd03eab1bb91e7c1fcde0170e9696ea0065539c1ecfebecfb0d0c9871e4a615daa33c03676d9
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -41,53 +41,88 @@ Usage:
|
|
41
41
|
|
42
42
|
Options:
|
43
43
|
-h, --provider-base-url=PROVIDER_BASE_URL
|
44
|
-
|
44
|
+
# Provider host URL
|
45
45
|
-c, [--provider-states-setup-url=PROVIDER_STATES_SETUP_URL]
|
46
|
-
|
46
|
+
# Base URL to setup the provider states at
|
47
47
|
[--pact-broker-base-url=PACT_BROKER_BASE_URL]
|
48
|
-
|
48
|
+
# Base URL of the Pact Broker from which to retrieve the pacts. Can also be set
|
49
|
+
using the environment variable PACT_BROKER_BASE_URL.
|
49
50
|
-n, [--broker-username=BROKER_USERNAME]
|
50
|
-
|
51
|
+
# Pact Broker basic auth username. Can also be set using the environment
|
52
|
+
variable PACT_BROKER_USERNAME.
|
51
53
|
-p, [--broker-password=BROKER_PASSWORD]
|
52
|
-
|
54
|
+
# Pact Broker basic auth password. Can also be set using the environment
|
55
|
+
variable PACT_BROKER_PASSWORD.
|
53
56
|
-k, [--broker-token=BROKER_TOKEN]
|
54
|
-
|
57
|
+
# Pact Broker bearer token. Can also be set using the environment variable
|
58
|
+
PACT_BROKER_TOKEN.
|
55
59
|
[--provider=PROVIDER]
|
56
60
|
[--consumer-version-tag=TAG]
|
57
|
-
|
61
|
+
# Retrieve the latest pacts with this consumer version tag. Used in conjunction
|
62
|
+
with --provider. May be specified multiple times.
|
58
63
|
[--provider-version-tag=TAG]
|
59
|
-
|
64
|
+
# Tag to apply to the provider application version. May be specified multiple times.
|
60
65
|
-g, [--tag-with-git-branch], [--no-tag-with-git-branch]
|
61
|
-
|
66
|
+
# Tag provider version with the name of the current git branch. Default: false
|
62
67
|
-a, [--provider-app-version=PROVIDER_APP_VERSION]
|
63
|
-
|
68
|
+
# Provider application version, required when publishing verification results
|
64
69
|
-r, [--publish-verification-results], [--no-publish-verification-results]
|
65
|
-
|
70
|
+
# Publish verification results to the broker. This can also be enabled by
|
71
|
+
setting the environment variable PACT_BROKER_PUBLISH_VERIFICATION_RESULTS=true
|
72
|
+
[--enable-pending], [--no-enable-pending]
|
73
|
+
# Allow pacts which are in pending state to be verified without causing the
|
74
|
+
overall task to fail. For more information, see https://pact.io/pending
|
66
75
|
[--custom-provider-header=CUSTOM_PROVIDER_HEADER]
|
67
|
-
|
76
|
+
# Header to add to provider state set up and pact verification requests. eg
|
77
|
+
'Authorization: Basic cGFjdDpwYWN0'. May be specified multiple times.
|
68
78
|
[--custom-middleware=FILE]
|
69
|
-
|
79
|
+
# Ruby file containing a class implementing
|
80
|
+
Pact::ProviderVerifier::CustomMiddleware. This allows the response to be modified before
|
81
|
+
replaying. Use with caution!
|
70
82
|
-v, [--verbose=VERBOSE]
|
71
|
-
|
83
|
+
# Verbose output. Can also be set by setting the environment variable VERBOSE=true.
|
72
84
|
-f, [--format=FORMATTER]
|
73
|
-
|
85
|
+
# RSpec formatter. Defaults to custom Pact formatter. Other options are json
|
86
|
+
and RspecJunitFormatter (which outputs xml).
|
74
87
|
-o, [--out=FILE]
|
75
|
-
|
88
|
+
# Write output to a file instead of $stdout.
|
76
89
|
[--wait=SECONDS]
|
77
|
-
|
90
|
+
# The number of seconds to poll for the provider to become available before
|
91
|
+
running the verification
|
78
92
|
|
79
|
-
|
93
|
+
# Default: 0
|
94
|
+
[--log-dir=LOG_DIR]
|
95
|
+
# The directory for the pact.log file
|
96
|
+
[--log-level=LOG_LEVEL]
|
97
|
+
# The log level
|
98
|
+
|
99
|
+
# Default: debug
|
80
100
|
|
81
101
|
Description:
|
82
|
-
|
83
|
-
|
84
|
-
--
|
85
|
-
|
86
|
-
--
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
102
|
+
The parameters used when fetching pacts dynamically from a Pact Broker are:
|
103
|
+
|
104
|
+
--pact-broker-base-url (REQUIRED)
|
105
|
+
--provider (REQUIRED)
|
106
|
+
--broker-username/--broker-password or --broker-token
|
107
|
+
--consumer-version-tag or --consumer-version-selector
|
108
|
+
--enable-pending
|
109
|
+
--include-wip-pacts-since
|
110
|
+
|
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.
|
114
|
+
|
115
|
+
To publish verification results for either of the above scenarios, set:
|
116
|
+
|
117
|
+
--publish-verification-results (REQUIRED)
|
118
|
+
--provider-app-version (REQUIRED)
|
119
|
+
--provider-version-tag or --tag-with-git-branch
|
120
|
+
|
121
|
+
|
122
|
+
Selectors: These are specified using JSON strings. The keys are 'tag' (the name of the consumer
|
123
|
+
version tag), 'latest' (true|false), 'consumer', and 'fallbackTag'. For example '{\"tag\":
|
124
|
+
\"master\", \"latest\": true}'. For
|
125
|
+
a detailed explanation of selectors, see https://pact.io/selectors#consumer-version-selectors
|
91
126
|
```
|
92
127
|
|
93
128
|
## Examples
|
@@ -136,7 +136,7 @@ module Pact
|
|
136
136
|
|
137
137
|
def require_custom_middlware
|
138
138
|
options.custom_middleware.each do |file|
|
139
|
-
$stdout.puts "DEBUG: Requiring custom middleware file #{file}" if
|
139
|
+
$stdout.puts "DEBUG: Requiring custom middleware file #{file}" if verbose?
|
140
140
|
begin
|
141
141
|
require file
|
142
142
|
rescue LoadError => e
|
@@ -190,7 +190,7 @@ module Pact
|
|
190
190
|
username: options.broker_username || ENV['PACT_BROKER_USERNAME'],
|
191
191
|
password: options.broker_password || ENV['PACT_BROKER_PASSWORD'],
|
192
192
|
token: options.broker_token || ENV['PACT_BROKER_TOKEN'],
|
193
|
-
verbose:
|
193
|
+
verbose: verbose?
|
194
194
|
}
|
195
195
|
opts = {
|
196
196
|
enable_pending: options.enable_pending,
|
@@ -262,6 +262,10 @@ module Pact
|
|
262
262
|
ENV['PACT_BROKER_TOKEN'] = options.broker_token
|
263
263
|
end
|
264
264
|
end
|
265
|
+
|
266
|
+
def verbose?
|
267
|
+
options.verbose || ENV['VERBOSE'] == 'true'
|
268
|
+
end
|
265
269
|
end
|
266
270
|
end
|
267
271
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
The parameters used when fetching pacts dynamically from a Pact Broker are:
|
2
|
+
|
3
|
+
--pact-broker-base-url (REQUIRED)
|
4
|
+
--provider (REQUIRED)
|
5
|
+
--broker-username/--broker-password or --broker-token
|
6
|
+
--consumer-version-tag or --consumer-version-selector
|
7
|
+
--enable-pending
|
8
|
+
--include-wip-pacts-since
|
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.
|
11
|
+
|
12
|
+
To publish verification results for either of the above scenarios, set:
|
13
|
+
|
14
|
+
--publish-verification-results (REQUIRED)
|
15
|
+
--provider-app-version (REQUIRED)
|
16
|
+
--provider-version-tag or --tag-with-git-branch
|
17
|
+
|
18
|
+
|
19
|
+
Selectors: These are specified using JSON strings. The keys are 'tag' (the name of the consumer version tag), 'latest' (true|false), 'consumer', and 'fallbackTag'. For example '{\"tag\": \"master\", \"latest\": true}'. For a detailed explanation of selectors, see https://pact.io/selectors#consumer-version-selectors
|
@@ -3,12 +3,6 @@ require 'socket'
|
|
3
3
|
require 'pact/provider_verifier/app'
|
4
4
|
require 'pact/provider_verifier/cli/custom_thor'
|
5
5
|
|
6
|
-
# verify --consumer-version-selector '{ all: true, tag: "feat-x", fallback: "master" }' --consumer-version-tag master
|
7
|
-
|
8
|
-
#
|
9
|
-
# tags "master", { all: true, tag: "feat-x", fallback: "master" }
|
10
|
-
#
|
11
|
-
|
12
6
|
module Pact
|
13
7
|
module ProviderVerifier
|
14
8
|
module CLI
|
@@ -17,13 +11,8 @@ module Pact
|
|
17
11
|
class InvalidArgumentsError < ::Thor::Error; end
|
18
12
|
class AuthError < ::Thor::Error; end
|
19
13
|
|
20
|
-
SELECTOR_DOCS = "Selectors: These are specified using JSON strings. The keys are 'tag' (the name of the consumer version tag) and 'latest' (true|false). " +
|
21
|
-
"For example '{\"tag\": \"master\", \"latest\": true}'. For a detailed explanation of selectors, see https://pact.io/selectors"
|
22
|
-
|
23
14
|
desc 'PACT_URL ...', "Verify pact(s) against a provider. Supports local and networked (http-based) files."
|
24
|
-
long_desc
|
25
|
-
"To dynamically fetch pacts from a Pact Broker based on the provider name, specify the --pact-broker-base-url, --provider and relevant authentication fields." +
|
26
|
-
"\n\n" + SELECTOR_DOCS
|
15
|
+
long_desc File.read(File.join(File.dirname(__FILE__), 'long_desc.txt')).gsub("\n", "\x5")
|
27
16
|
method_option :provider_base_url, aliases: "-h", desc: "Provider host URL", :required => true
|
28
17
|
method_option :provider_states_setup_url, aliases: "-c", desc: "Base URL to setup the provider states at", :required => false
|
29
18
|
method_option :pact_broker_base_url, desc: "Base URL of the Pact Broker from which to retrieve the pacts. Can also be set using the environment variable PACT_BROKER_BASE_URL.", :required => false
|
@@ -37,12 +26,12 @@ module Pact
|
|
37
26
|
method_option :tag_with_git_branch, aliases: "-g", type: :boolean, default: false, required: false, desc: "Tag provider version with the name of the current git branch. Default: false"
|
38
27
|
method_option :provider_app_version, aliases: "-a", desc: "Provider application version, required when publishing verification results", :required => false
|
39
28
|
method_option :publish_verification_results, aliases: "-r", desc: "Publish verification results to the broker. This can also be enabled by setting the environment variable PACT_BROKER_PUBLISH_VERIFICATION_RESULTS=true", required: false, type: :boolean, default: false
|
40
|
-
method_option :enable_pending,
|
29
|
+
method_option :enable_pending, desc: "Allow pacts which are in pending state to be verified without causing the overall task to fail. For more information, see https://pact.io/pending", required: false, type: :boolean, default: false
|
41
30
|
method_option :include_wip_pacts_since, desc: "", hide: true
|
42
31
|
method_option :custom_provider_header, type: :array, banner: 'CUSTOM_PROVIDER_HEADER', desc: "Header to add to provider state set up and pact verification requests. eg 'Authorization: Basic cGFjdDpwYWN0'. May be specified multiple times.", :required => false
|
43
32
|
method_option :custom_middleware, type: :array, banner: 'FILE', desc: "Ruby file containing a class implementing Pact::ProviderVerifier::CustomMiddleware. This allows the response to be modified before replaying. Use with caution!", :required => false
|
44
33
|
method_option :monkeypatch, hide: true, type: :array, :required => false
|
45
|
-
method_option :verbose, aliases: "-v", desc: "Verbose output", :required => false
|
34
|
+
method_option :verbose, aliases: "-v", desc: "Verbose output. Can also be set by setting the environment variable VERBOSE=true.", :required => false
|
46
35
|
method_option :provider_states_url, aliases: "-s", :required => false, hide: true
|
47
36
|
method_option :format, banner: "FORMATTER", aliases: "-f", desc: "RSpec formatter. Defaults to custom Pact formatter. Other options are json and RspecJunitFormatter (which outputs xml)."
|
48
37
|
method_option :out, aliases: "-o", banner: "FILE", desc: "Write output to a file instead of $stdout."
|
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.32.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: 2020-
|
12
|
+
date: 2020-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -275,6 +275,20 @@ dependencies:
|
|
275
275
|
- - "~>"
|
276
276
|
- !ruby/object:Gem::Version
|
277
277
|
version: '0.5'
|
278
|
+
- !ruby/object:Gem::Dependency
|
279
|
+
name: word_wrap
|
280
|
+
requirement: !ruby/object:Gem::Requirement
|
281
|
+
requirements:
|
282
|
+
- - ">="
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
version: '0'
|
285
|
+
type: :development
|
286
|
+
prerelease: false
|
287
|
+
version_requirements: !ruby/object:Gem::Requirement
|
288
|
+
requirements:
|
289
|
+
- - ">="
|
290
|
+
- !ruby/object:Gem::Version
|
291
|
+
version: '0'
|
278
292
|
description: |-
|
279
293
|
A cross-platform Pact verification tool to validate API Providers.
|
280
294
|
Used in the pact-js-provider project to simplify development
|
@@ -296,6 +310,7 @@ files:
|
|
296
310
|
- lib/pact/provider_verifier/aggregate_pact_configs.rb
|
297
311
|
- lib/pact/provider_verifier/app.rb
|
298
312
|
- lib/pact/provider_verifier/cli/custom_thor.rb
|
313
|
+
- lib/pact/provider_verifier/cli/long_desc.txt
|
299
314
|
- lib/pact/provider_verifier/cli/verify.rb
|
300
315
|
- lib/pact/provider_verifier/custom_middleware.rb
|
301
316
|
- lib/pact/provider_verifier/error.rb
|
@@ -327,8 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
327
342
|
- !ruby/object:Gem::Version
|
328
343
|
version: '0'
|
329
344
|
requirements: []
|
330
|
-
|
331
|
-
rubygems_version: 2.7.7
|
345
|
+
rubygems_version: 3.1.4
|
332
346
|
signing_key:
|
333
347
|
specification_version: 4
|
334
348
|
summary: Provides a Pact verification service for use with Pact
|