test-kitchen 2.2.5 → 2.3.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/Rakefile +3 -3
- data/lib/kitchen/cli.rb +71 -66
- data/lib/kitchen/color.rb +1 -0
- data/lib/kitchen/command.rb +1 -0
- data/lib/kitchen/config.rb +4 -2
- data/lib/kitchen/configurable.rb +3 -2
- data/lib/kitchen/data_munger.rb +15 -15
- data/lib/kitchen/driver/base.rb +4 -7
- data/lib/kitchen/driver/proxy.rb +1 -0
- data/lib/kitchen/driver/ssh_base.rb +8 -10
- data/lib/kitchen/generator/init.rb +17 -18
- data/lib/kitchen/instance.rb +12 -12
- data/lib/kitchen/lifecycle_hooks.rb +1 -0
- data/lib/kitchen/loader/yaml.rb +8 -1
- data/lib/kitchen/plugin.rb +7 -7
- data/lib/kitchen/provisioner/base.rb +6 -11
- data/lib/kitchen/provisioner/chef/berkshelf.rb +1 -1
- data/lib/kitchen/provisioner/chef/common_sandbox.rb +12 -11
- data/lib/kitchen/provisioner/chef/policyfile.rb +1 -1
- data/lib/kitchen/provisioner/chef_apply.rb +1 -1
- data/lib/kitchen/provisioner/chef_base.rb +38 -12
- data/lib/kitchen/provisioner/chef_solo.rb +2 -2
- data/lib/kitchen/provisioner/chef_zero.rb +2 -2
- data/lib/kitchen/provisioner/shell.rb +3 -1
- data/lib/kitchen/shell_out.rb +3 -3
- data/lib/kitchen/ssh.rb +2 -2
- data/lib/kitchen/transport/exec.rb +1 -0
- data/lib/kitchen/transport/ssh.rb +4 -3
- data/lib/kitchen/transport/winrm.rb +6 -4
- data/lib/kitchen/util.rb +4 -4
- data/lib/kitchen/verifier/base.rb +4 -8
- data/lib/kitchen/verifier/busser.rb +3 -3
- data/lib/kitchen/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: 42bf489a9ab86a4c1c88cc74e8a257ce2b6241a199fcd337b59a1b7ee32f321f
|
4
|
+
data.tar.gz: 1c89f445f99ceec9e677ba75cdbbd662b150b36ebbecaadccbf1378d57edca0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f81c55631f7f772e3f0a3a1d6ef25116632b5500ad3e782f8f2e97dfcb691c6c397f2a5589248dac7a90a95459558cde767398e052c322b48525dd896f389388
|
7
|
+
data.tar.gz: 57e8f9a2ea674ee43f2e589a52b5e259c749840f122a9094a997c6968bf4e35143c4fc20d8e4accf44454c1d03d252429c8b4272c205328a01f56be6d16dcce5
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ rescue LoadError
|
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "Run all test suites"
|
23
|
-
task test:
|
23
|
+
task test: %i{unit features}
|
24
24
|
|
25
25
|
desc "Display LOC stats"
|
26
26
|
task :stats do
|
@@ -41,7 +41,7 @@ rescue LoadError
|
|
41
41
|
end
|
42
42
|
|
43
43
|
desc "Run all quality tasks"
|
44
|
-
task quality:
|
44
|
+
task quality: %i{style stats}
|
45
45
|
|
46
46
|
begin
|
47
47
|
require "yard"
|
@@ -50,7 +50,7 @@ rescue LoadError
|
|
50
50
|
puts "yard is not available. (sudo) gem install yard to generate yard documentation."
|
51
51
|
end
|
52
52
|
|
53
|
-
task default:
|
53
|
+
task default: %i{test quality}
|
54
54
|
|
55
55
|
begin
|
56
56
|
require "github_changelog_generator/task"
|
data/lib/kitchen/cli.rb
CHANGED
@@ -82,38 +82,38 @@ module Kitchen
|
|
82
82
|
# @api private
|
83
83
|
def self.log_options
|
84
84
|
method_option :log_level,
|
85
|
-
|
86
|
-
|
85
|
+
aliases: "-l",
|
86
|
+
desc: "Set the log level (debug, info, warn, error, fatal)"
|
87
87
|
method_option :log_overwrite,
|
88
|
-
|
89
|
-
|
88
|
+
desc: "Set to false to prevent log overwriting each time Test Kitchen runs",
|
89
|
+
type: :boolean
|
90
90
|
method_option :color,
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
type: :boolean,
|
92
|
+
lazy_default: $stdout.tty?,
|
93
|
+
desc: "Toggle color output for STDOUT logger"
|
94
94
|
end
|
95
95
|
|
96
96
|
# Sets the test_base_path method_options
|
97
97
|
# @api private
|
98
98
|
def self.test_base_path
|
99
99
|
method_option :test_base_path,
|
100
|
-
|
101
|
-
|
100
|
+
aliases: "-t",
|
101
|
+
desc: "Set the base path of the tests"
|
102
102
|
end
|
103
103
|
|
104
104
|
desc "list [INSTANCE|REGEXP|all]", "Lists one or more instances"
|
105
105
|
method_option :bare,
|
106
|
-
|
107
|
-
|
108
|
-
|
106
|
+
aliases: "-b",
|
107
|
+
type: :boolean,
|
108
|
+
desc: "List the name of each instance only, one per line"
|
109
109
|
method_option :json,
|
110
|
-
|
111
|
-
|
112
|
-
|
110
|
+
aliases: "-j",
|
111
|
+
type: :boolean,
|
112
|
+
desc: "Print data as JSON"
|
113
113
|
method_option :debug,
|
114
|
-
|
115
|
-
|
116
|
-
|
114
|
+
aliases: "-d",
|
115
|
+
type: :boolean,
|
116
|
+
desc: "[Deprecated] Please use `kitchen diagnose'"
|
117
117
|
log_options
|
118
118
|
def list(*args)
|
119
119
|
update_config!
|
@@ -123,18 +123,18 @@ module Kitchen
|
|
123
123
|
|
124
124
|
desc "diagnose [INSTANCE|REGEXP|all]", "Show computed diagnostic configuration"
|
125
125
|
method_option :loader,
|
126
|
-
|
127
|
-
|
126
|
+
type: :boolean,
|
127
|
+
desc: "Include data loader diagnostics"
|
128
128
|
method_option :plugins,
|
129
|
-
|
130
|
-
|
129
|
+
type: :boolean,
|
130
|
+
desc: "Include plugin diagnostics"
|
131
131
|
method_option :instances,
|
132
|
-
|
133
|
-
|
134
|
-
|
132
|
+
type: :boolean,
|
133
|
+
default: true,
|
134
|
+
desc: "Include instances diagnostics"
|
135
135
|
method_option :all,
|
136
|
-
|
137
|
-
|
136
|
+
type: :boolean,
|
137
|
+
desc: "Include all diagnostics"
|
138
138
|
log_options
|
139
139
|
test_base_path
|
140
140
|
def diagnose(*args)
|
@@ -165,27 +165,32 @@ module Kitchen
|
|
165
165
|
intermediate states will be executed. See http://kitchen.ci for further explanation.
|
166
166
|
DESC
|
167
167
|
method_option :concurrency,
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
168
|
+
aliases: "-c",
|
169
|
+
type: :numeric,
|
170
|
+
lazy_default: MAX_CONCURRENCY,
|
171
|
+
desc: <<-DESC.gsub(/^\s+/, "").tr("\n", " ")
|
172
172
|
Run a #{action} against all matching instances concurrently. Only N
|
173
173
|
instances will run at the same time if a number is given.
|
174
|
-
|
174
|
+
DESC
|
175
175
|
method_option :parallel,
|
176
|
-
|
177
|
-
|
178
|
-
|
176
|
+
aliases: "-p",
|
177
|
+
type: :boolean,
|
178
|
+
desc: <<-DESC.gsub(/^\s+/, "").tr("\n", " ")
|
179
179
|
[Future DEPRECATION, use --concurrency]
|
180
180
|
Run a #{action} against all matching instances concurrently.
|
181
|
-
|
181
|
+
DESC
|
182
182
|
if action == :converge || action == :verify
|
183
183
|
method_option :debug,
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
184
|
+
aliases: "-D",
|
185
|
+
type: :boolean,
|
186
|
+
default: false,
|
187
|
+
desc: "Run the #{action} with debugging enabled."
|
188
188
|
end
|
189
|
+
method_option :fail_fast,
|
190
|
+
aliases: "-f",
|
191
|
+
type: :boolean,
|
192
|
+
desc: "Fail immediately when errors occur in concurrency mode"
|
193
|
+
|
189
194
|
test_base_path
|
190
195
|
log_options
|
191
196
|
define_method(action) do |*args|
|
@@ -195,7 +200,7 @@ module Kitchen
|
|
195
200
|
end
|
196
201
|
|
197
202
|
desc "test [INSTANCE|REGEXP|all]",
|
198
|
-
|
203
|
+
"Test (destroy, create, converge, setup, verify and destroy) one or more instances"
|
199
204
|
long_desc <<-DESC
|
200
205
|
The instance states are in order: destroy, create, converge, setup, verify, destroy.
|
201
206
|
Test changes the state of one or more instances to destroyed, then executes
|
@@ -210,33 +215,33 @@ module Kitchen
|
|
210
215
|
* never: instances will never be destroyed afterwards.
|
211
216
|
DESC
|
212
217
|
method_option :concurrency,
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
218
|
+
aliases: "-c",
|
219
|
+
type: :numeric,
|
220
|
+
lazy_default: MAX_CONCURRENCY,
|
221
|
+
desc: <<-DESC.gsub(/^\s+/, "").tr("\n", " ")
|
217
222
|
Run a test against all matching instances concurrently. Only N
|
218
223
|
instances will run at the same time if a number is given.
|
219
|
-
|
224
|
+
DESC
|
220
225
|
method_option :parallel,
|
221
|
-
|
222
|
-
|
223
|
-
|
226
|
+
aliases: "-p",
|
227
|
+
type: :boolean,
|
228
|
+
desc: <<-DESC.gsub(/^\s+/, "").tr("\n", " ")
|
224
229
|
[Future DEPRECATION, use --concurrency]
|
225
230
|
Run a test against all matching instances concurrently.
|
226
|
-
|
231
|
+
DESC
|
227
232
|
method_option :destroy,
|
228
|
-
|
229
|
-
|
230
|
-
|
233
|
+
aliases: "-d",
|
234
|
+
default: "passing",
|
235
|
+
desc: "Destroy strategy to use after testing (passing, always, never)."
|
231
236
|
method_option :auto_init,
|
232
|
-
|
233
|
-
|
234
|
-
|
237
|
+
type: :boolean,
|
238
|
+
default: false,
|
239
|
+
desc: "Invoke init command if .kitchen.yml is missing"
|
235
240
|
method_option :debug,
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
241
|
+
aliases: "-D",
|
242
|
+
type: :boolean,
|
243
|
+
default: false,
|
244
|
+
desc: "Run the converge and verify with debugging enabled."
|
240
245
|
test_base_path
|
241
246
|
log_options
|
242
247
|
def test(*args)
|
@@ -262,18 +267,18 @@ module Kitchen
|
|
262
267
|
desc "doctor INSTANCE|REGEXP", "Check for common system problems"
|
263
268
|
log_options
|
264
269
|
method_option :all,
|
265
|
-
|
266
|
-
|
270
|
+
aliases: "-a",
|
271
|
+
desc: "Check all instances"
|
267
272
|
def doctor(*args)
|
268
273
|
update_config!
|
269
274
|
perform("doctor", "doctor", args)
|
270
275
|
end
|
271
276
|
|
272
277
|
desc "exec INSTANCE|REGEXP -c REMOTE_COMMAND",
|
273
|
-
|
278
|
+
"Execute command on one or more instance"
|
274
279
|
method_option :command,
|
275
|
-
|
276
|
-
|
280
|
+
aliases: "-c",
|
281
|
+
desc: "execute via ssh"
|
277
282
|
log_options
|
278
283
|
def exec(*args)
|
279
284
|
update_config!
|
@@ -297,7 +302,7 @@ module Kitchen
|
|
297
302
|
end
|
298
303
|
|
299
304
|
register Kitchen::Generator::Init, "init",
|
300
|
-
|
305
|
+
"init", "Adds some configuration to your cookbook so Kitchen can rock"
|
301
306
|
long_desc <<-D, for: "init"
|
302
307
|
Init will add Test Kitchen support to an existing project for
|
303
308
|
convergence integration testing. A default kitchen.yml file (which is
|
data/lib/kitchen/color.rb
CHANGED
data/lib/kitchen/command.rb
CHANGED
data/lib/kitchen/config.rb
CHANGED
@@ -121,14 +121,16 @@ module Kitchen
|
|
121
121
|
# in convergence integration
|
122
122
|
def platforms
|
123
123
|
@platforms ||= Collection.new(
|
124
|
-
data.platform_data.map { |pdata| Platform.new(pdata) }
|
124
|
+
data.platform_data.map { |pdata| Platform.new(pdata) }
|
125
|
+
)
|
125
126
|
end
|
126
127
|
|
127
128
|
# @return [Collection<Suite>] all defined suites which will be used in
|
128
129
|
# convergence integration
|
129
130
|
def suites
|
130
131
|
@suites ||= Collection.new(
|
131
|
-
data.suite_data.map { |sdata| Suite.new(sdata) }
|
132
|
+
data.suite_data.map { |sdata| Suite.new(sdata) }
|
133
|
+
)
|
132
134
|
end
|
133
135
|
|
134
136
|
private
|
data/lib/kitchen/configurable.rb
CHANGED
@@ -236,7 +236,7 @@ module Kitchen
|
|
236
236
|
# Remove items from hash when not provided in the loaded config or when the rendered message is nil
|
237
237
|
@deprecated_config = deprecated_attributes.delete_if { |attr, obj| !provided_config.key?(attr) || obj.nil? }
|
238
238
|
|
239
|
-
|
239
|
+
unless deprecated_config.empty?
|
240
240
|
warning = Util.outdent!(<<-MSG)
|
241
241
|
Deprecated configuration detected:
|
242
242
|
#{deprecated_config.keys.join("\n")}
|
@@ -341,6 +341,7 @@ module Kitchen
|
|
341
341
|
# @api private
|
342
342
|
def wrap_shell_code(code)
|
343
343
|
return env_wrapped(code) if powershell_shell?
|
344
|
+
|
344
345
|
Util.wrap_command((env_wrapped code))
|
345
346
|
end
|
346
347
|
|
@@ -353,7 +354,7 @@ module Kitchen
|
|
353
354
|
end
|
354
355
|
|
355
356
|
def proxy_setting_keys
|
356
|
-
|
357
|
+
%i{http_proxy https_proxy ftp_proxy no_proxy}
|
357
358
|
end
|
358
359
|
|
359
360
|
def resolve_proxy_settings_from_config
|
data/lib/kitchen/data_munger.rb
CHANGED
@@ -156,8 +156,8 @@ module Kitchen
|
|
156
156
|
def combine_arrays!(root, key, *namespaces)
|
157
157
|
if root.key?(key)
|
158
158
|
root[key] = namespaces
|
159
|
-
|
160
|
-
|
159
|
+
.map { |namespace| root.fetch(key).fetch(namespace, []) }.flatten
|
160
|
+
.compact
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
@@ -299,7 +299,7 @@ module Kitchen
|
|
299
299
|
data data_bags encrypted_data_bag_secret_key
|
300
300
|
environments nodes roles
|
301
301
|
}.each do |key|
|
302
|
-
|
302
|
+
move_data_to!(:provisioner, suite, "#{key}_path".to_sym)
|
303
303
|
end
|
304
304
|
end
|
305
305
|
end
|
@@ -507,7 +507,7 @@ module Kitchen
|
|
507
507
|
def convert_legacy_driver_http_proxy_format_at!(root)
|
508
508
|
ddata = root.fetch(:driver, {})
|
509
509
|
|
510
|
-
|
510
|
+
%i{http_proxy https_proxy}.each do |key|
|
511
511
|
next unless ddata.is_a?(Hash) && ddata.key?(key)
|
512
512
|
|
513
513
|
pdata = root.fetch(:provisioner, {})
|
@@ -718,15 +718,15 @@ module Kitchen
|
|
718
718
|
# @api private
|
719
719
|
def move_chef_data_to_provisioner!
|
720
720
|
data.fetch(:suites, []).each do |suite|
|
721
|
-
|
722
|
-
|
723
|
-
|
721
|
+
move_data_to!(:provisioner, suite, :attributes)
|
722
|
+
move_data_to!(:provisioner, suite, :run_list)
|
723
|
+
move_data_to!(:provisioner, suite, :named_run_list)
|
724
724
|
end
|
725
725
|
|
726
726
|
data.fetch(:platforms, []).each do |platform|
|
727
|
-
|
728
|
-
|
729
|
-
|
727
|
+
move_data_to!(:provisioner, platform, :attributes)
|
728
|
+
move_data_to!(:provisioner, platform, :run_list)
|
729
|
+
move_data_to!(:provisioner, platform, :named_run_list)
|
730
730
|
end
|
731
731
|
end
|
732
732
|
|
@@ -738,12 +738,12 @@ module Kitchen
|
|
738
738
|
# @param key [Symbol] a key in the root hash to move into a `:provisioner`
|
739
739
|
# sub-hash block
|
740
740
|
# @api private
|
741
|
-
def
|
741
|
+
def move_data_to!(to, root, key)
|
742
742
|
if root.key?(key)
|
743
|
-
pdata = root.fetch(
|
743
|
+
pdata = root.fetch(to, {})
|
744
744
|
pdata = { name: pdata } if pdata.is_a?(String)
|
745
745
|
unless root.fetch(key, nil).nil?
|
746
|
-
root[
|
746
|
+
root[to] = pdata.rmerge(key => root.delete(key))
|
747
747
|
end
|
748
748
|
end
|
749
749
|
end
|
@@ -984,7 +984,7 @@ module Kitchen
|
|
984
984
|
# Hash if not found
|
985
985
|
# @api private
|
986
986
|
def platform_data_for(name)
|
987
|
-
data.fetch(:platforms, {}).find(-> {
|
987
|
+
data.fetch(:platforms, {}).find(-> { {} }) do |platform|
|
988
988
|
platform.fetch(:name, nil) == name
|
989
989
|
end
|
990
990
|
end
|
@@ -1015,7 +1015,7 @@ module Kitchen
|
|
1015
1015
|
# Hash if not found
|
1016
1016
|
# @api private
|
1017
1017
|
def suite_data_for(name)
|
1018
|
-
data.fetch(:suites, {}).find(-> {
|
1018
|
+
data.fetch(:suites, {}).find(-> { {} }) do |suite|
|
1019
1019
|
suite.fetch(:name, nil) == name
|
1020
1020
|
end
|
1021
1021
|
end
|
data/lib/kitchen/driver/base.rb
CHANGED
@@ -54,15 +54,13 @@ module Kitchen
|
|
54
54
|
#
|
55
55
|
# @param state [Hash] mutable instance and driver state
|
56
56
|
# @raise [ActionFailed] if the action could not be completed
|
57
|
-
def destroy(state)
|
58
|
-
end
|
57
|
+
def destroy(state); end
|
59
58
|
|
60
59
|
# Package an instance.
|
61
60
|
#
|
62
61
|
# @param state [Hash] mutable instance and driver state
|
63
62
|
# @raise [ActionFailed] if the action could not be completed
|
64
|
-
def package(state)
|
65
|
-
end
|
63
|
+
def package(state); end
|
66
64
|
|
67
65
|
# Check system and configuration for common errors.
|
68
66
|
#
|
@@ -97,7 +95,7 @@ module Kitchen
|
|
97
95
|
# @param methods [Array<Symbol>] one or more actions as symbols
|
98
96
|
# @raise [ClientError] if any method is not a valid action method name
|
99
97
|
def self.no_parallel_for(*methods)
|
100
|
-
action_methods =
|
98
|
+
action_methods = %i{create setup converge verify destroy}
|
101
99
|
|
102
100
|
Array(methods).each do |meth|
|
103
101
|
next if action_methods.include?(meth)
|
@@ -136,8 +134,7 @@ module Kitchen
|
|
136
134
|
# that it can leverage it internally
|
137
135
|
#
|
138
136
|
# @return path [String] a path of the cache directory
|
139
|
-
def cache_directory
|
140
|
-
end
|
137
|
+
def cache_directory; end
|
141
138
|
|
142
139
|
private
|
143
140
|
|