pact-provider-verifier 1.3.1 → 1.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3800ba2fc1e875cccbd3a7af6df46277ebbdce3
|
4
|
+
data.tar.gz: 0f3a59cb071ac1ac7cc0b816beac91ba5e9b5246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 444afd60eb2015055a7b9a2bda7065cecd10e0d7e77c5fdf5c5c2491c86b3e355dfcc8f82b528ff3da7c5c558e07ee0b5bff241e80f4e8b8fbdddfa4ca2c9dd9
|
7
|
+
data.tar.gz: 211233f1740a0336814a32ad215836b2c08984c9271c86dd7dd48ae92eeaa2883035c853bced8590966505b77e5914118d4e1c2c92d3c9fd9ccfeaa2dab3b4d9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
<a name="v1.4.0-1"></a>
|
2
|
+
### v1.4.0-1 (2017-08-11)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* **run single interaction**
|
7
|
+
* allow env vars to be set to run a single interaction ([3e39517](/../../commit/3e39517))
|
8
|
+
|
9
|
+
#### Bug Fixes
|
10
|
+
|
11
|
+
* Turn off SSL verification for provider states setup call. ([744add2](/../../commit/744add2))
|
12
|
+
|
1
13
|
<a name="v1.3.1"></a>
|
2
14
|
### v1.3.1 (2017-08-08)
|
3
15
|
|
@@ -1,53 +1,57 @@
|
|
1
|
-
require 'pact/
|
2
|
-
require 'pact/provider/proxy'
|
1
|
+
require 'pact/provider_verifier/add_header_middlware'
|
3
2
|
require 'pact/provider/rspec'
|
4
|
-
require 'rack/reverse_proxy'
|
5
3
|
require 'pact/cli/run_pact_verification'
|
6
|
-
require '
|
4
|
+
require 'rack/reverse_proxy'
|
7
5
|
require 'faraday_middleware'
|
8
6
|
require 'json'
|
9
|
-
require 'pact/provider_verifier/add_header_middlware'
|
10
7
|
|
11
8
|
module Pact
|
12
9
|
module ProviderVerifier
|
13
10
|
|
14
|
-
def self.new *args
|
15
|
-
App.new(*args)
|
16
|
-
end
|
17
|
-
|
18
11
|
class App
|
12
|
+
|
13
|
+
PROXY_PACT_HELPER = File.expand_path(File.join(File.dirname(__FILE__), "pact_helper.rb"))
|
14
|
+
|
19
15
|
def initialize options = {}
|
20
16
|
@options = options
|
21
17
|
end
|
22
18
|
|
23
|
-
def call
|
24
|
-
|
19
|
+
def self.call options
|
20
|
+
new(options).call
|
25
21
|
end
|
26
22
|
|
27
|
-
def
|
28
|
-
|
23
|
+
def call
|
24
|
+
setup
|
25
|
+
|
26
|
+
exit_statuses = pact_urls.collect do |pact_url|
|
27
|
+
verify_pact pact_url
|
28
|
+
end
|
29
|
+
|
30
|
+
# Return non-zero exit code if failures - increment for each Pact
|
31
|
+
exit exit_statuses.count{ | status | status != 0 }
|
29
32
|
end
|
30
33
|
|
31
|
-
def
|
34
|
+
def setup
|
32
35
|
print_deprecation_note
|
33
|
-
|
34
|
-
|
36
|
+
set_environment_variables
|
37
|
+
configure_service_provider
|
38
|
+
require_pact_project_pact_helper # Beth: not sure if this is needed, hangover from pact-provider-proxy?
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_environment_variables
|
35
42
|
ENV['PROVIDER_STATES_SETUP_URL'] = @options.provider_states_setup_url
|
36
43
|
ENV['VERBOSE_LOGGING'] = @options.verbose if @options.verbose
|
37
44
|
ENV['CUSTOM_PROVIDER_HEADER'] = @options.custom_provider_header if @options.custom_provider_header
|
38
|
-
|
45
|
+
end
|
46
|
+
|
47
|
+
def configure_service_provider
|
48
|
+
# Have to declare these locally as the class scope gets lost within the block
|
49
|
+
rack_reverse_proxy = configure_reverse_proxy
|
50
|
+
rack_reverse_proxy = configure_custom_header_middlware(rack_reverse_proxy)
|
39
51
|
|
40
52
|
provider_application_version = @options.provider_app_version
|
41
53
|
publish_results = @options.publish_verification_results
|
42
54
|
|
43
|
-
rack_reverse_proxy = Rack::ReverseProxy.new do
|
44
|
-
reverse_proxy '/', provider_base_url
|
45
|
-
end
|
46
|
-
|
47
|
-
if @options.custom_provider_header
|
48
|
-
rack_reverse_proxy = Pact::ProviderVerifier::AddHeaderMiddlware.new(rack_reverse_proxy, parse_header)
|
49
|
-
end
|
50
|
-
|
51
55
|
Pact.service_provider "Running Provider Application" do
|
52
56
|
app do
|
53
57
|
rack_reverse_proxy
|
@@ -59,27 +63,49 @@ module Pact
|
|
59
63
|
|
60
64
|
publish_verification_results publish_results
|
61
65
|
end
|
66
|
+
end
|
62
67
|
|
63
|
-
|
68
|
+
def configure_reverse_proxy
|
69
|
+
provider_base_url = @options.provider_base_url
|
70
|
+
Rack::ReverseProxy.new do
|
71
|
+
reverse_proxy_options verify_mode: OpenSSL::SSL::VERIFY_NONE
|
72
|
+
reverse_proxy '/', provider_base_url
|
73
|
+
end
|
74
|
+
end
|
64
75
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
:backtrace => false,
|
71
|
-
:pact_broker_username => @options.broker_username,
|
72
|
-
:pact_broker_password => @options.broker_password
|
73
|
-
}
|
74
|
-
Cli::RunPactVerification.call(options)
|
75
|
-
rescue SystemExit => e
|
76
|
-
puts ""
|
77
|
-
e.status
|
78
|
-
end
|
76
|
+
def configure_custom_header_middlware rack_reverse_proxy
|
77
|
+
if @options.custom_provider_header
|
78
|
+
Pact::ProviderVerifier::AddHeaderMiddlware.new(rack_reverse_proxy, parse_header)
|
79
|
+
else
|
80
|
+
rack_reverse_proxy
|
79
81
|
end
|
82
|
+
end
|
80
83
|
|
81
|
-
|
82
|
-
|
84
|
+
def pact_urls
|
85
|
+
@options.pact_urls.split(',')
|
86
|
+
end
|
87
|
+
|
88
|
+
def verify_pact pact_url
|
89
|
+
begin
|
90
|
+
options = {
|
91
|
+
:pact_helper => PROXY_PACT_HELPER,
|
92
|
+
:pact_uri => pact_url,
|
93
|
+
:backtrace => false,
|
94
|
+
:pact_broker_username => @options.broker_username,
|
95
|
+
:pact_broker_password => @options.broker_password
|
96
|
+
}
|
97
|
+
options[:description] = ENV['PACT_DESCRIPTION'] if ENV['PACT_DESCRIPTION']
|
98
|
+
options[:provider_state] = ENV['PACT_PROVIDER_STATE'] if ENV['PACT_PROVIDER_STATE']
|
99
|
+
|
100
|
+
Cli::RunPactVerification.call(options)
|
101
|
+
rescue SystemExit => e
|
102
|
+
puts ""
|
103
|
+
e.status
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def require_pact_project_pact_helper
|
108
|
+
require ENV['PACT_PROJECT_PACT_HELPER'] if ENV.fetch('PACT_PROJECT_PACT_HELPER','') != ''
|
83
109
|
end
|
84
110
|
|
85
111
|
def parse_header
|
@@ -18,8 +18,7 @@ module Pact
|
|
18
18
|
method_option :provider_states_url, aliases: "-s", desc: "DEPRECATED", :required => false
|
19
19
|
|
20
20
|
def verify
|
21
|
-
|
22
|
-
app.verify_pacts
|
21
|
+
Pact::ProviderVerifier::App.call(options)
|
23
22
|
end
|
24
23
|
|
25
24
|
default_task :verify
|
@@ -34,7 +34,13 @@ module Pact
|
|
34
34
|
|
35
35
|
def post_to_provider_state
|
36
36
|
verbose = verbose?
|
37
|
-
|
37
|
+
options = {url: provider_states_setup_url}
|
38
|
+
|
39
|
+
if provider_states_setup_url.start_with?("https:")
|
40
|
+
options[:ssl] = {verify: false}
|
41
|
+
end
|
42
|
+
|
43
|
+
connection = Faraday.new(options) do | faraday |
|
38
44
|
# Have encountered flakiness on windows build for pact-go
|
39
45
|
# Using retries as a hacky solution to try and get around this
|
40
46
|
# until/if we can work out what the underlying cause is.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Fellows
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.13'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: pact-provider-proxy
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '2.1'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '2.1'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: faraday
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +120,20 @@ dependencies:
|
|
134
120
|
- - ">="
|
135
121
|
- !ruby/object:Gem::Version
|
136
122
|
version: 10.4.2
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: rack-reverse-proxy
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
type: :runtime
|
131
|
+
prerelease: false
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: sinatra
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,6 +204,20 @@ dependencies:
|
|
204
204
|
- - "~>"
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: '1.2'
|
207
|
+
- !ruby/object:Gem::Dependency
|
208
|
+
name: pry-byebug
|
209
|
+
requirement: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - ">="
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '0'
|
207
221
|
description: |-
|
208
222
|
A cross-platform Pact verification tool to validate API Providers.
|
209
223
|
Used in the pact-js-provider project to simplify development
|