pact-provider-verifier 1.23.1 → 1.25.0

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: '03408a7ed4910873c671ce4e5e5d387f16b014d18b1da629bb6e05baa22054f5'
4
- data.tar.gz: 66d4f1151cbe96a55dbf3082ce054dc15611f32b372e8ac7ee9e21ba0b826ff8
3
+ metadata.gz: 7252d509ae2e2498fcd92b205a3cd814098d2218d7654e27adcf3b272fe725d2
4
+ data.tar.gz: 2061bb5cf8beb5da796b27b8eefc912956b98fc04b865754cfbe95579c06644e
5
5
  SHA512:
6
- metadata.gz: 8393d9310408c3fb12bbba5cb2937df92a2ceac3fe7469c1788a5b114c051a030e7f2fdb39aa348a70bcb7801306d14802b688589fe7abb8bfda6c7493c45ccb
7
- data.tar.gz: 8f6970ac162703fd9c39ebb259ef9a81e5d72102ab6e33bbd788831ec31e49f39c99a5aac59d3e0f2ade63235c30f2a94385c194550153aeb13cc2b031fcf2aa
6
+ metadata.gz: 65a2bc4f8335736f99d0c251b3610dad8140033e8c0759f606d44f81442d68fd245b1676d5aa4c112099a58bd86bf9ec2955140a4882778915be601b51b386c1
7
+ data.tar.gz: 613a162a2bc0563abcc86cf7e0452d0c48a1c778a2f4e4a6b1110eb360d288312a1c5a63e39a50bb284b8d467adeb2dd87e4af2264c738915f98c64cd19d36a1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ <a name="v1.25.0-1"></a>
2
+ ### v1.25.0-1 (2019-11-09)
3
+
4
+ #### Features
5
+
6
+ * **gems**
7
+ * update pact gem to 1.42.2 ([a8452bd](/../../commit/a8452bd))
8
+ * update pact gem to 1.42.1 ([44cdd4e](/../../commit/44cdd4e))
9
+
10
+
11
+ <a name="v1.24.0-1"></a>
12
+ ### v1.24.0-1 (2019-09-26)
13
+
14
+
15
+ #### Features
16
+
17
+ * update pact version dependency to 1.42.0 ([828deff](/../../commit/828deff))
18
+ * use new 'pacts for verification' endpoint when PACT_BROKER_PACTS_FOR_VERIFICATION_ENABLED is set to 'true' ([6e6f45b](/../../commit/6e6f45b))
19
+ * allow --provider-version-tag to be specified, which will be applied to the provider version when the verification results are published ([bf4bc93](/../../commit/bf4bc93))
20
+
21
+
1
22
  <a name="v1.23.1-1"></a>
2
23
  ### v1.23.1-1 (2019-05-22)
3
24
 
data/README.md CHANGED
@@ -17,7 +17,7 @@ binary-like CLI tool.
17
17
 
18
18
  ### Docker
19
19
 
20
- Take a look at https://github.com/DiUS/pact-provider-verifier-docker.
20
+ Take a look at https://github.com/DiUS/pact-provider-verifier-docker or https://github.com/pact-foundation/pact-ruby-cli
21
21
 
22
22
  ### Native Installation
23
23
 
@@ -40,24 +40,24 @@ Usage:
40
40
  pact-provider-verifier PACT_URL ... -h, --provider-base-url=PROVIDER_BASE_URL
41
41
 
42
42
  Options:
43
- -h, --provider-base-url=PROVIDER_BASE_URL # Provider host URL
44
- -c, [--provider-states-setup-url=PROVIDER_STATES_SETUP_URL] # Base URL to setup the provider states at
45
- [--pact-broker-base-url=PACT_BROKER_BASE_URL] # Base URL of the Pact Broker from which to retrieve the pacts.
46
- -n, [--broker-username=BROKER_USERNAME] # Pact Broker basic auth username
47
- -p, [--broker-password=BROKER_PASSWORD] # Pact Broker basic auth password
48
- -k, [--broker-token=BROKER_TOKEN] # Pact Broker bearer token
43
+ -h, --provider-base-url=PROVIDER_BASE_URL # Provider host URL
44
+ -c, [--provider-states-setup-url=PROVIDER_STATES_SETUP_URL] # Base URL to setup the provider states at
45
+ [--pact-broker-base-url=PACT_BROKER_BASE_URL] # Base URL of the Pact Broker from which to retrieve the pacts.
46
+ -n, [--broker-username=BROKER_USERNAME] # Pact Broker basic auth username
47
+ -p, [--broker-password=BROKER_PASSWORD] # Pact Broker basic auth password
48
+ -k, [--broker-token=BROKER_TOKEN] # Pact Broker bearer token
49
49
  [--provider=PROVIDER]
