pact 1.63.0 → 1.65.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: 3bbef2d45df174d528bf23ecd3c5b380196789c842d49b32dd7c49478aca0942
4
- data.tar.gz: ef0bdd2ea78d03ab7db7eec95c5b5e293495ce5aab33d614daca1ffe4215229b
3
+ metadata.gz: 24b61e9c910570243bd6054ebc23bf968f5bd20a308ab887184d0860c2b2018d
4
+ data.tar.gz: 62ba67e2a1ff00b591da39accfe05010d2836f5aa386df0129aa9df786b89156
5
5
  SHA512:
6
- metadata.gz: 30e6ab38f2b4475474af538a149ba504462a36438f9b2cd2a4ccf148c2081ee92c973b3bb0d61d07edf19389869e631b6bc7011d4a758b54f752baa341eec715
7
- data.tar.gz: abc1767938dcc4e417b3d76798c742f7e4bccbd850cd19cd3034d9ad9e28502c063c5b3272ac75cfd98c008dd5e3786e7a8708fb3f8b3332bb933c6a6b8c1acb
6
+ metadata.gz: b473ff4c78e3310449e8cae9a78bc379c36d20c6b646d3d587d83652598e32cae6f12ec50ad84623a1349655bbb841f7dc79aa8c0784dc79b53306f006ddc990
7
+ data.tar.gz: 91464395e4565d96df5025b998caa1e42a9ba71d9a72bfa0220dad95745bf3cc7d911f22171a1957d01a40a06c7042b9d53d49f75206ef757457227db5931260
data/CHANGELOG.md CHANGED
@@ -1,3 +1,44 @@
1
+ <a name="v1.65.0"></a>
2
+ ### v1.65.0 (2024-08-06)
3
+
4
+ #### Features
5
+
6
+ * support app_version_branch in MessageProviderDSL ([1653128](/../../commit/1653128))
7
+ * allow setting fail_if_no_pacts_found in honours_pacts_from_pact_broker ([f0f142e](/../../commit/f0f142e))
8
+
9
+ #### Bug Fixes
10
+
11
+ * handle case in no_pacts_found - undefined method empty? for nil ([0145d2d](/../../commit/0145d2d))
12
+ * remove unused ConsumerContractBuilder contract_details accessor ([fb5488e](/../../commit/fb5488e))
13
+ * example/animal-service/Gemfile to reduce vulnerabilities ([2bbefe2](/../../commit/2bbefe2))
14
+ * example/zoo-app/Gemfile to reduce vulnerabilities ([e10f914](/../../commit/e10f914))
15
+ * example/animal-service/Gemfile to reduce vulnerabilities ([7560918](/../../commit/7560918))
16
+ * example/zoo-app/Gemfile to reduce vulnerabilities ([b4cbe85](/../../commit/b4cbe85))
17
+ * example/animal-service/Gemfile to reduce vulnerabilities ([4028087](/../../commit/4028087))
18
+ * ConsumerContractBuilder exposing incorrect field ([c805c3e](/../../commit/c805c3e))
19
+
20
+ * **test**
21
+ * alias Rack/Rackup WEBrick handler in x509 test for backwards compat ([cc77498](/../../commit/cc77498))
22
+
23
+ <a name="v1.64.0"></a>
24
+ ### v1.64.0 (2023-11-09)
25
+
26
+ #### Features
27
+
28
+ * support x509 certs in HTTP Client (#298) ([3ed5680](/../../commit/3ed5680))
29
+
30
+ * **CI**
31
+ * use setup-ruby's bundle installer and cache (#275) ([f5621b6](/../../commit/f5621b6))
32
+
33
+ #### Bug Fixes
34
+
35
+ * assert provider retrieved successfully before using link ([0af0691](/../../commit/0af0691))
36
+ * update call to Rack::Builder.parse_file for rack 3 ([652047c](/../../commit/652047c))
37
+ * example/zoo-app/Gemfile to reduce vulnerabilities ([b4ca8cb](/../../commit/b4ca8cb))
38
+ * example/animal-service/Gemfile to reduce vulnerabilities ([7ad2073](/../../commit/7ad2073))
39
+ * example/zoo-app/Gemfile to reduce vulnerabilities ([dd417fd](/../../commit/dd417fd))
40
+ * example/animal-service/Gemfile to reduce vulnerabilities (#281) ([4ea07cd](/../../commit/4ea07cd))
41
+
1
42
  <a name="v1.63.0"></a>
2
43
  ### v1.63.0 (2022-09-28)
3
44
 
@@ -72,7 +72,6 @@ module Pact
72
72
 
73
73
  def run_with_configured_pacts_from_pact_helper
74
74
  pact_urls = Pact.provider_world.pact_urls
75
- raise "Please configure a pact to verify" if pact_urls.empty?
76
75
  Pact::Provider::PactSpecRunner.new(pact_urls, pact_spec_options).run
77
76
  end
78
77
 
@@ -11,7 +11,7 @@ module Pact
11
11
 
12
12
  include Pact::Logging
13
13
 
14
- attr_reader :consumer_contract, :mock_service_base_url
14
+ attr_reader :mock_service_base_url
15
15
 
16
16
  def initialize(attributes)
17
17
  @interaction_builder = nil
@@ -23,6 +23,10 @@ module Pact
23
23
  _link(key).get(*args)
24
24
  end
25
25
 
26
+ def get!(key, *args)
27
+ _link(key).get!(*args)
28
+ end
29
+
26
30
  def post(key, *args)
27
31
  _link(key).post(*args)
28
32
  end
@@ -53,6 +53,12 @@ module Pact
53
53
  http.use_ssl = (uri.scheme == 'https')
54
54
  http.ca_file = ENV['SSL_CERT_FILE'] if ENV['SSL_CERT_FILE'] && ENV['SSL_CERT_FILE'] != ''
55
55
  http.ca_path = ENV['SSL_CERT_DIR'] if ENV['SSL_CERT_DIR'] && ENV['SSL_CERT_DIR'] != ''
56
+
57
+ if x509_certificate?
58
+ http.cert = OpenSSL::X509::Certificate.new(x509_client_cert_file)
59
+ http.key = OpenSSL::PKey::RSA.new(x509_client_key_file)
60
+ end
61
+
56
62
  if disable_ssl_verification?
57
63
  if verbose?
58
64
  Pact.configuration.output_stream.puts("SSL verification is disabled")
@@ -74,6 +80,19 @@ module Pact
74
80
  verbose || ENV['VERBOSE'] == 'true'
75
81
  end
76
82
 
83
+ def x509_certificate?
84
+ ENV['X509_CLIENT_CERT_FILE'] && ENV['X509_CLIENT_CERT_FILE'] != '' &&
85
+ ENV['X509_CLIENT_KEY_FILE'] && ENV['X509_CLIENT_KEY_FILE'] != ''
86
+ end
87
+
88
+ def x509_client_cert_file
89
+ File.read(ENV['X509_CLIENT_CERT_FILE'])
90
+ end
91
+
92
+ def x509_client_key_file
93
+ File.read(ENV['X509_CLIENT_KEY_FILE'])
94
+ end
95
+
77
96
  def disable_ssl_verification?
78
97
  ENV['PACT_DISABLE_SSL_VERIFICATION'] == 'true' || ENV['PACT_BROKER_DISABLE_SSL_VERIFICATION'] == 'true'
79
98
  end
@@ -39,15 +39,17 @@ module Pact
39
39
  end
40
40
 
41
41
  def call
42
- if index.can?(PACTS_FOR_VERIFICATION_RELATION) || index.can?(PACTS_FOR_VERIFICATION_RELATION_BETA)
43
- log_message
44
- pacts_for_verification
45
- else
46
- old_selectors = consumer_version_selectors.collect do | selector |
47
- { name: selector[:tag], all: !selector[:latest], fallback: selector[:fallbackTag]}
42
+ handling_no_pacts_found do
43
+ if index.can?(PACTS_FOR_VERIFICATION_RELATION) || index.can?(PACTS_FOR_VERIFICATION_RELATION_BETA)
44
+ log_message
45
+ pacts_for_verification
46
+ else
47
+ old_selectors = consumer_version_selectors.collect do | selector |
48
+ { name: selector[:tag], all: !selector[:latest], fallback: selector[:fallbackTag]}
49
+ end
50
+ # Fall back to old method of fetching pacts
51
+ FetchPacts.call(provider, old_selectors, broker_base_url, http_client_options)
48
52
  end
49
- # Fall back to old method of fetching pacts
50
- FetchPacts.call(provider, old_selectors, broker_base_url, http_client_options)
51
53
  end
52
54
  end
53
55
 
@@ -96,6 +98,15 @@ module Pact
96
98
  def log_message
97
99
  Pact.configuration.output_stream.puts "INFO: #{pact_selection_description(provider, consumer_version_selectors, options, broker_base_url)}"
98
100
  end
101
+
102
+ def handling_no_pacts_found
103
+ pacts_found = yield
104
+ raise "No pacts found to verify" if pacts_found.blank? && options[:fail_if_no_pacts_found] != false
105
+ if pacts_found.blank? && options[:fail_if_no_pacts_found] == false
106
+ Pact.configuration.output_stream.puts "WARN: No pacts found to verify & fail_if_no_pacts_found is set to false."
107
+ end
108
+ pacts_found
109
+ end
99
110
  end
100
111
  end
101
112
  end
@@ -34,6 +34,10 @@ module Pact
34
34
  self.tags = tags
35
35
  end
36
36
 
37
+ def app_version_branch branch
38
+ self.branch = branch
39
+ end
40
+
37
41
  def publish_verification_results publish_verification_results
38
42
  self.publish_verification_results = publish_verification_results
39
43
  Pact::RSpec.with_rspec_2 do
@@ -15,7 +15,7 @@ module Pact
15
15
  # in parent scope, it will clash with these ones,
16
16
  # so put an underscore in front of the name to be safer.
17
17
 
18
- attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_branch, :_provider_version_tags, :_basic_auth_options, :_enable_pending, :_include_wip_pacts_since, :_verbose, :_consumer_version_selectors
18
+ attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_branch, :_provider_version_tags, :_basic_auth_options, :_enable_pending, :_include_wip_pacts_since, :_verbose, :_consumer_version_selectors, :_fail_if_no_pacts_found
19
19
 
20
20
  def initialize(provider_name, provider_version_branch, provider_version_tags)
21
21
  @_provider_name = provider_name
@@ -26,6 +26,7 @@ module Pact
26
26
  @_enable_pending = false
27
27
  @_include_wip_pacts_since = nil
28
28
  @_verbose = false
29
+ @_fail_if_no_pacts_found = true # CLI defaults to false, unfortunately for consistency
29
30
  end
30
31
 
31
32
  dsl do
@@ -46,6 +47,11 @@ module Pact
46
47
  self._enable_pending = enable_pending
47
48
  end
48
49
 
50
+ # Underlying code defaults to true if not specified
51
+ def fail_if_no_pacts_found fail_if_no_pacts_found
52
+ self._fail_if_no_pacts_found = fail_if_no_pacts_found
53
+ end
54
+
49
55
  def include_wip_pacts_since since
50
56
  self._include_wip_pacts_since = if since.respond_to?(:xmlschema)
51
57
  since.xmlschema
@@ -74,7 +80,7 @@ module Pact
74
80
  _provider_version_tags,
75
81
  _pact_broker_base_url,
76
82
  _basic_auth_options.merge(verbose: _verbose),
77
- { include_pending_status: _enable_pending, include_wip_pacts_since: _include_wip_pacts_since }
83
+ { include_pending_status: _enable_pending, include_wip_pacts_since: _include_wip_pacts_since, fail_if_no_pacts_found: _fail_if_no_pacts_found }
78
84
  )
79
85
 
80
86
  Pact.provider_world.add_pact_uri_source fetch_pacts
@@ -21,7 +21,13 @@ module Pact
21
21
  unless File.exist? Pact.configuration.config_ru_path
22
22
  raise "Could not find config.ru file at #{Pact.configuration.config_ru_path} Please configure the service provider app or create a config.ru file in the root directory of the project. See https://github.com/pact-foundation/pact-ruby/wiki/Verifying-pacts for more information."
23
23
  end
24
- Rack::Builder.parse_file(Pact.configuration.config_ru_path).first
24
+ result = Rack::Builder.parse_file(Pact.configuration.config_ru_path)
25
+
26
+ if result.respond_to?(:first) # rack 2
27
+ result.first
28
+ else # rack 3
29
+ result
30
+ end
25
31
  }
