pact 1.33.0 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -0
- data/lib/pact/cli/run_pact_verification.rb +2 -1
- data/lib/pact/cli.rb +1 -1
- data/lib/pact/hal/entity.rb +4 -1
- data/lib/pact/hal/http_client.rb +1 -0
- data/lib/pact/pact_broker/fetch_pacts.rb +1 -0
- data/lib/pact/pact_broker/{fetch_wip_pacts.rb → fetch_pending_pacts.rb} +7 -5
- data/lib/pact/pact_broker.rb +3 -3
- data/lib/pact/provider/configuration/pact_verification_from_broker.rb +1 -0
- data/lib/pact/provider/pact_spec_runner.rb +4 -3
- data/lib/pact/provider/rspec/formatter_rspec_3.rb +4 -4
- data/lib/pact/provider/rspec.rb +3 -3
- data/lib/pact/provider/test_methods.rb +2 -1
- data/lib/pact/tasks/task_helper.rb +1 -1
- data/lib/pact/tasks/verification_task.rb +3 -3
- data/lib/pact/version.rb +1 -1
- data/pact.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cb9f3147fb9ff1878469700cb000042058f043dd
|
|
4
|
+
data.tar.gz: 8c8058099ee03e3fc35081590c217ca5c02663c9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54fb5bad27bd4610b9b690d2cf4a332d78a10bcf25d1f6e10b66e5904e76389f61aeba6844fb526365e22f8419465b034984f6275544e5a392c7a016c1772525
|
|
7
|
+
data.tar.gz: 68885f0aabdc5707a6caf763b565eb41532c72a87d960a6179a17b133a48d67693f0f95fd85e20272770690e4a4b5280951efd68cce54dc9ce509a8fb7ee753b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
<a name="v1.34.0"></a>
|
|
2
|
+
### v1.34.0 (2018-09-06)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
#### Features
|
|
6
|
+
|
|
7
|
+
* **verify**
|
|
8
|
+
* add request customizer for pact-provider-verifier ([4ae0b58](/../../commit/4ae0b58))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
#### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add missing require for net/http ([fe2ebb1](/../../commit/fe2ebb1))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<a name="v1.33.2"></a>
|
|
17
|
+
### v1.33.2 (2018-09-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
#### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* add missing requires for pact/errors ([0e01451](/../../commit/0e01451))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<a name="v1.33.1"></a>
|
|
26
|
+
### v1.33.1 (2018-08-28)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
#### Features
|
|
30
|
+
|
|
31
|
+
* rename 'wip pacts' to 'pending pacts' ([6a46ebb](/../../commit/6a46ebb))
|
|
32
|
+
|
|
33
|
+
* **verify cli**
|
|
34
|
+
* rename --wip to --ignore-failures ([8e2dffd](/../../commit/8e2dffd))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
#### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* correct version for dependency on pact-mock_service ([01c0df7](/../../commit/01c0df7))
|
|
40
|
+
|
|
41
|
+
|
|
1
42
|
<a name="v1.33.0"></a>
|
|
2
43
|
### v1.33.0 (2018-08-07)
|
|
3
44
|
|
data/lib/pact/cli.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Pact
|
|
|
8
8
|
desc 'verify', "Verify a pact"
|
|
9
9
|
method_option :pact_helper, aliases: "-h", desc: "Pact helper file", :required => true
|
|
10
10
|
method_option :pact_uri, aliases: "-p", desc: "Pact URI"
|
|
11
|
-
method_option :
|
|
11
|
+
method_option :ignore_failures, type: :boolean, default: false, desc: "Process will always exit with exit code 0", hide: true
|
|
12
12
|
method_option :pact_broker_username, aliases: "-u", desc: "Pact broker user name"
|
|
13
13
|
method_option :pact_broker_password, aliases: "-w", desc: "Pact broker password"
|
|
14
14
|
method_option :backtrace, aliases: "-b", desc: "Show full backtrace", :default => false, :type => :boolean
|
data/lib/pact/hal/entity.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'uri'
|
|
2
2
|
require 'delegate'
|
|
3
3
|
require 'pact/hal/link'
|
|
4
|
+
require 'pact/errors'
|
|
4
5
|
|
|
5
6
|
module Pact
|
|
6
7
|
module Hal
|
|
@@ -36,9 +37,11 @@ module Pact
|
|
|
36
37
|
Link.new(@links[key].merge(method: http_method), @client).run(*args)
|
|
37
38
|
end
|
|
38
39
|
|
|
39
|
-
def _link(key)
|
|
40
|
+
def _link(key, fallback_key = nil)
|
|
40
41
|
if @links[key]
|
|
41
42
|
Link.new(@links[key], @client)
|
|
43
|
+
elsif fallback_key && @links[fallback_key]
|
|
44
|
+
Link.new(@links[fallback_key], @client)
|
|
42
45
|
else
|
|
43
46
|
nil
|
|
44
47
|
end
|
data/lib/pact/hal/http_client.rb
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
require 'pact/hal/entity'
|
|
2
2
|
require 'pact/hal/http_client'
|
|
3
3
|
require 'pact/provider/pact_uri'
|
|
4
|
+
require 'pact/errors'
|
|
4
5
|
|
|
5
6
|
module Pact
|
|
6
7
|
module PactBroker
|
|
7
|
-
class
|
|
8
|
+
class FetchPendingPacts
|
|
8
9
|
attr_reader :provider, :tags, :broker_base_url, :http_client_options, :http_client, :index_entity
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
PENDING_PROVIDER_RELATION = 'beta:pending-provider-pacts'.freeze
|
|
12
|
+
WIP_PROVIDER_RELATION = 'beta:wip-provider-pacts'.freeze # deprecated
|
|
11
13
|
PACTS = 'pacts'.freeze
|
|
12
14
|
PB_PACTS = 'pb:pacts'.freeze
|
|
13
15
|
HREF = 'href'.freeze
|
|
@@ -25,7 +27,7 @@ module Pact
|
|
|
25
27
|
|
|
26
28
|
def call
|
|
27
29
|
if index.success?
|
|
28
|
-
|
|
30
|
+
pending_pacts_for_provider
|
|
29
31
|
else
|
|
30
32
|
raise Pact::Error.new("Error retrieving #{broker_base_url} status=#{index_entity.response.code} #{index_entity.response.raw_body}")
|
|
31
33
|
end
|
|
@@ -37,8 +39,8 @@ module Pact
|
|
|
37
39
|
@index_entity ||= Pact::Hal::Link.new({ "href" => broker_base_url }, http_client).get
|
|
38
40
|
end
|
|
39
41
|
|
|
40
|
-
def
|
|
41
|
-
link = index_entity._link(WIP_PROVIDER_RELATION)
|
|
42
|
+
def pending_pacts_for_provider
|
|
43
|
+
link = index_entity._link(WIP_PROVIDER_RELATION, PENDING_PROVIDER_RELATION)
|
|
42
44
|
if link
|
|
43
45
|
get_pact_urls(link.expand(provider: provider).get)
|
|
44
46
|
else
|
data/lib/pact/pact_broker.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require 'pact/pact_broker/fetch_pacts'
|
|
2
|
-
require 'pact/pact_broker/
|
|
2
|
+
require 'pact/pact_broker/fetch_pending_pacts'
|
|
3
3
|
|
|
4
4
|
#
|
|
5
5
|
# @public Use by Pact Provider Verifier
|
|
@@ -12,8 +12,8 @@ module Pact
|
|
|
12
12
|
Pact::PactBroker::FetchPacts.call(*args).collect(&:uri)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def
|
|
16
|
-
Pact::PactBroker::
|
|
15
|
+
def fetch_pending_pact_uris *args
|
|
16
|
+
Pact::PactBroker::FetchPendingPacts.call(*args).collect(&:uri)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -91,7 +91,7 @@ module Pact
|
|
|
91
91
|
::RSpec::Core::CommandLine.new(NoConfigurationOptions.new)
|
|
92
92
|
.run(::RSpec.configuration.output_stream, ::RSpec.configuration.error_stream)
|
|
93
93
|
end
|
|
94
|
-
options[:
|
|
94
|
+
options[:ignore_failures] ? 0 : exit_code
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def rspec_runner_options
|
|
@@ -120,7 +120,8 @@ module Pact
|
|
|
120
120
|
pact_sources.each do | pact_source |
|
|
121
121
|
options = {
|
|
122
122
|
criteria: @options[:criteria],
|
|
123
|
-
|
|
123
|
+
ignore_failures: @options[:ignore_failures],
|
|
124
|
+
request_customizer: @options[:request_customizer]
|
|
124
125
|
}
|
|
125
126
|
honour_pactfile pact_source.uri, ordered_pact_json(pact_source.pact_json), options
|
|
126
127
|
end
|
|
@@ -147,7 +148,7 @@ module Pact
|
|
|
147
148
|
|
|
148
149
|
::RSpec.configuration.full_backtrace = @options[:full_backtrace]
|
|
149
150
|
|
|
150
|
-
::RSpec.configuration.failure_color = :yellow if @options[:
|
|
151
|
+
::RSpec.configuration.failure_color = :yellow if @options[:ignore_failures]
|
|
151
152
|
end
|
|
152
153
|
|
|
153
154
|
def ordered_pact_json(pact_json)
|
|
@@ -42,12 +42,12 @@ module Pact
|
|
|
42
42
|
summary.failed_examples.collect{ |e| e.metadata[:pact_interaction_example_description] }.uniq.size
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def
|
|
46
|
-
summary.failed_examples.any?{ |e| e.metadata[:
|
|
45
|
+
def ignore_failures?(summary)
|
|
46
|
+
summary.failed_examples.any?{ |e| e.metadata[:pact_ignore_failures] }
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def failure_title summary
|
|
50
|
-
if
|
|
50
|
+
if ignore_failures?(summary)
|
|
51
51
|
"#{failed_interactions_count(summary)} pending"
|
|
52
52
|
else
|
|
53
53
|
::RSpec::Core::Formatters::Helpers.pluralize(failed_interactions_count(summary), "failure")
|
|
@@ -69,7 +69,7 @@ module Pact
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def print_rerun_commands summary
|
|
72
|
-
if
|
|
72
|
+
if ignore_failures?(summary)
|
|
73
73
|
output.puts("\nPending interactions: (Failures listed here are expected and do not affect your suite's status)\n\n")
|
|
74
74
|
else
|
|
75
75
|
output.puts("\nFailed interactions:\n\n")
|
data/lib/pact/provider/rspec.rb
CHANGED
|
@@ -21,7 +21,7 @@ module Pact
|
|
|
21
21
|
include ::RSpec::Core::DSL
|
|
22
22
|
|
|
23
23
|
def honour_pactfile pact_uri, pact_json, options
|
|
24
|
-
pact_description = options[:
|
|
24
|
+
pact_description = options[:ignore_failures] ? "Pending pact" : "pact"
|
|
25
25
|
Pact.configuration.output_stream.puts "INFO: Reading #{pact_description} at #{pact_uri}"
|
|
26
26
|
Pact.configuration.output_stream.puts "INFO: Filtering interactions by: #{options[:criteria]}" if options[:criteria] && options[:criteria].any?
|
|
27
27
|
consumer_contract = Pact::ConsumerContract.from_json(pact_json)
|
|
@@ -74,7 +74,7 @@ module Pact
|
|
|
74
74
|
pact_interaction: interaction,
|
|
75
75
|
pact_interaction_example_description: interaction_description_for_rerun_command(interaction),
|
|
76
76
|
pact_uri: options[:pact_uri],
|
|
77
|
-
|
|
77
|
+
pact_ignore_failures: options[:ignore_failures]
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
describe description_for(interaction), metadata do
|
|
@@ -85,7 +85,7 @@ module Pact
|
|
|
85
85
|
interaction_context.run_once :before do
|
|
86
86
|
Pact.configuration.logger.info "Running example '#{Pact::RSpec.full_description(example)}'"
|
|
87
87
|
set_up_provider_state interaction.provider_state, options[:consumer]
|
|
88
|
-
replay_interaction interaction
|
|
88
|
+
replay_interaction interaction, options[:request_customizer]
|
|
89
89
|
interaction_context.last_response = last_response
|
|
90
90
|
end
|
|
91
91
|
end
|
|
@@ -14,8 +14,9 @@ module Pact
|
|
|
14
14
|
include Pact::Logging
|
|
15
15
|
include Rack::Test::Methods
|
|
16
16
|
|
|
17
|
-
def replay_interaction interaction
|
|
17
|
+
def replay_interaction interaction, request_customizer = nil
|
|
18
18
|
request = Request::Replayable.new(interaction.request)
|
|
19
|
+
request = request_customizer.call(request, interaction) if request_customizer
|
|
19
20
|
args = [request.path, request.body, request.headers]
|
|
20
21
|
|
|
21
22
|
logger.info "Sending #{request.method.upcase} request to path: \"#{request.path}\" with headers: #{request.headers}, see debug logs for body"
|
|
@@ -28,7 +28,7 @@ module Pact
|
|
|
28
28
|
command_parts << "-S pact verify"
|
|
29
29
|
command_parts << "--pact-helper" << Shellwords.escape(pact_helper.end_with?(".rb") ? pact_helper : pact_helper + ".rb")
|
|
30
30
|
(command_parts << "--pact-uri" << pact_uri) if pact_uri
|
|
31
|
-
command_parts << "--
|
|
31
|
+
command_parts << "--ignore-failures" if verification_opts[:ignore_failures]
|
|
32
32
|
command_parts << "--pact-broker-username" << ENV['PACT_BROKER_USERNAME'] if ENV['PACT_BROKER_USERNAME']
|
|
33
33
|
command_parts << "--pact-broker-password" << ENV['PACT_BROKER_PASSWORD'] if ENV['PACT_BROKER_PASSWORD']
|
|
34
34
|
command_parts << "--backtrace" if ENV['BACKTRACE'] == 'true'
|
|
@@ -30,11 +30,11 @@ module Pact
|
|
|
30
30
|
|
|
31
31
|
attr_reader :pact_spec_configs
|
|
32
32
|
attr_accessor :rspec_opts
|
|
33
|
-
attr_accessor :
|
|
33
|
+
attr_accessor :ignore_failures
|
|
34
34
|
|
|
35
35
|
def initialize(name)
|
|
36
36
|
@rspec_opts = nil
|
|
37
|
-
@
|
|
37
|
+
@ignore_failures = false
|
|
38
38
|
@pact_spec_configs = []
|
|
39
39
|
@name = name
|
|
40
40
|
yield self
|
|
@@ -76,7 +76,7 @@ module Pact
|
|
|
76
76
|
require 'pact/tasks/task_helper'
|
|
77
77
|
|
|
78
78
|
exit_statuses = pact_spec_configs.collect do | config |
|
|
79
|
-
Pact::TaskHelper.execute_pact_verify config[:uri], config[:pact_helper], rspec_opts, {
|
|
79
|
+
Pact::TaskHelper.execute_pact_verify config[:uri], config[:pact_helper], rspec_opts, { ignore_failures: ignore_failures }
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
Pact::TaskHelper.handle_verification_failure do
|
data/lib/pact/version.rb
CHANGED
data/pact.gemspec
CHANGED
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |gem|
|
|
|
29
29
|
gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
|
|
30
30
|
|
|
31
31
|
gem.add_runtime_dependency 'pact-support', '~> 1.7'
|
|
32
|
-
gem.add_runtime_dependency 'pact-mock_service', '~> 2.10
|
|
32
|
+
gem.add_runtime_dependency 'pact-mock_service', '~> 2.10'
|
|
33
33
|
|
|
34
34
|
gem.add_development_dependency 'rake', '~> 10.0.3'
|
|
35
35
|
gem.add_development_dependency 'webmock', '~> 3.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.
|
|
4
|
+
version: 1.34.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: 2018-
|
|
15
|
+
date: 2018-09-06 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: randexp
|
|
@@ -138,14 +138,14 @@ dependencies:
|
|
|
138
138
|
requirements:
|
|
139
139
|
- - "~>"
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
|
-
version: 2.10
|
|
141
|
+
version: '2.10'
|
|
142
142
|
type: :runtime
|
|
143
143
|
prerelease: false
|
|
144
144
|
version_requirements: !ruby/object:Gem::Requirement
|
|
145
145
|
requirements:
|
|
146
146
|
- - "~>"
|
|
147
147
|
- !ruby/object:Gem::Version
|
|
148
|
-
version: 2.10
|
|
148
|
+
version: '2.10'
|
|
149
149
|
- !ruby/object:Gem::Dependency
|
|
150
150
|
name: rake
|
|
151
151
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -323,7 +323,7 @@ files:
|
|
|
323
323
|
- lib/pact/hal/link.rb
|
|
324
324
|
- lib/pact/pact_broker.rb
|
|
325
325
|
- lib/pact/pact_broker/fetch_pacts.rb
|
|
326
|
-
- lib/pact/pact_broker/
|
|
326
|
+
- lib/pact/pact_broker/fetch_pending_pacts.rb
|
|
327
327
|
- lib/pact/project_root.rb
|
|
328
328
|
- lib/pact/provider.rb
|
|
329
329
|
- lib/pact/provider/configuration.rb
|