test-kitchen 2.5.2 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -11
- data/Rakefile +1 -3
- data/bin/kitchen +1 -3
- data/lib/kitchen.rb +1 -2
- data/lib/kitchen/base64_stream.rb +0 -1
- data/lib/kitchen/cli.rb +2 -2
- data/lib/kitchen/collection.rb +0 -1
- data/lib/kitchen/color.rb +0 -1
- data/lib/kitchen/command.rb +0 -1
- data/lib/kitchen/command/action.rb +1 -2
- data/lib/kitchen/command/console.rb +0 -1
- data/lib/kitchen/command/diagnose.rb +1 -2
- data/lib/kitchen/command/doctor.rb +0 -1
- data/lib/kitchen/command/exec.rb +0 -1
- data/lib/kitchen/command/list.rb +1 -2
- data/lib/kitchen/command/login.rb +0 -1
- data/lib/kitchen/command/package.rb +0 -1
- data/lib/kitchen/command/sink.rb +0 -1
- data/lib/kitchen/command/test.rb +1 -2
- data/lib/kitchen/config.rb +0 -1
- data/lib/kitchen/configurable.rb +0 -1
- data/lib/kitchen/data_munger.rb +0 -1
- data/lib/kitchen/diagnostic.rb +0 -1
- data/lib/kitchen/driver.rb +0 -1
- data/lib/kitchen/driver/base.rb +2 -39
- data/lib/kitchen/driver/dummy.rb +0 -1
- data/lib/kitchen/driver/exec.rb +0 -1
- data/lib/kitchen/driver/proxy.rb +0 -1
- data/lib/kitchen/driver/ssh_base.rb +3 -40
- data/lib/kitchen/errors.rb +0 -1
- data/lib/kitchen/generator/init.rb +0 -1
- data/lib/kitchen/instance.rb +41 -15
- data/lib/kitchen/lazy_hash.rb +0 -1
- data/lib/kitchen/lifecycle_hooks.rb +0 -1
- data/lib/kitchen/loader/yaml.rb +2 -3
- data/lib/kitchen/logger.rb +1 -2
- data/lib/kitchen/logging.rb +0 -1
- data/lib/kitchen/login_command.rb +0 -1
- data/lib/kitchen/metadata_chopper.rb +0 -1
- data/lib/kitchen/platform.rb +0 -1
- data/lib/kitchen/plugin.rb +0 -1
- data/lib/kitchen/plugin_base.rb +60 -0
- data/lib/kitchen/provisioner.rb +0 -1
- data/lib/kitchen/provisioner/base.rb +2 -2
- data/lib/kitchen/provisioner/chef/berkshelf.rb +0 -1
- data/lib/kitchen/provisioner/chef/common_sandbox.rb +1 -2
- data/lib/kitchen/provisioner/chef/policyfile.rb +2 -3
- data/lib/kitchen/provisioner/chef_apply.rb +2 -3
- data/lib/kitchen/provisioner/chef_base.rb +25 -13
- data/lib/kitchen/provisioner/chef_solo.rb +4 -1
- data/lib/kitchen/provisioner/chef_zero.rb +0 -1
- data/lib/kitchen/provisioner/dummy.rb +0 -1
- data/lib/kitchen/provisioner/shell.rb +1 -2
- data/lib/kitchen/rake_tasks.rb +0 -1
- data/lib/kitchen/shell_out.rb +1 -2
- data/lib/kitchen/ssh.rb +6 -4
- data/lib/kitchen/state_file.rb +1 -2
- data/lib/kitchen/suite.rb +0 -1
- data/lib/kitchen/thor_tasks.rb +1 -2
- data/lib/kitchen/transport.rb +0 -1
- data/lib/kitchen/transport/base.rb +2 -2
- data/lib/kitchen/transport/dummy.rb +0 -1
- data/lib/kitchen/transport/exec.rb +1 -2
- data/lib/kitchen/transport/ssh.rb +4 -5
- data/lib/kitchen/transport/winrm.rb +3 -4
- data/lib/kitchen/util.rb +0 -1
- data/lib/kitchen/verifier.rb +0 -1
- data/lib/kitchen/verifier/base.rb +2 -2
- data/lib/kitchen/verifier/busser.rb +2 -3
- data/lib/kitchen/verifier/dummy.rb +0 -1
- data/lib/kitchen/verifier/shell.rb +1 -2
- data/lib/kitchen/version.rb +1 -2
- data/lib/vendor/hash_recursive_merge.rb +0 -1
- data/templates/init/kitchen.yml.erb +2 -2
- data/test-kitchen.gemspec +3 -4
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ae69102eac88b3cbb40ad7e39b02fd2a1519e8f9ed9d114fa1c0d4c0ea7319d
|
4
|
+
data.tar.gz: 48bf850ca5c79fcb0b7af6cc7fce89b05d1c735ad51c80e224285c50581576bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9164957f96d9e93b04a4a9e32ac475d9b0e239f1e900d02660fa286d4625e312f7d1b47ab5cfa7136b91e514e826f6c915fb9dcc8a56677915714ce9106b6366
|
7
|
+
data.tar.gz: 3a0968bbe24c08505b12c8bfe3900c450c5f00bc35c3821db18b3535a891256ac9093f2f472a02bcbc7179d0b24f0c87f3a8237e185e87d39b0d741c98629738
|
data/Gemfile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
source "https://rubygems.org"
|
3
2
|
gemspec
|
4
3
|
|
@@ -26,13 +25,3 @@ end
|
|
26
25
|
group :docs do
|
27
26
|
gem "yard"
|
28
27
|
end
|
29
|
-
|
30
|
-
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
|
31
|
-
|
32
|
-
# To avoid bringing in development or test dependencies that are not
|
33
|
-
# absolutely needed, if you want to load tools not present in the gemspec
|
34
|
-
# or this Gemfile, add those additional dependencies into a Gemfile.local
|
35
|
-
# file which is ignored by this repository.
|
36
|
-
# rubocop:disable Security/Eval
|
37
|
-
eval(IO.read(__FILE__ + ".local"), binding) if File.exist?(__FILE__ + ".local")
|
38
|
-
# rubocop:enable Security/Eval
|
data/Rakefile
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
1
|
require "bundler/gem_tasks"
|
4
2
|
|
5
3
|
require "rake/testtask"
|
@@ -44,7 +42,7 @@ desc "Run all quality tasks"
|
|
44
42
|
task quality: %i{style stats}
|
45
43
|
|
46
44
|
begin
|
47
|
-
require "yard"
|
45
|
+
require "yard" unless defined?(YARD)
|
48
46
|
YARD::Rake::YardocTask.new
|
49
47
|
rescue LoadError
|
50
48
|
puts "yard is not available. (sudo) gem install yard to generate yard documentation."
|
data/bin/kitchen
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# -*- encoding: utf-8 -*-
|
3
|
-
|
4
2
|
# Trap interrupts to quit cleanly. See
|
5
3
|
# https://twitter.com/mitchellh/status/283014103189053442
|
6
4
|
Signal.trap("INT") { exit 1 }
|
7
5
|
|
8
6
|
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w{.. lib})
|
9
|
-
require "rubygems"
|
7
|
+
require "rubygems" unless defined?(Gem)
|
10
8
|
require "kitchen/cli"
|
11
9
|
require "kitchen/errors"
|
12
10
|
|
data/lib/kitchen.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,7 +15,7 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require "pathname"
|
18
|
+
require "pathname" unless defined?(Pathname)
|
20
19
|
require "thread"
|
21
20
|
|
22
21
|
require_relative "kitchen/errors"
|
data/lib/kitchen/cli.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,7 +15,8 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require
|
18
|
+
# CI tests fail without an explicit unconditional require of Thor
|
19
|
+
require "thor" # rubocop:disable ChefRuby/UnlessDefinedRequire
|
20
20
|
|
21
21
|
require_relative "../kitchen"
|
22
22
|
require_relative "generator/init"
|
data/lib/kitchen/collection.rb
CHANGED
data/lib/kitchen/color.rb
CHANGED
data/lib/kitchen/command.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -18,7 +17,7 @@
|
|
18
17
|
|
19
18
|
require_relative "../command"
|
20
19
|
|
21
|
-
require "benchmark"
|
20
|
+
require "benchmark" unless defined?(Benchmark)
|
22
21
|
|
23
22
|
module Kitchen
|
24
23
|
module Command
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -19,7 +18,7 @@
|
|
19
18
|
require_relative "../command"
|
20
19
|
require_relative "../diagnostic"
|
21
20
|
|
22
|
-
require "yaml"
|
21
|
+
require "yaml" unless defined?(YAML)
|
23
22
|
|
24
23
|
module Kitchen
|
25
24
|
module Command
|
data/lib/kitchen/command/exec.rb
CHANGED
data/lib/kitchen/command/list.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -17,7 +16,7 @@
|
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
18
|
require_relative "../command"
|
20
|
-
require "json"
|
19
|
+
require "json" unless defined?(JSON)
|
21
20
|
|
22
21
|
module Kitchen
|
23
22
|
module Command
|
data/lib/kitchen/command/sink.rb
CHANGED
data/lib/kitchen/command/test.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -18,7 +17,7 @@
|
|
18
17
|
|
19
18
|
require_relative "../command"
|
20
19
|
|
21
|
-
require "benchmark"
|
20
|
+
require "benchmark" unless defined?(Benchmark)
|
22
21
|
|
23
22
|
module Kitchen
|
24
23
|
module Command
|
data/lib/kitchen/config.rb
CHANGED
data/lib/kitchen/configurable.rb
CHANGED
data/lib/kitchen/data_munger.rb
CHANGED
data/lib/kitchen/diagnostic.rb
CHANGED
data/lib/kitchen/driver.rb
CHANGED
data/lib/kitchen/driver/base.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -20,6 +19,7 @@ require_relative "../configurable"
|
|
20
19
|
require_relative "../errors"
|
21
20
|
require_relative "../lazy_hash"
|
22
21
|
require_relative "../logging"
|
22
|
+
require_relative "../plugin_base"
|
23
23
|
require_relative "../shell_out"
|
24
24
|
|
25
25
|
module Kitchen
|
@@ -27,7 +27,7 @@ module Kitchen
|
|
27
27
|
# Base class for a driver.
|
28
28
|
#
|
29
29
|
# @author Fletcher Nichol <fnichol@nichol.ca>
|
30
|
-
class Base
|
30
|
+
class Base < Kitchen::Plugin::Base
|
31
31
|
include Configurable
|
32
32
|
include Logging
|
33
33
|
include ShellOut
|
@@ -70,43 +70,6 @@ module Kitchen
|
|
70
70
|
false
|
71
71
|
end
|
72
72
|
|
73
|
-
class << self
|
74
|
-
# @return [Array<Symbol>] an array of action method names that cannot
|
75
|
-
# be run concurrently and must be run in serial via a shared mutex
|
76
|
-
attr_reader :serial_actions
|
77
|
-
end
|
78
|
-
|
79
|
-
# Registers certain driver actions that cannot be safely run concurrently
|
80
|
-
# in threads across multiple instances. Typically this might be used
|
81
|
-
# for create or destroy actions that use an underlying resource that
|
82
|
-
# cannot be used at the same time.
|
83
|
-
#
|
84
|
-
# A shared mutex for this driver object will be used to synchronize all
|
85
|
-
# registered methods.
|
86
|
-
#
|
87
|
-
# @example a single action method that cannot be run concurrently
|
88
|
-
#
|
89
|
-
# no_parallel_for :create
|
90
|
-
#
|
91
|
-
# @example multiple action methods that cannot be run concurrently
|
92
|
-
#
|
93
|
-
# no_parallel_for :create, :destroy
|
94
|
-
#
|
95
|
-
# @param methods [Array<Symbol>] one or more actions as symbols
|
96
|
-
# @raise [ClientError] if any method is not a valid action method name
|
97
|
-
def self.no_parallel_for(*methods)
|
98
|
-
action_methods = %i{create setup converge verify destroy}
|
99
|
-
|
100
|
-
Array(methods).each do |meth|
|
101
|
-
next if action_methods.include?(meth)
|
102
|
-
|
103
|
-
raise ClientError, "##{meth} is not a valid no_parallel_for method"
|
104
|
-
end
|
105
|
-
|
106
|
-
@serial_actions ||= []
|
107
|
-
@serial_actions += methods
|
108
|
-
end
|
109
|
-
|
110
73
|
# Sets the API version for this driver. If the driver does not set this
|
111
74
|
# value, then `nil` will be used and reported.
|
112
75
|
#
|
data/lib/kitchen/driver/dummy.rb
CHANGED
data/lib/kitchen/driver/exec.rb
CHANGED
data/lib/kitchen/driver/proxy.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -19,7 +18,8 @@
|
|
19
18
|
require "thor/util"
|
20
19
|
|
21
20
|
require_relative "../lazy_hash"
|
22
|
-
|
21
|
+
require_relative "../plugin_base"
|
22
|
+
require "benchmark" unless defined?(Benchmark)
|
23
23
|
|
24
24
|
module Kitchen
|
25
25
|
module Driver
|
@@ -43,7 +43,7 @@ module Kitchen
|
|
43
43
|
# Transport, and Verifier subsystems may not be picked up in these
|
44
44
|
# Drivers. When legacy Driver::SSHBase support is removed, this class
|
45
45
|
# will no longer be available.
|
46
|
-
class SSHBase
|
46
|
+
class SSHBase < Kitchen::Plugin::Base
|
47
47
|
include ShellOut
|
48
48
|
include Configurable
|
49
49
|
include Logging
|
@@ -180,43 +180,6 @@ module Kitchen
|
|
180
180
|
# documented dependency is missing from the system
|
181
181
|
def verify_dependencies; end
|
182
182
|
|
183
|
-
class << self
|
184
|
-
# @return [Array<Symbol>] an array of action method names that cannot
|
185
|
-
# be run concurrently and must be run in serial via a shared mutex
|
186
|
-
attr_reader :serial_actions
|
187
|
-
end
|
188
|
-
|
189
|
-
# Registers certain driver actions that cannot be safely run concurrently
|
190
|
-
# in threads across multiple instances. Typically this might be used
|
191
|
-
# for create or destroy actions that use an underlying resource that
|
192
|
-
# cannot be used at the same time.
|
193
|
-
#
|
194
|
-
# A shared mutex for this driver object will be used to synchronize all
|
195
|
-
# registered methods.
|
196
|
-
#
|
197
|
-
# @example a single action method that cannot be run concurrently
|
198
|
-
#
|
199
|
-
# no_parallel_for :create
|
200
|
-
#
|
201
|
-
# @example multiple action methods that cannot be run concurrently
|
202
|
-
#
|
203
|
-
# no_parallel_for :create, :destroy
|
204
|
-
#
|
205
|
-
# @param methods [Array<Symbol>] one or more actions as symbols
|
206
|
-
# @raise [ClientError] if any method is not a valid action method name
|
207
|
-
def self.no_parallel_for(*methods)
|
208
|
-
action_methods = %i{create converge setup verify destroy}
|
209
|
-
|
210
|
-
Array(methods).each do |meth|
|
211
|
-
next if action_methods.include?(meth)
|
212
|
-
|
213
|
-
raise ClientError, "##{meth} is not a valid no_parallel_for method"
|
214
|
-
end
|
215
|
-
|
216
|
-
@serial_actions ||= []
|
217
|
-
@serial_actions += methods
|
218
|
-
end
|
219
|
-
|
220
183
|
# Cache directory that a driver could implement to inform the provisioner
|
221
184
|
# that it can leverage it internally
|
222
185
|
#
|
data/lib/kitchen/errors.rb
CHANGED
data/lib/kitchen/instance.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,8 +15,8 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require "benchmark"
|
20
|
-
require "fileutils"
|
18
|
+
require "benchmark" unless defined?(Benchmark)
|
19
|
+
require "fileutils" unless defined?(FileUtils)
|
21
20
|
|
22
21
|
module Kitchen
|
23
22
|
# An instance of a suite running on a platform. A created instance may be a
|
@@ -29,7 +28,7 @@ module Kitchen
|
|
29
28
|
include Logging
|
30
29
|
|
31
30
|
class << self
|
32
|
-
# @return [Hash] a hash of
|
31
|
+
# @return [Hash] a hash of mutexes, arranged by Plugin class names
|
33
32
|
# @api private
|
34
33
|
attr_accessor :mutexes
|
35
34
|
|
@@ -323,21 +322,29 @@ module Kitchen
|
|
323
322
|
end
|
324
323
|
end
|
325
324
|
|
326
|
-
#
|
327
|
-
#
|
325
|
+
# If a plugin has declared via .no_parallel_for that it is not
|
326
|
+
# thread-safe for certain actions, create a mutex to track it.
|
328
327
|
#
|
328
|
+
# @param plugin_class[Class] Kitchen::Plugin::Base
|
329
329
|
# @api private
|
330
|
-
def
|
331
|
-
|
332
|
-
|
333
|
-
if driver.class.serial_actions
|
330
|
+
def setup_plugin_mutexes(plugin_class)
|
331
|
+
if plugin_class.serial_actions
|
334
332
|
Kitchen.mutex.synchronize do
|
335
333
|
self.class.mutexes ||= {}
|
336
|
-
self.class.mutexes[
|
334
|
+
self.class.mutexes[plugin_class] = Mutex.new
|
337
335
|
end
|
338
336
|
end
|
339
337
|
end
|
340
338
|
|
339
|
+
# Perform any final configuration or preparation needed for the driver
|
340
|
+
# object carry out its duties.
|
341
|
+
#
|
342
|
+
# @api private
|
343
|
+
def setup_driver
|
344
|
+
@driver.finalize_config!(self)
|
345
|
+
setup_plugin_mutexes(driver.class)
|
346
|
+
end
|
347
|
+
|
341
348
|
# Perform any final configuration or preparation needed for the lifecycle hooks
|
342
349
|
# object carry out its duties.
|
343
350
|
#
|
@@ -352,6 +359,7 @@ module Kitchen
|
|
352
359
|
# @api private
|
353
360
|
def setup_provisioner
|
354
361
|
@provisioner.finalize_config!(self)
|
362
|
+
setup_plugin_mutexes(provisioner.class)
|
355
363
|
end
|
356
364
|
|
357
365
|
# Perform any final configuration or preparation needed for the transport
|
@@ -360,6 +368,7 @@ module Kitchen
|
|
360
368
|
# @api private
|
361
369
|
def setup_transport
|
362
370
|
transport.finalize_config!(self)
|
371
|
+
setup_plugin_mutexes(transport.class)
|
363
372
|
end
|
364
373
|
|
365
374
|
# Perform any final configuration or preparation needed for the verifier
|
@@ -368,6 +377,7 @@ module Kitchen
|
|
368
377
|
# @api private
|
369
378
|
def setup_verifier
|
370
379
|
verifier.finalize_config!(self)
|
380
|
+
setup_plugin_mutexes(verifier.class)
|
371
381
|
end
|
372
382
|
|
373
383
|
# Perform all actions in order from last state to desired state.
|
@@ -542,10 +552,11 @@ module Kitchen
|
|
542
552
|
# @param block [Proc] a block to be called
|
543
553
|
# @api private
|
544
554
|
def synchronize_or_call(what, state)
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
555
|
+
plugin_class = plugin_class_for_action(what)
|
556
|
+
if Array(plugin_class.serial_actions).include?(what)
|
557
|
+
debug("#{to_str} is synchronizing on #{plugin_class}##{what}")
|
558
|
+
self.class.mutexes[plugin_class].synchronize do
|
559
|
+
debug("#{to_str} is messaging #{plugin_class}##{what}")
|
549
560
|
yield(state)
|
550
561
|
end
|
551
562
|
else
|
@@ -553,6 +564,21 @@ module Kitchen
|
|
553
564
|
end
|
554
565
|
end
|
555
566
|
|
567
|
+
# Maps the given action to the plugin class associated with the action
|
568
|
+
#
|
569
|
+
# @param what[Symbol] action
|
570
|
+
# @return [Class] Kitchen::Plugin::Base
|
571
|
+
# @api private
|
572
|
+
def plugin_class_for_action(what)
|
573
|
+
{
|
574
|
+
create: driver,
|
575
|
+
setup: transport,
|
576
|
+
converge: provisioner,
|
577
|
+
verify: verifier,
|
578
|
+
destroy: driver,
|
579
|
+
}[what].class
|
580
|
+
end
|
581
|
+
|
556
582
|
# Writes a high level message for logging and/or output.
|
557
583
|
#
|
558
584
|
# In this case, all instance banner messages will be written to the common
|