pact-mock_service 3.0.0 → 3.0.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13fa333461a52e6602ce822aa3cf462b2e0539bcfed0df82217bd92f4f125455
|
4
|
+
data.tar.gz: '08289828ec7f2319034c1d23ca72fe51ca77c3951b28380d73252f4d9eadd54a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70a04aaf9cc73ab6542718c6d9bff087403fc2377174a4330ef70a7eb87f2651a4ffdd4c5e32d77f17227a951d87d532475381dc7bd86cd28667e532c3746935
|
7
|
+
data.tar.gz: 8353d0c83b591f060029e6d4d052f5042a9f8414ee9d484a363c4f469ef13c1190742d9599dc5d4974527216233aea090c7832fcfcc5824cc3a1f5dafadd5cab
|
data/CHANGELOG.md
CHANGED
@@ -7,15 +7,15 @@ module Pact
|
|
7
7
|
|
8
8
|
class PortUnavailableError < StandardError; end
|
9
9
|
|
10
|
-
def self.call pidfile, port, ssl = false
|
10
|
+
def self.call pidfile, host, port, ssl = false
|
11
11
|
if pidfile.can_start?
|
12
|
-
if port_available? port
|
12
|
+
if port_available? host, port
|
13
13
|
pid = fork do
|
14
14
|
yield
|
15
15
|
end
|
16
16
|
pidfile.pid = pid
|
17
17
|
Process.detach(pid)
|
18
|
-
Server::WaitForServerUp.(port, {ssl: ssl})
|
18
|
+
Server::WaitForServerUp.(host, port, {ssl: ssl})
|
19
19
|
pidfile.write
|
20
20
|
else
|
21
21
|
raise PortUnavailableError.new("ERROR: Port #{port} already in use.")
|
@@ -23,8 +23,8 @@ module Pact
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.port_available? port
|
27
|
-
server = TCPServer.new(
|
26
|
+
def self.port_available? host, port
|
27
|
+
server = TCPServer.new(host, port)
|
28
28
|
true
|
29
29
|
rescue
|
30
30
|
false
|
@@ -7,18 +7,18 @@ module Pact
|
|
7
7
|
module Server
|
8
8
|
class WaitForServerUp
|
9
9
|
|
10
|
-
def self.call(port, options = {ssl: false})
|
10
|
+
def self.call(host, port, options = {ssl: false})
|
11
11
|
tries = 0
|
12
12
|
responsive = false
|
13
|
-
while !(responsive = responsive?(port, options)) && tries < 100
|
13
|
+
while !(responsive = responsive?(host, port, options)) && tries < 100
|
14
14
|
tries += 1
|
15
15
|
sleep 1
|
16
16
|
end
|
17
17
|
raise "Timed out waiting for server to start up on port #{port}" if !responsive
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.responsive? port, options
|
21
|
-
http = Net::HTTP.new(
|
20
|
+
def self.responsive? host, port, options
|
21
|
+
http = Net::HTTP.new(host, port)
|
22
22
|
if options[:ssl]
|
23
23
|
http.use_ssl = true
|
24
24
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
@@ -27,7 +27,7 @@ module Pact
|
|
27
27
|
scheme = 'http'
|
28
28
|
end
|
29
29
|
http.start {
|
30
|
-
request = Net::HTTP::Get.new "#{scheme}
|
30
|
+
request = Net::HTTP::Get.new "#{scheme}://#{host}:#{port}/"
|
31
31
|
request['X-Pact-Mock-Service'] = true
|
32
32
|
response = http.request request
|
33
33
|
response.code == '200'
|
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.0.
|
4
|
+
version: 3.0.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: 2019-
|
15
|
+
date: 2019-03-07 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|
@@ -399,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
399
399
|
- !ruby/object:Gem::Version
|
400
400
|
version: '0'
|
401
401
|
requirements: []
|
402
|
-
rubygems_version: 3.0.
|
402
|
+
rubygems_version: 3.0.3
|
403
403
|
signing_key:
|
404
404
|
specification_version: 4
|
405
405
|
summary: Provides a mock service for use with Pact
|