26
32
 
27
33
  def initialize name
@@ -135,7 +135,7 @@ module Pact
135
135
  end
136
136
 
137
137
  def provider_entity
138
- @provider_entity ||= pact_entity.get(PROVIDER_RELATION)
138
+ @provider_entity ||= pact_entity.get!(PROVIDER_RELATION)
139
139
  end
140
140
  end
141
141
  end
data/lib/pact/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Remember to bump pact-provider-proxy when this changes major version
2
2
  module Pact
3
- VERSION = "1.63.0"
3
+ VERSION = "1.65.0"
4
4
  end
data/pact.gemspec CHANGED
@@ -29,16 +29,16 @@ Gem::Specification.new do |gem|
29
29
  gem.add_runtime_dependency 'rspec', '~> 3.0'
30
30
  gem.add_runtime_dependency 'rack-test', '>= 0.6.3', '< 3.0.0'
31
31
  gem.add_runtime_dependency 'thor', '>= 0.20', '< 2.0'
32
- gem.add_runtime_dependency 'webrick', '~> 1.3'
33
- gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
32
+ gem.add_runtime_dependency 'webrick', '~> 1.8'
33
+ gem.add_runtime_dependency 'term-ansicolor', '~> 1.7'
34
34
 
35
35
  gem.add_runtime_dependency 'pact-support', '~> 1.16', '>= 1.16.9'