50
- [--consumer-version-tag=TAG] # Retrieve the latest pacts with this consumer version tag. Used in conjunction with --provider. May be specified multiple times.
51
- -a, [--provider-app-version=PROVIDER_APP_VERSION] # Provider application version, required when publishing verification results
52
- -r, [--publish-verification-results=PUBLISH_VERIFICATION_RESULTS] # Publish verification results to the broker
53
- [--custom-provider-header=CUSTOM_PROVIDER_HEADER] # Header to add to provider state set up and pact verification requests. eg 'Authorization: Basic cGFjdDpwYWN0'. May be specified multiple times.
54
- [--custom-middleware=FILE] # Ruby file containing a class implementing Pact::ProviderVerifier::CustomMiddleware. This allows the response to be modified before replaying. Use with caution!
55
- -v, [--verbose=VERBOSE] # Verbose output
56
- -f, [--format=FORMATTER] # RSpec formatter. Defaults to custom Pact formatter. Other options are json and RspecJunitFormatter (which outputs xml).
57
- -o, [--out=FILE] # Write output to a file instead of $stdout.
58
- [--wait=SECONDS] # The number of seconds to poll for the provider to become available before running the verification
59
- # Default: 0
60
- Verify pact(s) against a provider. Supports local and networked (http-based) files.
50
+ [--consumer-version-tag=TAG] # Retrieve the latest pacts with this consumer version tag. Used in conjunction with --provider. May be specified multiple times.
51
+ [--provider-version-tag=TAG] # Tag to apply to the provider application version. May be specified multiple times.
52
+ -a, [--provider-app-version=PROVIDER_APP_VERSION] # Provider application version, required when publishing verification results
53
+ -r, [--publish-verification-results], [--no-publish-verification-results] # Publish verification results to the broker
54
+ [--custom-provider-header=CUSTOM_PROVIDER_HEADER] # Header to add to provider state set up and pact verification requests. eg 'Authorization: Basic cGFjdDpwYWN0'. May be specified multiple times.
55
+ [--custom-middleware=FILE] # Ruby file containing a class implementing Pact::ProviderVerifier::CustomMiddleware. This allows the response to be modified before replaying. Use with caution!
56
+ -v, [--verbose=VERBOSE] # Verbose output
57
+ -f, [--format=FORMATTER] # RSpec formatter. Defaults to custom Pact formatter. Other options are json and RspecJunitFormatter (which outputs xml).
58
+ -o, [--out=FILE] # Write output to a file instead of $stdout.
59
+ [--wait=SECONDS] # The number of seconds to poll for the provider to become available before running the verification
60
+ # Default: 0
61
61
  ```
62
62
 
63
63
  ## Examples
@@ -1,53 +1,50 @@
1
1
  require 'pact/pact_broker'
2
2
  require 'ostruct'
3
+ require 'pact/provider/pact_uri'
3
4
 
4
5
  module Pact
5
6
  module ProviderVerifier
6
7
  class AggregatePactConfigs
7
8
 
8
- def self.call(pact_urls, provider_name, consumer_version_tags, pact_broker_base_url, http_client_options)
9
- new(pact_urls, provider_name, consumer_version_tags, pact_broker_base_url, http_client_options).call
9
+ def self.call(pact_urls, provider_name, consumer_version_tags, provider_version_tags, pact_broker_base_url, http_client_options)
10
+ new(pact_urls, provider_name, consumer_version_tags, provider_version_tags, pact_broker_base_url, http_client_options).call
10
11
  end
11
12
 
12
- def initialize(pact_urls, provider_name, consumer_version_tags, pact_broker_base_url, http_client_options)
13
+ def initialize(pact_urls, provider_name, consumer_version_tags, provider_version_tags, pact_broker_base_url, http_client_options)
13
14
  @pact_urls = pact_urls
14
15
  @provider_name = provider_name
15
16
  @consumer_version_tags = consumer_version_tags
17
+ @provider_version_tags = provider_version_tags
16
18
  @pact_broker_base_url = pact_broker_base_url
17
19
  @http_client_options = http_client_options
18
20
  end
19
21
 
20
22
  def call
21
- pacts_urls_from_broker + pact_urls.collect{ |uri| OpenStruct.new(uri: uri) }
23
+ pacts_urls_from_broker + specified_pact_uris
22
24
  end
23
25
 
24
26
  private
25
27
 
26
- attr_reader :pact_urls, :provider_name, :consumer_version_tags, :pact_broker_base_url, :http_client_options
28
+ attr_reader :pact_urls, :provider_name, :consumer_version_tags, :provider_version_tags, :pact_broker_base_url, :http_client_options
29
+
30
+ def specified_pact_uris
31
+ pact_urls.collect{ | url | Pact::PactBroker.build_pact_uri(url) }
32
+ end
27
33
 
28
34
  def pacts_urls_from_broker
29
35
  if pact_broker_base_url && provider_name
30
- net_pending_pact_uris.collect{ | uri| OpenStruct.new(uri: uri, pending: true) } +
31
- non_pending_pact_uris.collect{ | uri| OpenStruct.new(uri: uri) }
36
+ pacts_for_verification
32
37
  else
33
38
  []
34
39
  end
35
40
  end
36
41
 
37
- def non_pending_pact_uris
38
- @non_pending_pact_uris ||= Pact::PactBroker.fetch_pact_uris(provider_name, consumer_version_tags, pact_broker_base_url, http_client_options)
39
- end
40
-
41
- def pending_pact_uris
42
- @pending_pact_uris ||= Pact::PactBroker.fetch_pending_pact_uris(provider_name, pact_broker_base_url, http_client_options)
42
+ def pacts_for_verification
43
+ @pacts_for_verification ||= Pact::PactBroker.fetch_pact_uris_for_verification(provider_name, consumer_version_selectors, provider_version_tags, pact_broker_base_url, http_client_options)
43
44
  end
44
45
 
45
- def net_pending_pact_uris
46
- if ENV['PACT_INCLUDE_PENDING'] == 'true'
47
- pending_pact_uris - non_pending_pact_uris
48
- else
49
- []
50
- end
46
+ def consumer_version_selectors
47
+ consumer_version_tags.collect{ |tag| { tag: tag, latest: true } }
51
48
  end
52
49
  end
53
50
  end
@@ -17,11 +17,13 @@ module Pact
17
17
  include Pact::WaitUntilServerAvailable
18
18
 
19
19
  PROXY_PACT_HELPER = File.expand_path(File.join(File.dirname(__FILE__), "pact_helper.rb"))
20
+ attr_reader :pact_urls, :options, :consumer_version_tags, :provider_version_tags
20
21
 
21
22
  def initialize pact_urls, options = {}
22
23
  @pact_urls = pact_urls
23
24
  @options = options
24
25
  @consumer_version_tags = options[:consumer_version_tag] || []
26
+ @provider_version_tags = options[:provider_version_tag] || []
25
27
  end
26
28
 
27
29
  def self.call pact_urls, options
@@ -33,8 +35,8 @@ module Pact
33
35
 
34
36
  pact_urls = all_pact_urls
35
37
  wait_until_provider_available
36
- exit_statuses = pact_urls.collect do |pact_url|
37
- verify_pact pact_url
38
+ exit_statuses = pact_urls.collect do |pact_uri|
39
+ verify_pact pact_uri
38
40
  end
39
41
 
40
42
  exit_statuses.all?{ | status | status == 0 }
@@ -42,7 +44,6 @@ module Pact
42
44
 
43
45
  private
44
46
 
45
- attr_reader :pact_urls, :options, :consumer_version_tags
46
47
 
47
48
  def setup
48
49
  print_deprecation_note
@@ -66,19 +67,22 @@ module Pact
66
67
  application = configure_custom_middleware(application)
67
68
  application = configure_custom_header_middleware(application)
68
69
 
69
- provider_application_version = options.provider_app_version
70
- publish_results = options.publish_verification_results
70
+ this = self
71
71
 
72
72
  Pact.service_provider "Running Provider Application" do
73
73
  app do
74
74
  application
75
75
  end
76
76
 
77
- if provider_application_version
78
- app_version provider_application_version
77
+ if this.options.provider_app_version
78
+ app_version this.options.provider_app_version
79
79
  end
80
80
 
81
- publish_verification_results publish_results
81
+ if this.provider_version_tags.any?
82
+ app_version_tags this.provider_version_tags
83
+ end
84
+
85
+ publish_verification_results this.options.publish_verification_results
82
86
  end
83
87
  end
84
88
 
@@ -134,18 +138,17 @@ module Pact
134
138
  end
135
139
  end
136
140
 
137
- def verify_pact(config)
141
+ def verify_pact(pact_uri)
138
142
  begin
139
143
  verify_options = {
140
144
  pact_helper: PROXY_PACT_HELPER,
141
- pact_uri: config.uri,
145
+ pact_uri: pact_uri,
142
146
  backtrace: ENV['BACKTRACE'] == 'true',
143
147
  pact_broker_username: options.broker_username,
144
148
  pact_broker_password: options.broker_password,
145
149
  pact_broker_token: options.broker_token,
146
150
  format: options.format,
147
151
  out: options.out,
148
- ignore_failures: config.pending,
149
152
  request_customizer: ProviderStates::AddProviderStatesHeader
150
153
  }
151
154
  verify_options[:description] = ENV['PACT_DESCRIPTION'] if ENV['PACT_DESCRIPTION']
@@ -171,7 +174,7 @@ module Pact
171
174
 
172
175
  def all_pact_urls
173
176
  http_client_options = { username: options.broker_username, password: options.broker_password, token: options.broker_token, verbose: options.verbose }
174
- AggregatePactConfigs.call(pact_urls, options.provider, consumer_version_tags, options.pact_broker_base_url, http_client_options)
177
+ AggregatePactConfigs.call(pact_urls, options.provider, consumer_version_tags, provider_version_tags, options.pact_broker_base_url, http_client_options)
175
178
  end
176
179
 
177
180
  def require_pact_project_pact_helper
@@ -19,8 +19,9 @@ module Pact
19
19
  method_option :broker_token, aliases: "-k", desc: "Pact Broker bearer token", :required => false
20
20
  method_option :provider, required: false
21
21
  method_option :consumer_version_tag, type: :array, banner: "TAG", desc: "Retrieve the latest pacts with this consumer version tag. Used in conjunction with --provider. May be specified multiple times.", :required => false
22
+ method_option :provider_version_tag, type: :array, banner: "TAG", desc: "Tag to apply to the provider application version. May be specified multiple times.", :required => false
22
23
  method_option :provider_app_version, aliases: "-a", desc: "Provider application version, required when publishing verification results", :required => false
23
- method_option :publish_verification_results, aliases: "-r", desc: "Publish verification results to the broker", required: false
24
+ method_option :publish_verification_results, aliases: "-r", desc: "Publish verification results to the broker", required: false, type: :boolean, default: false
24
25
  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
25
26
  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
26
27
  method_option :monkeypatch, hide: true, type: :array, :required => false
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module ProviderVerifier
3
- VERSION = "1.23.1"
3
+ VERSION = "1.25.0"
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.23.1
4
+ version: 1.25.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: 2019-05-22 00:00:00.000000000 Z
12
+ date: 2019-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -31,14 +31,20 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.36'
34
+ version: '1.42'
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 1.42.2
35
38
  type: :runtime
36
39
  prerelease: false
37
40
  version_requirements: !ruby/object:Gem::Requirement
38
41
  requirements:
39
42
  - - "~>"
40
43
  - !ruby/object:Gem::Version
41
- version: '1.36'
44
+ version: '1.42'
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.42.2
42
48
  - !ruby/object:Gem::Dependency
43
49
  name: pact-message
44
50
  requirement: !ruby/object:Gem::Requirement
@@ -57,22 +63,22 @@ 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.0
63
66
  - - "~>"
64
67
  - !ruby/object:Gem::Version
65
68
  version: '0.9'
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 0.9.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.0
73
76
  - - "~>"
74
77
  - !ruby/object:Gem::Version
75
78
  version: '0.9'
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 0.9.0
76
82
  - !ruby/object:Gem::Dependency
77
83
  name: faraday_middleware
78
84
  requirement: !ruby/object:Gem::Requirement
@@ -325,7 +331,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
331
  - !ruby/object:Gem::Version
326
332
  version: '0'
327
333
  requirements: []
328
- rubygems_version: 3.0.3
334
+ rubyforge_project:
335
+ rubygems_version: 2.7.7
329
336
  signing_key:
330
337
  specification_version: 4
331
338
  summary: Provides a Pact verification service for use with Pact