pact 1.50.1 → 1.54.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: 5b098430ba170a2290f1ae9c18b8d94ea7c2e968f5e8f3bd48c4e34155b4ea0d
4
- data.tar.gz: 3b5f51717c2ba8934df7bf0fdbe9d68c74096e0058eeeae4f75804becd8366f3
3
+ metadata.gz: 668b177b7d244716ded4b592c37be8788ce6d0e1fd4036becdf5025a73e40022
4
+ data.tar.gz: 3185c5eeca1d02878e916b1feb6eddc4888a139374548987fc295d90b38d67c6
5
5
  SHA512:
6
- metadata.gz: '0049d4e11c748ebf653da1a754168d82198c73975cd30d16a67a4bcd837490740a30271b16a012612d19100b0a1c7139b5945e5f29686930407436a0acb47584'
7
- data.tar.gz: 8e2e895e155d37650d5d677f062c9a4d391132beae3884144978cd41438bfa4c979caa33fc2a2623013b23cdd1c67e403d5506b84ed32def9c22be5e5a97f568
6
+ metadata.gz: 217392c245364ea7df2e75851d211760a57cb5ec19285d8a5f7cd1f770ff85211115d4137d8b60a2c6c7b75ccb7a2fceb85c17ba00f4ef727f452f11e09e2d67
7
+ data.tar.gz: 111d4ddd772e5367485f716c19d9a8e64f8ce3e3045c273b48535dade001913bb6af2e552f6cc9f7e767b0f14d9111f62d7f114dd7b5318cdfcaade3a1ecab0f
@@ -1,3 +1,43 @@
1
+ <a name="v1.54.0"></a>
2
+ ### v1.54.0 (2020-09-12)
3
+
4
+ #### Features
5
+
6
+ * use pb relation in preference to beta relation when fetching pacts for verification ([7563fcf](/../../commit/7563fcf))
7
+ * allow include_wip_pacts_since to use a Date, DateTime or Time ([dd35366](/../../commit/dd35366))
8
+ * add support for include_wip_pacts_since ([f2247b8](/../../commit/f2247b8))
9
+
10
+ <a name="v1.53.0"></a>
11
+ ### v1.53.0 (2020-09-11)
12
+
13
+ #### Features
14
+
15
+ * add support for the enable_pending flag ([16866f4](/../../commit/16866f4))
16
+
17
+ <a name="v1.52.0"></a>
18
+ ### v1.52.0 (2020-09-10)
19
+
20
+ #### Features
21
+
22
+ * support webdav http methods ([fa1d712](/../../commit/fa1d712))
23
+
24
+ <a name="v1.51.1"></a>
25
+ ### v1.51.1 (2020-08-12)
26
+
27
+ #### Bug Fixes
28
+
29
+ * update thor dependency (#218) ([bf3ce69](/../../commit/bf3ce69))
30
+ * bump rake dependency per CVE-2020-8130 (#219) ([09feaa6](/../../commit/09feaa6))
31
+
32
+ <a name="v1.51.0"></a>
33
+ ### v1.51.0 (2020-06-24)
34
+
35
+
36
+ #### Features
37
+
38
+ * allow individual interactions to be re-run by setting PACT_BROKER_INTERACTION_ID ([a586d80](/../../commit/a586d80))
39
+
40
+
1
41
  <a name="v1.50.1"></a>
2
42
  ### v1.50.1 (2020-06-15)
3
43
 
@@ -4,6 +4,9 @@ require 'pact/provider/configuration'
4
4
 
5
5
  module Pact
6
6
  class CLI < Thor
7
+ def self.exit_on_failure? # Thor 1.0 deprecation guard
8
+ false
9
+ end
7
10
 
8
11
  desc 'verify', "Verify a pact"
9
12
  method_option :pact_helper, aliases: "-h", desc: "Pact helper file", :required => true
@@ -18,6 +21,8 @@ module Pact
18
21
  default: Pact.configuration.interactions_replay_order
19
22
  method_option :description, aliases: "-d", desc: "Interaction description filter"
20
23
  method_option :provider_state, aliases: "-s", desc: "Provider state filter"
24
+ method_option :interaction_index, type: :numeric, desc: "Index filter"
25
+ method_option :pact_broker_interaction_id, desc: "Pact Broker interaction ID filter"
21
26
  method_option :format, aliases: "-f", banner: "FORMATTER", desc: "RSpec formatter. Defaults to custom Pact formatter. [j]son may also be used."
22
27
  method_option :out, aliases: "-o", banner: "FILE", desc: "Write output to a file instead of $stdout."
23
28
 
@@ -6,8 +6,11 @@ module Pact
6
6
  criteria = {}
7
7
 
8
8
  criteria[:description] = Regexp.new(options[:description]) if options[:description]
9
+ criteria[:_id] = options[:pact_broker_interaction_id] if options[:pact_broker_interaction_id]
10
+ criteria[:index] = options[:interaction_index] if options[:interaction_index]
9
11
 
10
12
  provider_state = options[:provider_state]
13
+
11
14
  if provider_state
12
15
  if provider_state.length == 0
13
16
  criteria[:provider_state] = nil #Allow PACT_PROVIDER_STATE="" to mean no provider state
@@ -12,7 +12,8 @@ module Pact
12
12
  include PactSelectionDescription
13
13
  attr_reader :provider, :consumer_version_selectors, :provider_version_tags, :broker_base_url, :http_client_options, :http_client, :options
14
14
 
15
- PACTS_FOR_VERIFICATION_RELATION = 'beta:provider-pacts-for-verification'.freeze
15
+ PACTS_FOR_VERIFICATION_RELATION = 'pb:provider-pacts-for-verification'.freeze
16
+ PACTS_FOR_VERIFICATION_RELATION_BETA = 'beta:provider-pacts-for-verification'.freeze
16
17
  PACTS = 'pacts'.freeze
17
18
  HREF = 'href'.freeze
18
19
  LINKS = '_links'.freeze
@@ -22,7 +23,7 @@ module Pact
22
23
  def initialize(provider, consumer_version_selectors, provider_version_tags, broker_base_url, http_client_options, options = {})
23
24
  @provider = provider
24
25
  @consumer_version_selectors = consumer_version_selectors || []
25
- @provider_version_tags = provider_version_tags || []
26
+ @provider_version_tags = [*provider_version_tags]
26
27
  @http_client_options = http_client_options
27
28
  @broker_base_url = broker_base_url
28
29
  @http_client = Pact::Hal::HttpClient.new(http_client_options)
@@ -34,7 +35,7 @@ module Pact
34
35
  end
35
36
 
36
37
  def call
37
- if index.can?(PACTS_FOR_VERIFICATION_RELATION)
38
+ if index.can?(PACTS_FOR_VERIFICATION_RELATION) || index.can?(PACTS_FOR_VERIFICATION_RELATION_BETA)
38
39
  log_message
39
40
  pacts_for_verification
40
41
  else
@@ -63,7 +64,7 @@ module Pact
63
64
 
64
65
  def pacts_for_verification_entity
65
66
  index
66
- ._link(PACTS_FOR_VERIFICATION_RELATION)
67
+ ._link(PACTS_FOR_VERIFICATION_RELATION, PACTS_FOR_VERIFICATION_RELATION_BETA)
67
68
  .expand(provider: provider)
68
69
  .post!(query)
69
70
  end
@@ -14,12 +14,14 @@ module Pact
14
14
  # in parent scope, it will clash with these ones,
15
15
  # so put an underscore in front of the name to be safer.
16
16
 
17
- attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_tags, :_basic_auth_options, :_verbose
17
+ attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_tags, :_basic_auth_options, :_enable_pending, :_include_wip_pacts_since, :_verbose
18
18
 
19
19
  def initialize(provider_name, provider_version_tags)
20
20
  @_provider_name = provider_name
21
21
  @_provider_version_tags = provider_version_tags
22
22
  @_consumer_version_tags = []
23
+ @_enable_pending = false
24
+ @_include_wip_pacts_since = nil
23
25
  @_verbose = false
24
26
  end
25
27
 
@@ -33,6 +35,18 @@ module Pact
33
35
  self._consumer_version_tags = *consumer_version_tags
34
36
  end
35
37
 
38
+ def enable_pending enable_pending
39
+ self._enable_pending = enable_pending
40
+ end
41
+
42
+ def include_wip_pacts_since since
43
+ self._include_wip_pacts_since = if since.respond_to?(:xmlschema)
44
+ since.xmlschema
45
+ else
46
+ since
47
+ end
48
+ end
49
+
36
50
  def verbose verbose
37
51
  self._verbose = verbose
38
52
  end
@@ -51,7 +65,8 @@ module Pact
51
65
  consumer_version_selectors,
52
66
  _provider_version_tags,
53
67
  _pact_broker_base_url,
54
- _basic_auth_options.merge(verbose: _verbose)
68
+ _basic_auth_options.merge(verbose: _verbose),
69
+ { include_pending_status: _enable_pending, include_wip_pacts_since: _include_wip_pacts_since }
55
70
  )
56
71
 
57
72
  Pact.provider_world.add_pact_uri_source fetch_pacts
@@ -93,17 +93,32 @@ module Pact
93
93
 
94
94
  def interaction_rerun_command_for example
95
95
  example_description = example.metadata[:pact_interaction_example_description]
96
- if ENV['PACT_INTERACTION_RERUN_COMMAND']
96
+
97
+ _id = example.metadata[:pact_interaction]._id
98
+ index = example.metadata[:pact_interaction].index
99
+ provider_state = example.metadata[:pact_interaction].provider_state
100
+ description = example.metadata[:pact_interaction].description
101
+ pactfile_uri = example.metadata[:pactfile_uri]
102
+
103
+ if _id && ENV['PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER']
104
+ cmd = String.new(ENV['PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER'])
105
+ cmd.gsub!("<PACT_URI>", example.metadata[:pactfile_uri].to_s)
106
+ cmd.gsub!("<PACT_BROKER_INTERACTION_ID>", "#{_id}")
107
+ colorizer.wrap("#{cmd} ", ::RSpec.configuration.failure_color) + colorizer.wrap("# #{example_description}", ::RSpec.configuration.detail_color)
108
+ elsif ENV['PACT_INTERACTION_RERUN_COMMAND']
97
109
  cmd = String.new(ENV['PACT_INTERACTION_RERUN_COMMAND'])
98
- provider_state = example.metadata[:pact_interaction].provider_state
99
- description = example.metadata[:pact_interaction].description
100
- pactfile_uri = example.metadata[:pactfile_uri]
101
110
  cmd.gsub!("<PACT_URI>", pactfile_uri.to_s)
102
111
  cmd.gsub!("<PACT_DESCRIPTION>", description)
103
112
  cmd.gsub!("<PACT_PROVIDER_STATE>", "#{provider_state}")
113
+ cmd.gsub!("<PACT_INTERACTION_INDEX>", "#{index}")
104
114
  colorizer.wrap("#{cmd} ", ::RSpec.configuration.failure_color) + colorizer.wrap("# #{example_description}", ::RSpec.configuration.detail_color)
105
115
  else
106
- colorizer.wrap("* #{example_description}", ::RSpec.configuration.failure_color)
116
+ message = if _id
117
+ "* #{example_description} (to re-run just this interaction, set environment variable PACT_BROKER_INTERACTION_ID=\"#{_id}\")"
118
+ else
119
+ "* #{example_description} (to re-run just this interaction, set environment variables PACT_DESCRIPTION=\"#{description}\" PACT_PROVIDER_STATE=\"#{provider_state}\")"
120
+ end
121
+ colorizer.wrap(message, ::RSpec.configuration.failure_color)
107
122
  end
108
123
  end
109
124
 
@@ -21,7 +21,11 @@ module Pact
21
21
 
22
22
  logger.info "Sending #{request.method.upcase} request to path: \"#{request.path}\" with headers: #{request.headers}, see debug logs for body"
23
23
  logger.debug "body :#{request.body}"
24
- response = self.send(request.method.downcase, *args)
24
+ response = if self.respond_to?(:custom_request)
25
+ self.custom_request(request.method.upcase, *args)
26
+ else
27
+ self.send(request.method.downcase, *args)
28
+ end
25
29
  logger.info "Received response with status: #{response.status}, headers: #{response.headers}, see debug logs for body"
26
30
  logger.debug "body: #{response.body}"
27
31
  end
@@ -7,6 +7,7 @@ module Pact
7
7
  module TaskHelper
8
8
 
9
9
  PACT_INTERACTION_RERUN_COMMAND = "bundle exec rake pact:verify:at[<PACT_URI>] PACT_DESCRIPTION=\"<PACT_DESCRIPTION>\" PACT_PROVIDER_STATE=\"<PACT_PROVIDER_STATE>\""
10
+ PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER = "bundle exec rake pact:verify:at[<PACT_URI>] PACT_BROKER_INTERACTION_ID=\"<PACT_BROKER_INTERACTION_ID>\""
10
11
 
11
12
  extend self
12
13
 
@@ -34,6 +35,8 @@ module Pact
34
35
  command_parts << "--backtrace" if ENV['BACKTRACE'] == 'true'
35
36
  command_parts << "--description #{Shellwords.escape(ENV['PACT_DESCRIPTION'])}" if ENV['PACT_DESCRIPTION']
36
37
  command_parts << "--provider-state #{Shellwords.escape(ENV['PACT_PROVIDER_STATE'])}" if ENV['PACT_PROVIDER_STATE']
38
+ command_parts << "--pact-broker-interaction-id #{Shellwords.escape(ENV['PACT_BROKER_INTERACTION_ID'])}" if ENV['PACT_BROKER_INTERACTION_ID']
39
+ command_parts << "--interaction-index #{Shellwords.escape(ENV['PACT_INTERACTION_INDEX'])}" if ENV['PACT_INTERACTION_INDEX']
37
40
  command_parts.flatten.join(" ")
38
41
  end
39
42
 
@@ -41,7 +44,9 @@ module Pact
41
44
  Pact.configuration.output_stream.puts command
42
45
  temporarily_set_env_var 'PACT_EXECUTING_LANGUAGE', 'ruby' do
43
46
  temporarily_set_env_var 'PACT_INTERACTION_RERUN_COMMAND', PACT_INTERACTION_RERUN_COMMAND do
44
- exit_status = system(command) ? 0 : 1
47
+ temporarily_set_env_var 'PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER', PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER do
48
+ exit_status = system(command) ? 0 : 1
49
+ end
45
50
  end
46
51
  end
47
52
  end
@@ -1,4 +1,4 @@
1
1
  # Remember to bump pact-provider-proxy when this changes major version
2
2
  module Pact
3
- VERSION = "1.50.1"
3
+ VERSION = "1.54.0"
4
4
  end
@@ -28,14 +28,14 @@ Gem::Specification.new do |gem|
28
28
 
29
29
  gem.add_runtime_dependency 'rspec', '~> 3.0'
30
30
  gem.add_runtime_dependency 'rack-test', '>= 0.6.3', '< 2.0.0'
31
- gem.add_runtime_dependency 'thor', '~> 0.20'
31
+ gem.add_runtime_dependency 'thor', '>= 0.20', '< 2.0'
32
32
  gem.add_runtime_dependency 'webrick', '~> 1.3'
33
33
  gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
34
34
 
35
35
  gem.add_runtime_dependency 'pact-support', '~> 1.9'
36
36
  gem.add_runtime_dependency 'pact-mock_service', '~> 3.0', '>= 3.3.1'
37
37
 
38
- gem.add_development_dependency 'rake', '~> 10.0'
38
+ gem.add_development_dependency 'rake', '~> 13.0'
39
39
  gem.add_development_dependency 'webmock', '~> 3.0'
40
40
  gem.add_development_dependency 'fakefs', '0.5' # 0.6.0 blows up
41
41
  gem.add_development_dependency 'hashie', '~> 2.0'
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.50.1
4
+ version: 1.54.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: 2020-06-15 00:00:00.000000000 Z
15
+ date: 2020-09-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -52,16 +52,22 @@ dependencies:
52
52
  name: thor
53
53
  requirement: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - "~>"
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0.20'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.0'
58
61
  type: :runtime
59
62
  prerelease: false
60
63
  version_requirements: !ruby/object:Gem::Requirement
61
64
  requirements:
62
- - - "~>"
65
+ - - ">="
63
66
  - !ruby/object:Gem::Version
64
67
  version: '0.20'
68
+ - - "<"
69
+ - !ruby/object:Gem::Version
70
+ version: '2.0'
65
71
  - !ruby/object:Gem::Dependency
66
72
  name: webrick
67
73
  requirement: !ruby/object:Gem::Requirement
@@ -130,14 +136,14 @@ dependencies:
130
136
  requirements:
131
137
  - - "~>"
132
138
  - !ruby/object:Gem::Version
133
- version: '10.0'
139
+ version: '13.0'
134
140
  type: :development
135
141
  prerelease: false
136
142
  version_requirements: !ruby/object:Gem::Requirement
137
143
  requirements:
138
144
  - - "~>"
139
145
  - !ruby/object:Gem::Version
140
- version: '10.0'
146
+ version: '13.0'
141
147
  - !ruby/object:Gem::Dependency
142
148
  name: webmock
143
149
  requirement: !ruby/object:Gem::Requirement
@@ -397,8 +403,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
397
403
  - !ruby/object:Gem::Version
398
404
  version: '0'
399
405
  requirements: []
400
- rubyforge_project:
401
- rubygems_version: 2.7.7
406
+ rubygems_version: 3.1.4
402
407
  signing_key:
403
408
  specification_version: 4
404
409
  summary: Enables consumer driven contract testing, providing a mock service and DSL