test-kitchen 1.23.5 → 1.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/Rakefile +77 -0
- data/lib/kitchen/driver.rb +2 -15
- data/lib/kitchen/driver/base.rb +3 -0
- data/lib/kitchen/plugin.rb +77 -0
- data/lib/kitchen/provisioner.rb +2 -13
- data/lib/kitchen/provisioner/base.rb +4 -0
- data/lib/kitchen/transport.rb +2 -13
- data/lib/kitchen/transport/base.rb +2 -0
- data/lib/kitchen/util.rb +11 -0
- data/lib/kitchen/verifier.rb +2 -15
- data/lib/kitchen/version.rb +1 -1
- data/test-kitchen.gemspec +1 -2
- metadata +4 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f96d164d3286ff8f8445c248a0457012d3e633fd99cd27844cbd869409b971b
|
4
|
+
data.tar.gz: dea0f61a598f25e833fe700381033a4c1b90c38c46c8177ef3518922c09eb860
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26b4c8102ae775129437252c33c387d379e6099e2c7b4147a61e4c729a859fc6ee4816f38e4f157f406080ebe59c00976249df9d55854aed04819feda880a6ac
|
7
|
+
data.tar.gz: 93a9e042dff74b4ef29870bb990edce9556fd559724666164c4aaa891e2b5e4cb4ea07ea0abfa66b6e5ba4fba2c0c7d64dd66e53613569abf9d7dd3ff6d45bcf
|
data/Gemfile
CHANGED
data/Rakefile
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
|
5
|
+
require "rake/testtask"
|
6
|
+
Rake::TestTask.new(:unit) do |t|
|
7
|
+
t.libs.push "lib"
|
8
|
+
t.test_files = FileList["spec/**/*_spec.rb"]
|
9
|
+
t.verbose = true
|
10
|
+
end
|
11
|
+
|
12
|
+
begin
|
13
|
+
require "cucumber"
|
14
|
+
require "cucumber/rake/task"
|
15
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
16
|
+
t.cucumber_opts = ["features", "-x", "--format progress", "--no-color", "--tags ~@ignore"]
|
17
|
+
end
|
18
|
+
rescue LoadError
|
19
|
+
puts "cucumber is not available. (sudo) gem install cucumber to run tests."
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Run all test suites"
|
23
|
+
task test: [:unit, :features]
|
24
|
+
|
25
|
+
desc "Display LOC stats"
|
26
|
+
task :stats do
|
27
|
+
puts "\n## Production Code Stats"
|
28
|
+
sh "countloc -r lib/kitchen lib/kitchen.rb"
|
29
|
+
puts "\n## Test Code Stats"
|
30
|
+
sh "countloc -r spec features"
|
31
|
+
end
|
32
|
+
|
33
|
+
begin
|
34
|
+
require "chefstyle"
|
35
|
+
require "rubocop/rake_task"
|
36
|
+
RuboCop::RakeTask.new(:style) do |task|
|
37
|
+
task.options += ["--display-cop-names", "--no-color"]
|
38
|
+
end
|
39
|
+
rescue LoadError
|
40
|
+
puts "chefstyle is not available. (sudo) gem install chefstyle to do style checking."
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Run all quality tasks"
|
44
|
+
task quality: [:style, :stats]
|
45
|
+
|
46
|
+
begin
|
47
|
+
require "yard"
|
48
|
+
YARD::Rake::YardocTask.new
|
49
|
+
rescue LoadError
|
50
|
+
puts "yard is not available. (sudo) gem install yard to generate yard documentation."
|
51
|
+
end
|
52
|
+
|
53
|
+
task default: [:test, :quality]
|
54
|
+
|
55
|
+
begin
|
56
|
+
require "github_changelog_generator/task"
|
57
|
+
require "kitchen/version"
|
58
|
+
|
59
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
60
|
+
config.future_release = "v#{Kitchen::VERSION}"
|
61
|
+
config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature,Improvement".split(",")
|
62
|
+
config.bug_labels = "bug,Bug".split(",")
|
63
|
+
config.exclude_labels = %w{Duplicate Question Discussion No_Changelog}
|
64
|
+
end
|
65
|
+
rescue LoadError
|
66
|
+
puts "github_changelog_generator is not available." \
|
67
|
+
" (sudo) gem install github_changelog_generator to generate changelogs"
|
68
|
+
end
|
69
|
+
|
70
|
+
namespace :docs do
|
71
|
+
desc "Deploy docs"
|
72
|
+
task :deploy do
|
73
|
+
sh "cd docs && hugo"
|
74
|
+
sh "aws --profile chef-cd s3 sync docs/public s3://test-kitchen-legacy.cd.chef.co --delete --acl public-read"
|
75
|
+
sh "aws --profile chef-cd cloudfront create-invalidation --distribution-id EQD8MRW086SRT --paths '/*'"
|
76
|
+
end
|
77
|
+
end
|
data/lib/kitchen/driver.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
-
require "
|
19
|
+
require "kitchen/plugin"
|
20
20
|
|
21
21
|
module Kitchen
|
22
22
|
# A driver is responsible for carrying out the lifecycle activities of an
|
@@ -35,20 +35,7 @@ module Kitchen
|
|
35
35
|
# @raise [ClientError] if a driver instance could not be created
|
36
36
|
# @raise [UserError] if the driver's dependencies could not be met
|
37
37
|
def self.for_plugin(plugin, config)
|
38
|
-
|
39
|
-
|
40
|
-
str_const = Thor::Util.camel_case(plugin)
|
41
|
-
klass = const_get(str_const)
|
42
|
-
object = klass.new(config)
|
43
|
-
object.verify_dependencies if first_load
|
44
|
-
object
|
45
|
-
rescue UserError
|
46
|
-
raise
|
47
|
-
rescue LoadError, NameError
|
48
|
-
raise ClientError,
|
49
|
-
"Could not load the '#{plugin}' driver from the load path." \
|
50
|
-
" Please ensure that your driver is installed as a gem or included" \
|
51
|
-
" in your Gemfile if using Bundler."
|
38
|
+
Kitchen::Plugin.load(self, plugin, config)
|
52
39
|
end
|
53
40
|
end
|
54
41
|
end
|
data/lib/kitchen/driver/base.rb
CHANGED
@@ -16,7 +16,10 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
+
require "kitchen/configurable"
|
20
|
+
require "kitchen/errors"
|
19
21
|
require "kitchen/lazy_hash"
|
22
|
+
require "kitchen/logging"
|
20
23
|
require "kitchen/shell_out"
|
21
24
|
|
22
25
|
module Kitchen
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2012, Fletcher Nichol
|
6
|
+
# Copyright (C) 2018, Chef Software
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
|
20
|
+
require "kitchen/errors"
|
21
|
+
require "kitchen/util"
|
22
|
+
|
23
|
+
module Kitchen
|
24
|
+
module Plugin
|
25
|
+
# Returns an instance of a plugin given a type, name, and config.
|
26
|
+
#
|
27
|
+
# @param type [Module] a Kitchen::<Module> of one of the plugin types
|
28
|
+
# (Driver, Provisioner, Transport, Verifier)
|
29
|
+
# @param plugin [String] a plugin name, which will be constantized
|
30
|
+
# @param config [Hash] a configuration hash to initialize the plugin
|
31
|
+
# @return [Kitchen::<Module>::Base] a plugin instance
|
32
|
+
# @raise [ClientError] if a plugin instance could not be created
|
33
|
+
# @raise [UserError] if the plugin's dependencies could not be met
|
34
|
+
def self.load(type, plugin, config)
|
35
|
+
type_name = Kitchen::Util.snake_case(type.name.split("::").last)
|
36
|
+
first_load = require("kitchen/#{type_name}/#{plugin}")
|
37
|
+
|
38
|
+
str_const = Kitchen::Util.camel_case(plugin)
|
39
|
+
klass = type.const_get(str_const)
|
40
|
+
object = klass.new(config)
|
41
|
+
object.verify_dependencies if first_load
|
42
|
+
object
|
43
|
+
rescue UserError
|
44
|
+
raise
|
45
|
+
rescue NameError => e
|
46
|
+
raise ClientError, "Could not load the '#{plugin}' #{type_name}. Error: #{e.message}"
|
47
|
+
rescue LoadError => e
|
48
|
+
available_plugins = plugins_available(type_name)
|
49
|
+
error_message = if available_plugins.include?(plugin)
|
50
|
+
e.message
|
51
|
+
else
|
52
|
+
" Did you mean: #{available_plugins.join(", ")} ?" \
|
53
|
+
" Please ensure that your #{type_name} is installed as a gem or included" \
|
54
|
+
" in your Gemfile if using Bundler."
|
55
|
+
end
|
56
|
+
raise ClientError, "Could not load the '#{plugin}' #{type_name} from the load path." + error_message
|
57
|
+
end
|
58
|
+
|
59
|
+
# given a type of plugin, searches the Ruby load path for plugins of that
|
60
|
+
# type based on the path+naming convention that plugin loading is based upon
|
61
|
+
#
|
62
|
+
# @param plugin_type [String] the name of a plugin type (e.g. driver,
|
63
|
+
# provisioner, transport, verifier)
|
64
|
+
# @return [Array<String>] a collection of Ruby filenames that are probably
|
65
|
+
# plugins of the given type
|
66
|
+
def self.plugins_available(plugin_type)
|
67
|
+
$LOAD_PATH.map { |load_path| Dir[File.expand_path("kitchen/#{plugin_type}/*.rb", load_path)] }
|
68
|
+
.reject { |plugin_paths| plugin_paths.empty? }
|
69
|
+
.flatten
|
70
|
+
.uniq
|
71
|
+
.select { |plugin_path| File.readlines(plugin_path).grep(/^\s*class \w* </).any? }
|
72
|
+
.map { |plugin_path| File.basename(plugin_path).gsub(/\.rb$/, "") }
|
73
|
+
.reject { |plugin_name| plugin_name == "base" }
|
74
|
+
.sort
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/kitchen/provisioner.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
-
require "
|
19
|
+
require "kitchen/plugin"
|
20
20
|
|
21
21
|
module Kitchen
|
22
22
|
# A provisioner is responsible for generating the commands necessary to
|
@@ -35,18 +35,7 @@ module Kitchen
|
|
35
35
|
# @return [Provisioner::Base] a provisioner instance
|
36
36
|
# @raise [ClientError] if a provisioner instance could not be created
|
37
37
|
def self.for_plugin(plugin, config)
|
38
|
-
|
39
|
-
|
40
|
-
str_const = Thor::Util.camel_case(plugin)
|
41
|
-
klass = const_get(str_const)
|
42
|
-
object = klass.new(config)
|
43
|
-
object.verify_dependencies if first_load
|
44
|
-
object
|
45
|
-
rescue LoadError, NameError
|
46
|
-
raise ClientError,
|
47
|
-
"Could not load the '#{plugin}' provisioner from the load path." \
|
48
|
-
" Please ensure that your provisioner is installed as a gem or" \
|
49
|
-
" included in your Gemfile if using Bundler."
|
38
|
+
Kitchen::Plugin.load(self, plugin, config)
|
50
39
|
end
|
51
40
|
end
|
52
41
|
end
|
@@ -16,6 +16,10 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
+
require "kitchen/configurable"
|
20
|
+
require "kitchen/errors"
|
21
|
+
require "kitchen/logging"
|
22
|
+
|
19
23
|
module Kitchen
|
20
24
|
module Provisioner
|
21
25
|
# Base class for a provisioner.
|
data/lib/kitchen/transport.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
-
require "
|
19
|
+
require "kitchen/plugin"
|
20
20
|
|
21
21
|
module Kitchen
|
22
22
|
# A transport is responsible for the communication with an instance,
|
@@ -35,18 +35,7 @@ module Kitchen
|
|
35
35
|
# @return [Transport::Base] a transport instance
|
36
36
|
# @raise [ClientError] if a transport instance could not be created
|
37
37
|
def self.for_plugin(plugin, config)
|
38
|
-
|
39
|
-
|
40
|
-
str_const = Thor::Util.camel_case(plugin)
|
41
|
-
klass = const_get(str_const)
|
42
|
-
object = klass.new(config)
|
43
|
-
object.verify_dependencies if first_load
|
44
|
-
object
|
45
|
-
rescue LoadError, NameError
|
46
|
-
raise ClientError,
|
47
|
-
"Could not load the '#{plugin}' transport from the load path." \
|
48
|
-
" Please ensure that your transport is installed as a gem or" \
|
49
|
-
" included in your Gemfile if using Bundler."
|
38
|
+
Kitchen::Plugin.load(self, plugin, config)
|
50
39
|
end
|
51
40
|
end
|
52
41
|
end
|
@@ -17,8 +17,10 @@
|
|
17
17
|
# See the License for the specific language governing permissions and
|
18
18
|
# limitations under the License.
|
19
19
|
|
20
|
+
require "kitchen/configurable"
|
20
21
|
require "kitchen/errors"
|
21
22
|
require "kitchen/lazy_hash"
|
23
|
+
require "kitchen/logging"
|
22
24
|
require "kitchen/login_command"
|
23
25
|
|
24
26
|
module Kitchen
|
data/lib/kitchen/util.rb
CHANGED
@@ -16,6 +16,9 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
+
require "kitchen/errors"
|
20
|
+
require "thor/util"
|
21
|
+
|
19
22
|
module Kitchen
|
20
23
|
# Stateless utility methods used in different contexts. Essentially a mini
|
21
24
|
# PassiveSupport library.
|
@@ -205,5 +208,13 @@ module Kitchen
|
|
205
208
|
end
|
206
209
|
end
|
207
210
|
end
|
211
|
+
|
212
|
+
def self.camel_case(a_string)
|
213
|
+
Thor::Util.camel_case(a_string)
|
214
|
+
end
|
215
|
+
|
216
|
+
def self.snake_case(a_string)
|
217
|
+
Thor::Util.snake_case(a_string)
|
218
|
+
end
|
208
219
|
end
|
209
220
|
end
|
data/lib/kitchen/verifier.rb
CHANGED
@@ -16,9 +16,7 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
-
require "
|
20
|
-
|
21
|
-
require "kitchen/errors"
|
19
|
+
require "kitchen/plugin"
|
22
20
|
|
23
21
|
module Kitchen
|
24
22
|
# A verifier is responsible for running tests post-converge to confirm that
|
@@ -36,18 +34,7 @@ module Kitchen
|
|
36
34
|
# @return [Verifier::Base] a verifier instance
|
37
35
|
# @raise [ClientError] if a verifier instance could not be created
|
38
36
|
def self.for_plugin(plugin, config)
|
39
|
-
|
40
|
-
|
41
|
-
str_const = Thor::Util.camel_case(plugin)
|
42
|
-
klass = const_get(str_const)
|
43
|
-
object = klass.new(config)
|
44
|
-
object.verify_dependencies if first_load
|
45
|
-
object
|
46
|
-
rescue LoadError, NameError
|
47
|
-
raise ClientError,
|
48
|
-
"Could not load the '#{plugin}' verifier from the load path." \
|
49
|
-
" Please ensure that your transport is installed as a gem or" \
|
50
|
-
" included in your Gemfile if using Bundler."
|
37
|
+
Kitchen::Plugin.load(self, plugin, config)
|
51
38
|
end
|
52
39
|
end
|
53
40
|
end
|
data/lib/kitchen/version.rb
CHANGED
data/test-kitchen.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.homepage = "https://kitchen.ci/"
|
18
18
|
|
19
19
|
# The gemfile and gemspec are necessary for appbundler in Chef-DK / Workstation
|
20
|
-
gem.files = %w{LICENSE test-kitchen.gemspec Gemfile} + Dir.glob("{bin,lib,templates,support}/**/*")
|
20
|
+
gem.files = %w{LICENSE test-kitchen.gemspec Gemfile Rakefile} + Dir.glob("{bin,lib,templates,support}/**/*")
|
21
21
|
gem.executables = %w{kitchen}
|
22
22
|
gem.require_paths = ["lib"]
|
23
23
|
|
@@ -34,7 +34,6 @@ Gem::Specification.new do |gem|
|
|
34
34
|
gem.add_dependency "winrm-fs", "~> 1.1"
|
35
35
|
|
36
36
|
gem.add_development_dependency "rb-readline"
|
37
|
-
gem.add_development_dependency "overcommit", "= 0.33.0"
|
38
37
|
|
39
38
|
gem.add_development_dependency "bundler"
|
40
39
|
gem.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-kitchen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fletcher Nichol
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -162,20 +162,6 @@ dependencies:
|
|
162
162
|
- - ">="
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '0'
|
165
|
-
- !ruby/object:Gem::Dependency
|
166
|
-
name: overcommit
|
167
|
-
requirement: !ruby/object:Gem::Requirement
|
168
|
-
requirements:
|
169
|
-
- - '='
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
version: 0.33.0
|
172
|
-
type: :development
|
173
|
-
prerelease: false
|
174
|
-
version_requirements: !ruby/object:Gem::Requirement
|
175
|
-
requirements:
|
176
|
-
- - '='
|
177
|
-
- !ruby/object:Gem::Version
|
178
|
-
version: 0.33.0
|
179
165
|
- !ruby/object:Gem::Dependency
|
180
166
|
name: bundler
|
181
167
|
requirement: !ruby/object:Gem::Requirement
|
@@ -319,6 +305,7 @@ extra_rdoc_files: []
|
|
319
305
|
files:
|
320
306
|
- Gemfile
|
321
307
|
- LICENSE
|
308
|
+
- Rakefile
|
322
309
|
- bin/kitchen
|
323
310
|
- lib/kitchen.rb
|
324
311
|
- lib/kitchen/base64_stream.rb
|
@@ -357,6 +344,7 @@ files:
|
|
357
344
|
- lib/kitchen/login_command.rb
|
358
345
|
- lib/kitchen/metadata_chopper.rb
|
359
346
|
- lib/kitchen/platform.rb
|
347
|
+
- lib/kitchen/plugin.rb
|
360
348
|
- lib/kitchen/provisioner.rb
|
361
349
|
- lib/kitchen/provisioner/base.rb
|
362
350
|
- lib/kitchen/provisioner/chef/berkshelf.rb
|