36
36
  gem.add_runtime_dependency 'pact-mock_service', '~> 3.0', '>= 3.3.1'
37
37
 
38
38
  gem.add_development_dependency 'rake', '~> 13.0'
39
39
  gem.add_development_dependency 'webmock', '~> 3.0'
40
- gem.add_development_dependency 'fakefs', '0.5' # 0.6.0 blows up
41
- gem.add_development_dependency 'hashie', '~> 2.0'
40
+ gem.add_development_dependency 'fakefs', '2.4' # 0.6.0 blows up
41
+ gem.add_development_dependency 'hashie', '~> 5.0'
42
42
  gem.add_development_dependency 'faraday', '~>1.0', '<3.0'
43
43
  gem.add_development_dependency 'faraday-multipart', '~> 1.0'
44
44
  gem.add_development_dependency 'conventional-changelog', '~> 1.3'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.63.0
4
+ version: 1.65.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fraser
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2022-09-29 00:00:00.000000000 Z
15
+ date: 2024-08-07 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -74,28 +74,28 @@ dependencies:
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '1.3'
77
+ version: '1.8'
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: '1.3'
84
+ version: '1.8'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: term-ansicolor
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '1.0'
91
+ version: '1.7'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: '1.0'
98
+ version: '1.7'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: pact-support
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -170,28 +170,28 @@ dependencies:
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: '0.5'
173
+ version: '2.4'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: '0.5'
180
+ version: '2.4'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: hashie
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '2.0'
187
+ version: '5.0'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '2.0'
194
+ version: '5.0'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: faraday
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -419,7 +419,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
419
419
  - !ruby/object:Gem::Version
420
420
  version: '0'
421
421
  requirements: []
422
- rubygems_version: 3.3.22
422
+ rubygems_version: 3.5.17
423
423
  signing_key:
424
424
  specification_version: 4
425
425
  summary: Enables consumer driven contract testing, providing a mock service and DSL