pact-mock_service 2.8.1 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +1 -1
- data/lib/pact/mock_service/cli.rb +6 -0
- data/lib/pact/mock_service/logger.rb +14 -1
- data/lib/pact/mock_service/run.rb +1 -0
- data/lib/pact/mock_service/spawn.rb +1 -0
- data/lib/pact/mock_service/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b82bc38bee71e0f4870efdcefd13f9959b6ec44de8ed01b9a44e7bcc1710e98d
|
4
|
+
data.tar.gz: 81e5ac42bcdaa64bdfa74ab5af1a093b521aa543684f104a2f5d7acc1edb754b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58a15eb3aeade226fb8b154c2422e80bddbca9706d1ce5e36d1e126a15a4dd6656f844a935657ef96cc0cf45569934c90e0c41b80003e39b01f79e27b531f376
|
7
|
+
data.tar.gz: 15a02ed2aa3904b1eca749652df85f9fba5308cedb0c87cbffa99f338150c5b54acc872df17c18b9cba0582f3d7854efd1053490f6bebb49ba40bafa911c6fb6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -42,7 +42,7 @@ Run `pact-mock-service help` for command line options.
|
|
42
42
|
|
43
43
|
## Mock Service Usage
|
44
44
|
|
45
|
-
Each mock service process is designed to mock only ONE provider. To mock multiple providers, you will need to start a process for each provider. The lifecycle of a mock service instance during a test suite execution is as follows:
|
45
|
+
Each mock service process is designed to mock only ONE provider for ONE consumer. To mock multiple providers, you will need to start a process for each provider. The lifecycle of a mock service instance during a test suite execution is as follows:
|
46
46
|
|
47
47
|
* _Before suite:_ start mock service
|
48
48
|
* _Before each test:_ clear interactions from previous test
|
@@ -22,6 +22,7 @@ module Pact
|
|
22
22
|
method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
|
23
23
|
method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.", default: '2'
|
24
24
|
method_option :log, aliases: "-l", desc: "File to which to log output"
|
25
|
+
method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
|
25
26
|
method_option :cors, aliases: "-o", desc: "Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses"
|
26
27
|
method_option :ssl, desc: "Use a self-signed SSL cert to run the service over HTTPS", type: :boolean, default: false
|
27
28
|
method_option :sslcert, desc: "Specify the path to the SSL cert to use when running the service over HTTPS"
|
@@ -38,6 +39,7 @@ module Pact
|
|
38
39
|
method_option :host, aliases: "-h", desc: "Host on which to bind the service", default: 'localhost'
|
39
40
|
method_option :pact_dir, aliases: "-d", desc: "Directory to which the pacts will be written"
|
40
41
|
method_option :log_dir, aliases: "-l", desc: "File to which to log output"
|
42
|
+
method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
|
41
43
|
method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
|
42
44
|
method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.", default: '2'
|
43
45
|
method_option :cors, aliases: "-o", desc: "Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses"
|
@@ -59,6 +61,7 @@ module Pact
|
|
59
61
|
method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
|
60
62
|
method_option :pid_dir, desc: "PID dir", default: 'tmp/pids'
|
61
63
|
method_option :log, aliases: "-l", desc: "File to which to log output"
|
64
|
+
method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
|
62
65
|
method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.", default: '2'
|
63
66
|
method_option :cors, aliases: "-o", desc: "Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses"
|
64
67
|
method_option :ssl, desc: "Use a self-signed SSL cert to run the service over HTTPS", type: :boolean, default: false
|
@@ -89,6 +92,7 @@ module Pact
|
|
89
92
|
method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
|
90
93
|
method_option :pid_dir, desc: "PID dir", default: 'tmp/pids'
|
91
94
|
method_option :log, aliases: "-l", desc: "File to which to log output"
|
95
|
+
method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
|
92
96
|
method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.", default: '2'
|
93
97
|
method_option :cors, aliases: "-o", desc: "Support browser security in tests by responding to OPTIONS requests and adding CORS headers to mocked responses"
|
94
98
|
method_option :ssl, desc: "Use a self-signed SSL cert to run the service over HTTPS", type: :boolean, default: false
|
@@ -104,6 +108,7 @@ module Pact
|
|
104
108
|
desc 'control-start', "Start a Pact mock service control server."
|
105
109
|
method_option :port, aliases: "-p", desc: "Port on which to run the service", default: '1234'
|
106
110
|
method_option :log_dir, aliases: "-l", desc: "File to which to log output", default: "log"
|
111
|
+
method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
|
107
112
|
method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
|
108
113
|
method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact", default: '2'
|
109
114
|
method_option :pid_dir, desc: "PID dir", default: "tmp/pids"
|
@@ -130,6 +135,7 @@ module Pact
|
|
130
135
|
desc 'control-restart', "Start a Pact mock service control server."
|
131
136
|
method_option :port, aliases: "-p", desc: "Port on which to run the service", default: '1234'
|
132
137
|
method_option :log_dir, aliases: "-l", desc: "File to which to log output", default: "log"
|
138
|
+
method_option :log_level, desc: "Log level. Options are DEBUG INFO WARN ERROR", default: "DEBUG"
|
133
139
|
method_option :pact_dir, aliases: "-d", desc: "Directory to which the pacts will be written", default: "."
|
134
140
|
method_option :pact_file_write_mode, aliases: "-m", desc: PACT_FILE_WRITE_MODE_DESC, type: :string, default: 'overwrite'
|
135
141
|
method_option :pact_specification_version, aliases: "-i", desc: "The pact specification version to use when writing the pact. Note that only versions 1 and 2 are currently supported.", default: '2'
|
@@ -19,9 +19,22 @@ module Pact
|
|
19
19
|
log_stream = options[:log_file] || $stdout
|
20
20
|
logger = new log_stream
|
21
21
|
logger.formatter = options[:log_formatter] if options[:log_formatter]
|
22
|
-
logger.level =
|
22
|
+
logger.level = logger_level(options[:log_level])
|
23
23
|
logger
|
24
24
|
end
|
25
|
+
|
26
|
+
def self.logger_level log_level_string
|
27
|
+
if log_level_string
|
28
|
+
begin
|
29
|
+
Kernel.const_get('Logger').const_get(log_level_string.upcase)
|
30
|
+
rescue NameError
|
31
|
+
$stderr.puts "WARN: Ignoring log level '#{log_level_string}' as it is not a valid value. Valid values are: DEBUG INFO WARN ERROR FATAL. Using DEBUG."
|
32
|
+
Logger::DEBUG
|
33
|
+
end
|
34
|
+
else
|
35
|
+
Logger::DEBUG
|
36
|
+
end
|
37
|
+
end
|
25
38
|
end
|
26
39
|
end
|
27
40
|
end
|
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: 2.
|
4
|
+
version: 2.9.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-06-15 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|