pact-mock_service 3.6.1 → 3.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -0
- data/README.md +1 -1
- data/lib/pact/consumer/mock_service/rack_request_helper.rb +3 -1
- data/lib/pact/consumer/server.rb +1 -1
- data/lib/pact/mock_service/cli.rb +20 -6
- data/lib/pact/mock_service/cli/custom_thor.rb +3 -0
- data/lib/pact/mock_service/cli/pidfile.rb +3 -1
- data/lib/pact/mock_service/interactions/verification.rb +4 -0
- data/lib/pact/mock_service/request_handlers/interaction_replay.rb +1 -1
- data/lib/pact/mock_service/request_handlers/verification_get.rb +1 -1
- data/lib/pact/mock_service/version.rb +1 -1
- metadata +23 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27e87ccc6396fefe1efbf08fdec3565431f999d0baece2f465f3c60c93af5887
|
4
|
+
data.tar.gz: c6b4c99af70294e44082cec35e1b94e7626cf2a90f491804294120bcde2c6ae6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84a2589c7758219995e685dcb817b839540a502b38364795a81579245dc3b9f3baf3517e06705580c29a714493be009618c5c7ab2d356b389db0d20d46061f84
|
7
|
+
data.tar.gz: 2c0261cd92e97aadda278032f0098912f9d088e835dac58912fa96ad028613c01d1f423378d5b9cbde7c6d20b772e70ab93a997c5b5b7203974248f97f734d0e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,39 @@
|
|
1
|
+
<a name="v3.9.1"></a>
|
2
|
+
### v3.9.1 (2021-06-03)
|
3
|
+
|
4
|
+
#### Bug Fixes
|
5
|
+
|
6
|
+
* check for nil body rather than falsey body when determining how to render mocked response Fixes: https://github.com/pact-foundation/pact-mock_service/issues/99 ([d26e520](/../../commit/d26e520))
|
7
|
+
|
8
|
+
<a name="v3.9.0"></a>
|
9
|
+
### v3.9.0 (2021-05-17)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* pass host into WEBrick options to allow configuration (#128) ([ec234a4](/../../commit/ec234a4))
|
14
|
+
|
15
|
+
<a name="v3.8.0"></a>
|
16
|
+
### v3.8.0 (2021-02-25)
|
17
|
+
|
18
|
+
#### Features
|
19
|
+
|
20
|
+
* include interaction diffs in verification response ([6306693](/../../commit/6306693))
|
21
|
+
|
22
|
+
<a name="v3.7.0"></a>
|
23
|
+
### v3.7.0 (2020-11-13)
|
24
|
+
|
25
|
+
#### Features
|
26
|
+
|
27
|
+
* use Pact::Query.parse_string to parse query string ([6cd0733](/../../commit/6cd0733))
|
28
|
+
* do not require files until command is executing ([ad54d0b](/../../commit/ad54d0b))
|
29
|
+
|
30
|
+
<a name="v3.6.2"></a>
|
31
|
+
### v3.6.2 (2020-08-10)
|
32
|
+
|
33
|
+
#### Bug Fixes
|
34
|
+
|
35
|
+
* update thor dependency (#124) ([54b3f85](/../../commit/54b3f85))
|
36
|
+
|
1
37
|
<a name="v3.6.1"></a>
|
2
38
|
### v3.6.1 (2020-04-22)
|
3
39
|
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
# Pact Mock and Stub Service
|
3
3
|
|
4
|
-
[![Build Status](https://travis-ci.
|
4
|
+
[![Build Status](https://travis-ci.com/pact-foundation/pact-mock_service.svg?branch=master)](https://travis-ci.com/pact-foundation/pact-mock_service)
|
5
5
|
|
6
6
|
This codebase provides the HTTP mock and stub service used by implementations of [Pact][pact]. It is packaged as a gem, and as a standalone executable for Mac OSX and Linux and Windows.
|
7
7
|
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'cgi/core'
|
2
|
+
require 'pact/consumer_contract/query'
|
3
|
+
|
2
4
|
module Pact
|
3
5
|
module Consumer
|
4
6
|
|
@@ -11,7 +13,7 @@ module Pact
|
|
11
13
|
}
|
12
14
|
|
13
15
|
def params_hash env
|
14
|
-
|
16
|
+
Pact::Query.parse_string(env["QUERY_STRING"])
|
15
17
|
end
|
16
18
|
|
17
19
|
def request_as_hash_from env
|
data/lib/pact/consumer/server.rb
CHANGED
@@ -83,7 +83,7 @@ module Pact
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def webrick_opts
|
86
|
-
opts = { Port: port.nil? ? 0 : port, AccessLog: [], Logger: WEBrick::Log::new(nil, 0) }
|
86
|
+
opts = { Host: host.nil? ? 'localhost' : host, Port: port.nil? ? 0 : port, AccessLog: [], Logger: WEBrick::Log::new(nil, 0) }
|
87
87
|
opts.merge!({
|
88
88
|
:SSLCertificate => OpenSSL::X509::Certificate.new(File.open(options[:sslcert]).read) }) if options[:sslcert]
|
89
89
|
opts.merge!({
|
@@ -1,14 +1,11 @@
|
|
1
1
|
require 'thor'
|
2
|
-
require 'webrick/https'
|
3
|
-
require 'rack/handler/webrick'
|
4
|
-
require 'fileutils'
|
5
|
-
require 'pact/mock_service/server/wait_for_server_up'
|
6
|
-
require 'pact/mock_service/cli/pidfile'
|
7
|
-
require 'socket'
|
8
2
|
|
9
3
|
module Pact
|
10
4
|
module MockService
|
11
5
|
class CLI < Thor
|
6
|
+
def self.exit_on_failure? # Thor 1.0 deprecation guard
|
7
|
+
false
|
8
|
+
end
|
12
9
|
|
13
10
|
PACT_FILE_WRITE_MODE_DESC = "`overwrite` or `merge`. Use `merge` when running multiple mock service instances in parallel for the same consumer/provider pair." +
|
14
11
|
" Ensure the pact file is deleted before running tests when using this option so that interactions deleted from the code are not maintained in the file."
|
@@ -30,6 +27,7 @@ module Pact
|
|
30
27
|
method_option :monkeypatch, hide: true
|
31
28
|
|
32
29
|
def service
|
30
|
+
require_common_dependencies
|
33
31
|
require 'pact/mock_service/run'
|
34
32
|
Run.(options)
|
35
33
|
end
|
@@ -48,6 +46,7 @@ module Pact
|
|
48
46
|
method_option :sslkey, desc: "Specify the path to the SSL key to use when running the service over HTTPS"
|
49
47
|
|
50
48
|
def control
|
49
|
+
require_common_dependencies
|
51
50
|
require 'pact/mock_service/control_server/run'
|
52
51
|
ControlServer::Run.(options)
|
53
52
|
end
|
@@ -70,6 +69,7 @@ module Pact
|
|
70
69
|
method_option :monkeypatch, hide: true
|
71
70
|
|
72
71
|
def start
|
72
|
+
require_common_dependencies
|
73
73
|
start_server(mock_service_pidfile) do
|
74
74
|
service
|
75
75
|
end
|
@@ -80,6 +80,7 @@ module Pact
|
|
80
80
|
method_option :pid_dir, desc: "PID dir, defaults to tmp/pids", default: "tmp/pids"
|
81
81
|
|
82
82
|
def stop
|
83
|
+
require_common_dependencies
|
83
84
|
mock_service_pidfile.kill_process
|
84
85
|
end
|
85
86
|
|
@@ -100,6 +101,7 @@ module Pact
|
|
100
101
|
method_option :sslkey, desc: "Specify the path to the SSL key to use when running the service over HTTPS"
|
101
102
|
|
102
103
|
def restart
|
104
|
+
require_common_dependencies
|
103
105
|
restart_server(mock_service_pidfile) do
|
104
106
|
service
|
105
107
|
end
|
@@ -120,6 +122,7 @@ module Pact
|
|
120
122
|
method_option :pact_dir, aliases: "-d", desc: "Directory to which the pacts will be written", default: "."
|
121
123
|
|
122
124
|
def control_start
|
125
|
+
require_common_dependencies
|
123
126
|
start_server(control_server_pidfile) do
|
124
127
|
control
|
125
128
|
end
|
@@ -130,6 +133,7 @@ module Pact
|
|
130
133
|
method_option :pid_dir, desc: "PID dir, defaults to tmp/pids", default: "tmp/pids"
|
131
134
|
|
132
135
|
def control_stop
|
136
|
+
require_common_dependencies
|
133
137
|
control_server_pidfile.kill_process
|
134
138
|
end
|
135
139
|
|
@@ -148,6 +152,7 @@ module Pact
|
|
148
152
|
method_option :sslkey, desc: "Specify the path to the SSL key to use when running the service over HTTPS"
|
149
153
|
|
150
154
|
def control_restart
|
155
|
+
require_common_dependencies
|
151
156
|
restart_server(control_server_pidfile) do
|
152
157
|
control
|
153
158
|
end
|
@@ -164,6 +169,15 @@ module Pact
|
|
164
169
|
|
165
170
|
no_commands do
|
166
171
|
|
172
|
+
def require_common_dependencies
|
173
|
+
require 'webrick/https'
|
174
|
+
require 'rack/handler/webrick'
|
175
|
+
require 'fileutils'
|
176
|
+
require 'pact/mock_service/server/wait_for_server_up'
|
177
|
+
require 'pact/mock_service/cli/pidfile'
|
178
|
+
require 'socket'
|
179
|
+
end
|
180
|
+
|
167
181
|
def control_server_pidfile
|
168
182
|
Pidfile.new(pid_dir: options[:pid_dir], name: control_pidfile_name)
|
169
183
|
end
|
@@ -11,6 +11,9 @@ module Pact
|
|
11
11
|
# `script --help` to display the help for the default task instead of the command list
|
12
12
|
#
|
13
13
|
class CustomThor < ::Thor
|
14
|
+
def self.exit_on_failure? # Thor 1.0 deprecation guard
|
15
|
+
false
|
16
|
+
end
|
14
17
|
|
15
18
|
no_commands do
|
16
19
|
def self.start given_args = ARGV, config = {}
|
@@ -38,6 +38,10 @@ module Pact
|
|
38
38
|
expected_interactions - actual_interactions.matched_interactions - @actual_interactions.interaction_mismatches.collect(&:candidate_interactions).flatten
|
39
39
|
end
|
40
40
|
|
41
|
+
def interaction_mismatches
|
42
|
+
actual_interactions.interaction_mismatches
|
43
|
+
end
|
44
|
+
|
41
45
|
private
|
42
46
|
|
43
47
|
attr_reader :expected_interactions, :actual_interactions
|
@@ -52,7 +52,7 @@ module Pact
|
|
52
52
|
def to_s
|
53
53
|
titles_and_summaries.collect do | title, summaries |
|
54
54
|
"#{title}:\n\t#{summaries.join("\n\t")}\n\n" if summaries.any?
|
55
|
-
end.compact.join
|
55
|
+
end.compact.join + verification.interaction_mismatches.collect(&:to_s).join("\n\n") + "\n"
|
56
56
|
|
57
57
|
end
|
58
58
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact-mock_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.9.1
|
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:
|
15
|
+
date: 2021-06-03 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|
@@ -60,16 +60,22 @@ dependencies:
|
|
60
60
|
name: thor
|
61
61
|
requirement: !ruby/object:Gem::Requirement
|
62
62
|
requirements:
|
63
|
-
- - "
|
63
|
+
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0.19'
|
66
|
+
- - "<"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
66
69
|
type: :runtime
|
67
70
|
prerelease: false
|
68
71
|
version_requirements: !ruby/object:Gem::Requirement
|
69
72
|
requirements:
|
70
|
-
- - "
|
73
|
+
- - ">="
|
71
74
|
- !ruby/object:Gem::Version
|
72
75
|
version: '0.19'
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '2.0'
|
73
79
|
- !ruby/object:Gem::Dependency
|
74
80
|
name: json
|
75
81
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,20 +124,20 @@ dependencies:
|
|
118
124
|
requirements:
|
119
125
|
- - "~>"
|
120
126
|
- !ruby/object:Gem::Version
|
121
|
-
version: '1.
|
127
|
+
version: '1.16'
|
122
128
|
- - ">="
|
123
129
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
130
|
+
version: 1.16.4
|
125
131
|
type: :runtime
|
126
132
|
prerelease: false
|
127
133
|
version_requirements: !ruby/object:Gem::Requirement
|
128
134
|
requirements:
|
129
135
|
- - "~>"
|
130
136
|
- !ruby/object:Gem::Version
|
131
|
-
version: '1.
|
137
|
+
version: '1.16'
|
132
138
|
- - ">="
|
133
139
|
- !ruby/object:Gem::Version
|
134
|
-
version: 1.
|
140
|
+
version: 1.16.4
|
135
141
|
- !ruby/object:Gem::Dependency
|
136
142
|
name: filelock
|
137
143
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,14 +172,20 @@ dependencies:
|
|
166
172
|
requirements:
|
167
173
|
- - "~>"
|
168
174
|
- !ruby/object:Gem::Version
|
169
|
-
version:
|
175
|
+
version: '13.0'
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: 13.0.1
|
170
179
|
type: :development
|
171
180
|
prerelease: false
|
172
181
|
version_requirements: !ruby/object:Gem::Requirement
|
173
182
|
requirements:
|
174
183
|
- - "~>"
|
175
184
|
- !ruby/object:Gem::Version
|
176
|
-
version:
|
185
|
+
version: '13.0'
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: 13.0.1
|
177
189
|
- !ruby/object:Gem::Dependency
|
178
190
|
name: webmock
|
179
191
|
requirement: !ruby/object:Gem::Requirement
|
@@ -399,8 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
399
411
|
- !ruby/object:Gem::Version
|
400
412
|
version: '0'
|
401
413
|
requirements: []
|
402
|
-
|
403
|
-
rubygems_version: 2.7.7
|
414
|
+
rubygems_version: 3.2.19
|
404
415
|
signing_key:
|
405
416
|
specification_version: 4
|
406
417
|
summary: Provides a mock service for use with Pact
|