test-kitchen 1.23.3 → 1.23.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kitchen/version.rb +1 -1
- data/support/chef-client-zero.rb +1 -1
- metadata +5 -324
- data/.gitattributes +0 -3
- data/.github/ISSUE_TEMPLATE.md +0 -56
- data/.github/lock.yml +0 -1
- data/.gitignore +0 -38
- data/.gitmodules +0 -0
- data/.kitchen.appveyor.yml +0 -25
- data/.kitchen.dokken.yml +0 -31
- data/.kitchen.proxy.yml +0 -27
- data/.rubocop.yml +0 -5
- data/.travis.yml +0 -57
- data/.yardopts +0 -3
- data/Berksfile +0 -3
- data/CHANGELOG.md +0 -1510
- data/CONTRIBUTING.md +0 -14
- data/ECOSYSTEM.md +0 -93
- data/Gemfile +0 -40
- data/Gemfile.proxy_tests +0 -4
- data/Guardfile +0 -42
- data/MAINTAINERS.md +0 -29
- data/README.md +0 -138
- data/RELEASE_NOTES.md +0 -167
- data/Rakefile +0 -77
- data/appveyor.yml +0 -47
- data/docs/CONTRIBUTING.md +0 -8
- data/docs/LICENSE +0 -22
- data/docs/README.md +0 -78
- data/docs/archetypes/default.md +0 -6
- data/docs/config.toml +0 -36
- data/docs/content/docs/_index.md +0 -5
- data/docs/content/docs/drivers/_index.md +0 -27
- data/docs/content/docs/drivers/azurerm.md +0 -44
- data/docs/content/docs/drivers/vagrant.md +0 -39
- data/docs/content/docs/getting-started/00-introduction.md +0 -14
- data/docs/content/docs/getting-started/01-installing.md +0 -64
- data/docs/content/docs/getting-started/02-getting-help.md +0 -59
- data/docs/content/docs/getting-started/03-creating-cookbook.md +0 -46
- data/docs/content/docs/getting-started/04-kitchen-yml.md +0 -56
- data/docs/content/docs/getting-started/05-instances.md +0 -79
- data/docs/content/docs/getting-started/06-writing-recipe.md +0 -21
- data/docs/content/docs/getting-started/07-running-converge.md +0 -134
- data/docs/content/docs/getting-started/08-manually-verifying.md +0 -55
- data/docs/content/docs/getting-started/09-writing-test.md +0 -49
- data/docs/content/docs/getting-started/10-running-verify.md +0 -120
- data/docs/content/docs/getting-started/11-running-test.md +0 -168
- data/docs/content/docs/getting-started/12-adding-platform.md +0 -206
- data/docs/content/docs/getting-started/13-adding-feature.md +0 -30
- data/docs/content/docs/getting-started/14-adding-suite.md +0 -60
- data/docs/content/docs/getting-started/15-adding-test.md +0 -66
- data/docs/content/docs/getting-started/16-adding-recipe.md +0 -53
- data/docs/content/docs/getting-started/17-excluding-platforms.md +0 -101
- data/docs/content/docs/getting-started/18-next-steps.md +0 -23
- data/docs/content/docs/getting-started/_index.md +0 -5
- data/docs/content/docs/provisioners/_index.md +0 -36
- data/docs/content/docs/provisioners/chef.md +0 -69
- data/docs/content/docs/provisioners/shell.md +0 -31
- data/docs/content/docs/reference/_index.md +0 -5
- data/docs/content/docs/reference/configuration.md +0 -53
- data/docs/content/docs/reference/examples.md +0 -97
- data/docs/content/docs/reference/faq.md +0 -58
- data/docs/content/docs/reference/fixtures.md +0 -32
- data/docs/content/docs/reference/glossary.md +0 -34
- data/docs/content/docs/reference/lifecycle-hooks.md +0 -68
- data/docs/content/docs/reference/reboots.md +0 -24
- data/docs/content/docs/verifiers/_index.md +0 -14
- data/docs/content/docs/verifiers/inspec.md +0 -44
- data/docs/content/docs/verifiers/serverspec.md +0 -20
- data/docs/static/images/chef-logo.png +0 -0
- data/docs/static/images/chef-logo.svg +0 -1
- data/docs/static/images/github-banner.png +0 -0
- data/docs/static/images/github-banner.svg +0 -71
- data/docs/static/images/kitchen-logo.png +0 -0
- data/docs/static/images/logo-block.svg +0 -222
- data/docs/static/images/logo.png +0 -0
- data/docs/static/images/logos-group.png +0 -0
- data/docs/static/images/terminal-1.png +0 -0
- data/docs/static/images/terminal-1.svg +0 -589
- data/docs/static/images/terminal-2.png +0 -0
- data/docs/static/images/terminal-2.svg +0 -235
- data/docs/static/images/terminal-3.png +0 -0
- data/docs/static/images/terminal-3.svg +0 -439
- data/docs/static/index.html +0 -59
- data/docs/static/javascripts/all.js +0 -348
- data/docs/static/javascripts/vendor/foundation.min.js +0 -4
- data/docs/static/javascripts/vendor/jquery.min.js +0 -5
- data/docs/static/javascripts/vendor/what-input.js +0 -336
- data/docs/static/stylesheets/site.css +0 -4667
- data/docs/themes/kitchen/layouts/_default/baseof.html +0 -53
- data/docs/themes/kitchen/layouts/_default/list.html +0 -4
- data/docs/themes/kitchen/layouts/_default/redirect.html +0 -10
- data/docs/themes/kitchen/layouts/_default/single.html +0 -6
- data/docs/themes/kitchen/layouts/partials/core/head.html +0 -6
- data/docs/themes/kitchen/layouts/partials/kitchen/footer.html +0 -18
- data/docs/themes/kitchen/layouts/partials/kitchen/head.html +0 -4
- data/docs/themes/kitchen/layouts/partials/kitchen/header.html +0 -26
- data/docs/themes/kitchen/layouts/partials/search-docs.html +0 -3
- data/docs/themes/kitchen/layouts/partials/sidebar.html +0 -33
- data/docs/themes/kitchen/layouts/shortcodes/button.html +0 -1
- data/docs/themes/kitchen/layouts/shortcodes/codeblock.html +0 -8
- data/docs/themes/kitchen/layouts/shortcodes/cta.html +0 -5
- data/docs/themes/kitchen/layouts/shortcodes/danger.html +0 -1
- data/docs/themes/kitchen/layouts/shortcodes/example_fqdn.html +0 -1
- data/docs/themes/kitchen/layouts/shortcodes/info.html +0 -1
- data/docs/themes/kitchen/layouts/shortcodes/ol-styled.html +0 -3
- data/docs/themes/kitchen/layouts/shortcodes/success.html +0 -1
- data/docs/themes/kitchen/layouts/shortcodes/tip.html +0 -1
- data/docs/themes/kitchen/layouts/shortcodes/warning.html +0 -1
- data/docs/themes/kitchen/static/css/kitchen.css +0 -10
- data/docs/themes/kitchen/static/css/kitchen.css.map +0 -7
- data/docs/themes/kitchen/static/fonts/Muli-Bold.ttf +0 -0
- data/docs/themes/kitchen/static/fonts/Muli-Regular.ttf +0 -0
- data/docs/themes/kitchen/static/fonts/Muli-SemiBold.ttf +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-brands-400.eot +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-brands-400.svg +0 -1104
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-brands-400.ttf +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-brands-400.woff +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-brands-400.woff2 +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-regular-400.eot +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-regular-400.svg +0 -372
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-regular-400.ttf +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-regular-400.woff +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-regular-400.woff2 +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-solid-900.eot +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-solid-900.svg +0 -1896
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-solid-900.ttf +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-solid-900.woff +0 -0
- data/docs/themes/kitchen/static/fonts/fontawesome/fa-solid-900.woff2 +0 -0
- data/docs/themes/kitchen/static/images/chef-logo-light.svg +0 -36
- data/docs/themes/kitchen/static/images/chef-logo-white.svg +0 -38
- data/docs/themes/kitchen/static/images/chef-logo.svg +0 -37
- data/docs/themes/kitchen/static/images/favicon.ico +0 -0
- data/docs/themes/kitchen/static/js/scripts-all.js +0 -7
- data/docs/themes/kitchen/static/js/source/chef-hugo.js +0 -116
- data/docs/themes/kitchen/static/js/source/omnitruck.js +0 -82
- data/docs/themes/kitchen/static/js/source/segment.js +0 -52
- data/docs/themes/kitchen/static/sass/_buttons.scss +0 -161
- data/docs/themes/kitchen/static/sass/_core.scss +0 -24
- data/docs/themes/kitchen/static/sass/_forms.scss +0 -14
- data/docs/themes/kitchen/static/sass/_mixins.scss +0 -133
- data/docs/themes/kitchen/static/sass/_typography.scss +0 -34
- data/docs/themes/kitchen/static/sass/_variables.scss +0 -82
- data/docs/themes/kitchen/static/sass/kitchen.scss +0 -7
- data/docs/themes/kitchen/static/sass/kitchen/_footer.scss +0 -50
- data/docs/themes/kitchen/static/sass/kitchen/_header.scss +0 -187
- data/docs/themes/kitchen/static/sass/kitchen/_homepage.scss +0 -27
- data/docs/themes/kitchen/static/sass/kitchen/_utility-bar.scss +0 -173
- data/docs/themes/kitchen/static/sass/partials/_alerts.scss +0 -32
- data/docs/themes/kitchen/static/sass/partials/_bg.scss +0 -19
- data/docs/themes/kitchen/static/sass/partials/_blurbs.scss +0 -25
- data/docs/themes/kitchen/static/sass/partials/_callout.scss +0 -15
- data/docs/themes/kitchen/static/sass/partials/_cards.scss +0 -54
- data/docs/themes/kitchen/static/sass/partials/_dropdown.scss +0 -77
- data/docs/themes/kitchen/static/sass/partials/_grid.scss +0 -87
- data/docs/themes/kitchen/static/sass/partials/_padding.scss +0 -73
- data/docs/themes/kitchen/static/sass/partials/_sidebar.scss +0 -71
- data/docs/themes/kitchen/static/sass/partials/_tabs.scss +0 -125
- data/docs/themes/kitchen/static/sass/typography/_chroma.scss +0 -366
- data/docs/themes/kitchen/static/sass/typography/_code.scss +0 -72
- data/docs/themes/kitchen/static/sass/typography/_headers.scss +0 -90
- data/docs/themes/kitchen/static/sass/typography/_links.scss +0 -127
- data/docs/themes/kitchen/static/sass/typography/_lists.scss +0 -155
- data/docs/themes/kitchen/static/sass/typography/_prose.scss +0 -29
- data/docs/themes/kitchen/static/sass/typography/_text.scss +0 -221
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_animated.scss +0 -20
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_bordered-pulled.scss +0 -20
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_core.scss +0 -16
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_fixed-width.scss +0 -6
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_icons.scss +0 -992
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_larger.scss +0 -23
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_list.scss +0 -18
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_mixins.scss +0 -57
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_rotated-flipped.scss +0 -23
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_screen-reader.scss +0 -5
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_stacked.scss +0 -31
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/_variables.scss +0 -1005
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/fa-brands.scss +0 -21
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/fa-regular.scss +0 -22
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/fa-solid.scss +0 -23
- data/docs/themes/kitchen/static/sass/vendor/fontawesome/fontawesome.scss +0 -16
- data/docs/themes/kitchen/theme.toml +0 -8
- data/features/kitchen_action_commands.feature +0 -164
- data/features/kitchen_command.feature +0 -16
- data/features/kitchen_console_command.feature +0 -35
- data/features/kitchen_defaults.feature +0 -38
- data/features/kitchen_diagnose_command.feature +0 -96
- data/features/kitchen_help_command.feature +0 -16
- data/features/kitchen_init_command.feature +0 -254
- data/features/kitchen_list_command.feature +0 -140
- data/features/kitchen_login_command.feature +0 -62
- data/features/kitchen_sink_command.feature +0 -30
- data/features/kitchen_test_command.feature +0 -88
- data/features/step_definitions/gem_steps.rb +0 -24
- data/features/step_definitions/git_steps.rb +0 -5
- data/features/step_definitions/output_steps.rb +0 -5
- data/features/support/env.rb +0 -74
- data/spec/kitchen/base64_stream_spec.rb +0 -74
- data/spec/kitchen/cli_spec.rb +0 -54
- data/spec/kitchen/collection_spec.rb +0 -76
- data/spec/kitchen/color_spec.rb +0 -51
- data/spec/kitchen/config_spec.rb +0 -434
- data/spec/kitchen/configurable_spec.rb +0 -1113
- data/spec/kitchen/data_munger_spec.rb +0 -2800
- data/spec/kitchen/diagnostic_spec.rb +0 -128
- data/spec/kitchen/driver/base_spec.rb +0 -132
- data/spec/kitchen/driver/dummy_spec.rb +0 -193
- data/spec/kitchen/driver/exec_spec.rb +0 -75
- data/spec/kitchen/driver/proxy_spec.rb +0 -127
- data/spec/kitchen/driver/ssh_base_spec.rb +0 -1136
- data/spec/kitchen/driver_spec.rb +0 -106
- data/spec/kitchen/errors_spec.rb +0 -317
- data/spec/kitchen/instance_spec.rb +0 -1372
- data/spec/kitchen/lazy_hash_spec.rb +0 -113
- data/spec/kitchen/lifecycle_hooks_spec.rb +0 -171
- data/spec/kitchen/loader/yaml_spec.rb +0 -787
- data/spec/kitchen/logger_spec.rb +0 -425
- data/spec/kitchen/logging_spec.rb +0 -56
- data/spec/kitchen/login_command_spec.rb +0 -67
- data/spec/kitchen/metadata_chopper_spec.rb +0 -79
- data/spec/kitchen/platform_spec.rb +0 -88
- data/spec/kitchen/provisioner/base_spec.rb +0 -393
- data/spec/kitchen/provisioner/chef/policyfile_spec.rb +0 -140
- data/spec/kitchen/provisioner/chef_apply_spec.rb +0 -131
- data/spec/kitchen/provisioner/chef_base_spec.rb +0 -1565
- data/spec/kitchen/provisioner/chef_solo_spec.rb +0 -602
- data/spec/kitchen/provisioner/chef_zero_spec.rb +0 -1013
- data/spec/kitchen/provisioner/dummy_spec.rb +0 -96
- data/spec/kitchen/provisioner/shell_spec.rb +0 -623
- data/spec/kitchen/provisioner_spec.rb +0 -101
- data/spec/kitchen/shell_out_spec.rb +0 -146
- data/spec/kitchen/ssh_spec.rb +0 -584
- data/spec/kitchen/state_file_spec.rb +0 -122
- data/spec/kitchen/suite_spec.rb +0 -61
- data/spec/kitchen/transport/base_spec.rb +0 -140
- data/spec/kitchen/transport/exec_spec.rb +0 -79
- data/spec/kitchen/transport/ssh_spec.rb +0 -1317
- data/spec/kitchen/transport/winrm_spec.rb +0 -1320
- data/spec/kitchen/transport_spec.rb +0 -106
- data/spec/kitchen/util_spec.rb +0 -250
- data/spec/kitchen/verifier/base_spec.rb +0 -346
- data/spec/kitchen/verifier/busser_spec.rb +0 -580
- data/spec/kitchen/verifier/dummy_spec.rb +0 -96
- data/spec/kitchen/verifier/shell_spec.rb +0 -157
- data/spec/kitchen/verifier_spec.rb +0 -114
- data/spec/kitchen_spec.rb +0 -112
- data/spec/spec_helper.rb +0 -110
- data/spec/support/powershell_max_size_spec.rb +0 -39
- data/test-kitchen.gemspec +0 -49
- data/test/cookbooks/test_cookbook/metadata.rb +0 -6
- data/test/cookbooks/test_cookbook/recipes/default.rb +0 -1
- data/test/integration/default/default_spec.rb +0 -3
- data/testing_windows.md +0 -38
@@ -1,67 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
|
-
#
|
5
|
-
# Copyright (C) 2014, Fletcher Nichol
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
|
19
|
-
require_relative "../spec_helper"
|
20
|
-
|
21
|
-
require "kitchen/login_command"
|
22
|
-
|
23
|
-
describe Kitchen::LoginCommand do
|
24
|
-
let(:cmd) { "" }
|
25
|
-
let(:argv) { [] }
|
26
|
-
let(:opts) { Hash.new }
|
27
|
-
|
28
|
-
let(:login_command) { Kitchen::LoginCommand.new(cmd, argv, opts) }
|
29
|
-
|
30
|
-
it "#command returns the command" do
|
31
|
-
cmd << "one"
|
32
|
-
|
33
|
-
login_command.command.must_equal "one"
|
34
|
-
end
|
35
|
-
|
36
|
-
it "#arguments defaults to an empty array" do
|
37
|
-
Kitchen::LoginCommand.new("echo", nil).arguments.must_equal []
|
38
|
-
end
|
39
|
-
|
40
|
-
it "#arguments returns the command arguments" do
|
41
|
-
argv.concat(["-o", "two"])
|
42
|
-
|
43
|
-
login_command.arguments.must_equal ["-o", "two"]
|
44
|
-
end
|
45
|
-
|
46
|
-
it "#options defaults to an empty hash" do
|
47
|
-
Kitchen::LoginCommand.new(cmd, argv).options.must_equal Hash.new
|
48
|
-
end
|
49
|
-
|
50
|
-
it "#options returns the options hash from the constructor" do
|
51
|
-
opts[:cake] = "yummy"
|
52
|
-
|
53
|
-
login_command.options.must_equal(cake: "yummy")
|
54
|
-
end
|
55
|
-
|
56
|
-
it "#exec_args returns an array of arguments for Kernel.exec" do
|
57
|
-
cmd << "alpha"
|
58
|
-
login_command.exec_args.must_equal ["alpha", {}]
|
59
|
-
|
60
|
-
argv.concat(["-o", "beta"])
|
61
|
-
login_command.exec_args.must_equal ["alpha", "-o", "beta", {}]
|
62
|
-
|
63
|
-
opts[:charlie] = "delta"
|
64
|
-
login_command.exec_args.must_equal [
|
65
|
-
"alpha", "-o", "beta", { charlie: "delta" }]
|
66
|
-
end
|
67
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
|
-
#
|
5
|
-
# Copyright (C) 2014, Fletcher Nichol
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
|
19
|
-
require_relative "../spec_helper"
|
20
|
-
|
21
|
-
require "kitchen/metadata_chopper"
|
22
|
-
|
23
|
-
describe Kitchen::MetadataChopper do
|
24
|
-
before do
|
25
|
-
FakeFS.activate!
|
26
|
-
FileUtils.mkdir_p("/tmp")
|
27
|
-
end
|
28
|
-
|
29
|
-
after do
|
30
|
-
FakeFS.deactivate!
|
31
|
-
FakeFS::FileSystem.clear
|
32
|
-
end
|
33
|
-
|
34
|
-
let(:described_class) { Kitchen::MetadataChopper }
|
35
|
-
|
36
|
-
describe ".new" do
|
37
|
-
it "contains a :name attribute" do
|
38
|
-
stub_metadata!("banzai")
|
39
|
-
|
40
|
-
described_class.new("/tmp/metadata.rb")[:name].must_equal "banzai"
|
41
|
-
end
|
42
|
-
|
43
|
-
it "contains a :version attribute" do
|
44
|
-
stub_metadata!("foobar", "1.2.3")
|
45
|
-
|
46
|
-
described_class.new("/tmp/metadata.rb")[:version].must_equal "1.2.3"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe ".extract" do
|
51
|
-
it "returns a tuple" do
|
52
|
-
stub_metadata!("foo", "1.2.3")
|
53
|
-
|
54
|
-
described_class.extract("/tmp/metadata.rb").must_equal ["foo", "1.2.3"]
|
55
|
-
end
|
56
|
-
|
57
|
-
it "returns nils for a name or version that isn't present" do
|
58
|
-
File.open("/tmp/metadata.rb", "wb") do |f|
|
59
|
-
f.write %{maintainer "Michael Bluth"\n}
|
60
|
-
end
|
61
|
-
|
62
|
-
described_class.extract("/tmp/metadata.rb").must_equal [nil, nil]
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def stub_metadata!(name = "foobar", version = "5.2.1")
|
67
|
-
File.open("/tmp/metadata.rb", "wb") do |f|
|
68
|
-
f.write <<-METADATA_RB.gsub(/^ {8}/, "")
|
69
|
-
name "#{name}"
|
70
|
-
maintainer "Michael Bluth"
|
71
|
-
maintainer_email "michael@bluth.com"
|
72
|
-
license "Apache 2.0"
|
73
|
-
description "Doing stuff!"
|
74
|
-
long_description "Doing stuff!"
|
75
|
-
version "#{version}"
|
76
|
-
METADATA_RB
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
|
-
#
|
5
|
-
# Copyright (C) 2012, Fletcher Nichol
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
|
19
|
-
require_relative "../spec_helper"
|
20
|
-
|
21
|
-
require "kitchen/errors"
|
22
|
-
require "kitchen/platform"
|
23
|
-
|
24
|
-
describe Kitchen::Platform do
|
25
|
-
let(:opts) { ; { name: "plata" }; }
|
26
|
-
let(:klass) { Kitchen::Platform }
|
27
|
-
|
28
|
-
it "raises an ArgumentError if name is missing" do
|
29
|
-
opts.delete(:name)
|
30
|
-
proc { klass.new(opts) }.must_raise Kitchen::ClientError
|
31
|
-
end
|
32
|
-
|
33
|
-
it "#os_type returns value passed into constructor with :os_type" do
|
34
|
-
klass.new(name: "p", os_type: "unix").os_type.must_equal "unix"
|
35
|
-
klass.new(name: "p", os_type: "windows").os_type.must_equal "windows"
|
36
|
-
klass.new(name: "p", os_type: "unicorn").os_type.must_equal "unicorn"
|
37
|
-
klass.new(name: "p", os_type: nil).os_type.must_be_nil
|
38
|
-
end
|
39
|
-
|
40
|
-
it "#os_type defaults to `unix` when not provided" do
|
41
|
-
klass.new(name: "p").os_type.must_equal "unix"
|
42
|
-
end
|
43
|
-
|
44
|
-
it "#os_type defaults to `windows` if the name starts with 'win'" do
|
45
|
-
klass.new(name: "win").os_type.must_equal "windows"
|
46
|
-
klass.new(name: "Win").os_type.must_equal "windows"
|
47
|
-
klass.new(name: "win7").os_type.must_equal "windows"
|
48
|
-
klass.new(name: "windows").os_type.must_equal "windows"
|
49
|
-
klass.new(name: "Windows").os_type.must_equal "windows"
|
50
|
-
klass.new(name: "windows81").os_type.must_equal "windows"
|
51
|
-
klass.new(name: "windows-2012").os_type.must_equal "windows"
|
52
|
-
end
|
53
|
-
|
54
|
-
it "#shell_type returns value passed into constructor with :shell_type" do
|
55
|
-
klass.new(name: "p", shell_type: "bourne")
|
56
|
-
.shell_type.must_equal "bourne"
|
57
|
-
klass.new(name: "p", shell_type: "powershell")
|
58
|
-
.shell_type.must_equal "powershell"
|
59
|
-
klass.new(name: "p", shell_type: "unicorn")
|
60
|
-
.shell_type.must_equal "unicorn"
|
61
|
-
klass.new(name: "p", shell_type: nil)
|
62
|
-
.shell_type.must_be_nil
|
63
|
-
end
|
64
|
-
|
65
|
-
it "#shell_type defaults to `bourne` when not provided" do
|
66
|
-
klass.new(name: "p").shell_type.must_equal "bourne"
|
67
|
-
end
|
68
|
-
|
69
|
-
it "#shell_type defaults to `powershell` if the name starts with 'windows'" do
|
70
|
-
klass.new(name: "win").shell_type.must_equal "powershell"
|
71
|
-
klass.new(name: "Win").shell_type.must_equal "powershell"
|
72
|
-
klass.new(name: "win7").shell_type.must_equal "powershell"
|
73
|
-
klass.new(name: "windows").shell_type.must_equal "powershell"
|
74
|
-
klass.new(name: "Windows").shell_type.must_equal "powershell"
|
75
|
-
klass.new(name: "windows81").shell_type.must_equal "powershell"
|
76
|
-
klass.new(name: "windows-2012").shell_type.must_equal "powershell"
|
77
|
-
end
|
78
|
-
|
79
|
-
it "#diagnose returns a hash with sorted keys" do
|
80
|
-
opts[:os_type] = "unikitty"
|
81
|
-
opts[:shell_type] = "wundershell"
|
82
|
-
|
83
|
-
klass.new(opts).diagnose.must_equal(
|
84
|
-
os_type: "unikitty",
|
85
|
-
shell_type: "wundershell"
|
86
|
-
)
|
87
|
-
end
|
88
|
-
end
|
@@ -1,393 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
|
-
#
|
5
|
-
# Copyright (C) 2013, Fletcher Nichol
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
|
19
|
-
require_relative "../../spec_helper"
|
20
|
-
require "logger"
|
21
|
-
require "stringio"
|
22
|
-
|
23
|
-
require "kitchen"
|
24
|
-
|
25
|
-
module Kitchen
|
26
|
-
module Provisioner
|
27
|
-
class TestingDummy < Kitchen::Provisioner::Base
|
28
|
-
attr_reader :called_create_sandbox, :called_cleanup_sandbox
|
29
|
-
|
30
|
-
def install_command
|
31
|
-
"install"
|
32
|
-
end
|
33
|
-
|
34
|
-
def init_command
|
35
|
-
"init"
|
36
|
-
end
|
37
|
-
|
38
|
-
def prepare_command
|
39
|
-
"prepare"
|
40
|
-
end
|
41
|
-
|
42
|
-
def run_command
|
43
|
-
"run"
|
44
|
-
end
|
45
|
-
|
46
|
-
def create_sandbox
|
47
|
-
@called_create_sandbox = true
|
48
|
-
end
|
49
|
-
|
50
|
-
def cleanup_sandbox
|
51
|
-
@called_cleanup_sandbox = true
|
52
|
-
end
|
53
|
-
|
54
|
-
def sandbox_path
|
55
|
-
"/tmp/sandbox"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe Kitchen::Provisioner::Base do
|
62
|
-
let(:logged_output) { StringIO.new }
|
63
|
-
let(:logger) { Logger.new(logged_output) }
|
64
|
-
let(:platform) { stub(os_type: nil, shell_type: nil) }
|
65
|
-
let(:config) { Hash.new }
|
66
|
-
|
67
|
-
let(:transport) do
|
68
|
-
t = mock("transport")
|
69
|
-
t.responds_like_instance_of(Kitchen::Transport::Base)
|
70
|
-
t
|
71
|
-
end
|
72
|
-
|
73
|
-
let(:instance) do
|
74
|
-
stub(
|
75
|
-
name: "coolbeans",
|
76
|
-
to_str: "instance",
|
77
|
-
logger: logger,
|
78
|
-
platform: platform,
|
79
|
-
transport: transport
|
80
|
-
)
|
81
|
-
end
|
82
|
-
|
83
|
-
let(:provisioner) do
|
84
|
-
Kitchen::Provisioner::Base.new(config).finalize_config!(instance)
|
85
|
-
end
|
86
|
-
|
87
|
-
describe "configuration" do
|
88
|
-
describe "for unix operating systems" do
|
89
|
-
before { platform.stubs(:os_type).returns("unix") }
|
90
|
-
|
91
|
-
it ":root_path defaults to /tmp/kitchen" do
|
92
|
-
provisioner[:root_path].must_equal "/tmp/kitchen"
|
93
|
-
end
|
94
|
-
|
95
|
-
it ":sudo defaults to true" do
|
96
|
-
provisioner[:sudo].must_equal true
|
97
|
-
end
|
98
|
-
|
99
|
-
it ":sudo_command defaults to sudo -E" do
|
100
|
-
provisioner[:sudo_command].must_equal "sudo -E"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
describe "for windows operating systems" do
|
105
|
-
before { platform.stubs(:os_type).returns("windows") }
|
106
|
-
|
107
|
-
it ':root_path defaults to $env:TEMP\\kitchen' do
|
108
|
-
provisioner[:root_path].must_equal '$env:TEMP\\kitchen'
|
109
|
-
end
|
110
|
-
|
111
|
-
it ":sudo defaults to nil" do
|
112
|
-
provisioner[:sudo].must_be_nil
|
113
|
-
end
|
114
|
-
|
115
|
-
it ":sudo_command defaults to nil" do
|
116
|
-
provisioner[:sudo_command].must_be_nil
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
it ":http_proxy defaults to nil" do
|
121
|
-
provisioner[:http_proxy].must_be_nil
|
122
|
-
end
|
123
|
-
|
124
|
-
it ":http_proxys defaults to nil" do
|
125
|
-
provisioner[:https_proxy].must_be_nil
|
126
|
-
end
|
127
|
-
|
128
|
-
it ":ftp_proxy defaults to nil" do
|
129
|
-
provisioner[:ftp_proxy].must_be_nil
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
describe "#call" do
|
134
|
-
let(:state) { Hash.new }
|
135
|
-
let(:cmd) { provisioner.call(state) }
|
136
|
-
|
137
|
-
let(:connection) do
|
138
|
-
c = mock("transport_connection")
|
139
|
-
c.responds_like_instance_of(Kitchen::Transport::Base::Connection)
|
140
|
-
c
|
141
|
-
end
|
142
|
-
|
143
|
-
let(:provisioner) do
|
144
|
-
Kitchen::Provisioner::TestingDummy.new(config).finalize_config!(instance)
|
145
|
-
end
|
146
|
-
|
147
|
-
before do
|
148
|
-
FakeFS.activate!
|
149
|
-
FileUtils.mkdir_p(File.join(provisioner.sandbox_path, "stuff"))
|
150
|
-
transport.stubs(:connection).yields(connection)
|
151
|
-
connection.stubs(:execute)
|
152
|
-
connection.stubs(:execute_with_retry)
|
153
|
-
connection.stubs(:upload)
|
154
|
-
connection.stubs(:download)
|
155
|
-
config[:downloads] = {
|
156
|
-
["/tmp/kitchen/nodes", "/tmp/kitchen/data_bags"] => "./test/fixtures",
|
157
|
-
"/remote" => "/local",
|
158
|
-
}
|
159
|
-
end
|
160
|
-
|
161
|
-
after do
|
162
|
-
FakeFS.deactivate!
|
163
|
-
FakeFS::FileSystem.clear
|
164
|
-
end
|
165
|
-
|
166
|
-
it "creates the sandbox" do
|
167
|
-
provisioner.expects(:create_sandbox)
|
168
|
-
|
169
|
-
cmd
|
170
|
-
end
|
171
|
-
|
172
|
-
it "ensures that the sandbox is cleanup up" do
|
173
|
-
transport.stubs(:connection).raises
|
174
|
-
provisioner.expects(:cleanup_sandbox)
|
175
|
-
|
176
|
-
begin
|
177
|
-
cmd
|
178
|
-
rescue # rubocop:disable Lint/HandleExceptions
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
it "yields a connection given the state" do
|
183
|
-
state[:a] = "b"
|
184
|
-
transport.expects(:connection).with(state).yields(connection)
|
185
|
-
|
186
|
-
cmd
|
187
|
-
end
|
188
|
-
|
189
|
-
it "invokes the provisioner commands over the transport" do
|
190
|
-
order = sequence("order")
|
191
|
-
connection.expects(:execute).with("install").in_sequence(order)
|
192
|
-
connection.expects(:execute).with("init").in_sequence(order)
|
193
|
-
connection.expects(:execute).with("prepare").in_sequence(order)
|
194
|
-
connection.expects(:execute_with_retry).with("run", [], 1, 30).in_sequence(order)
|
195
|
-
|
196
|
-
cmd
|
197
|
-
end
|
198
|
-
|
199
|
-
it "logs to info" do
|
200
|
-
cmd
|
201
|
-
|
202
|
-
logged_output.string
|
203
|
-
.must_match(/INFO -- : Transferring files to instance$/)
|
204
|
-
logged_output.string
|
205
|
-
.must_match(/INFO -- : Downloading files from instance$/)
|
206
|
-
end
|
207
|
-
|
208
|
-
it "uploads sandbox files" do
|
209
|
-
connection.expects(:upload).with(["/tmp/sandbox/stuff"], "/tmp/kitchen")
|
210
|
-
|
211
|
-
cmd
|
212
|
-
end
|
213
|
-
|
214
|
-
it "logs to debug" do
|
215
|
-
cmd
|
216
|
-
|
217
|
-
logged_output.string.must_match(/DEBUG -- : Transfer complete$/)
|
218
|
-
logged_output.string.must_match(
|
219
|
-
%r{DEBUG -- : Downloading /tmp/kitchen/nodes, /tmp/kitchen/data_bags to ./test/fixtures$}
|
220
|
-
)
|
221
|
-
logged_output.string.must_match(
|
222
|
-
%r{DEBUG -- : Downloading /remote to /local$}
|
223
|
-
)
|
224
|
-
logged_output.string.must_match(/DEBUG -- : Download complete$/)
|
225
|
-
end
|
226
|
-
|
227
|
-
it "downloads files" do
|
228
|
-
connection.expects(:download).with(
|
229
|
-
["/tmp/kitchen/nodes", "/tmp/kitchen/data_bags"],
|
230
|
-
"./test/fixtures"
|
231
|
-
)
|
232
|
-
|
233
|
-
connection.expects(:download).with("/remote", "/local")
|
234
|
-
|
235
|
-
cmd
|
236
|
-
end
|
237
|
-
|
238
|
-
it "raises an ActionFailed on transfer when TransportFailed is raised" do
|
239
|
-
connection.stubs(:upload)
|
240
|
-
.raises(Kitchen::Transport::TransportFailed.new("dang"))
|
241
|
-
|
242
|
-
proc { cmd }.must_raise Kitchen::ActionFailed
|
243
|
-
end
|
244
|
-
|
245
|
-
it "raises an ActionFailed on execute when TransportFailed is raised" do
|
246
|
-
connection.stubs(:execute)
|
247
|
-
.raises(Kitchen::Transport::TransportFailed.new("dang"))
|
248
|
-
|
249
|
-
proc { cmd }.must_raise Kitchen::ActionFailed
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
[:init_command, :install_command, :prepare_command, :run_command].each do |cmd|
|
254
|
-
it "has a #{cmd} method" do
|
255
|
-
provisioner.public_send(cmd).must_be_nil
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
describe "sandbox" do
|
260
|
-
after do
|
261
|
-
begin
|
262
|
-
provisioner.cleanup_sandbox
|
263
|
-
rescue # rubocop:disable Lint/HandleExceptions
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
it "raises ClientError if #sandbox_path is called before #create_sandbox" do
|
268
|
-
proc { provisioner.sandbox_path }.must_raise Kitchen::ClientError
|
269
|
-
end
|
270
|
-
|
271
|
-
it "#create_sandbox creates a temporary directory" do
|
272
|
-
provisioner.create_sandbox
|
273
|
-
|
274
|
-
File.directory?(provisioner.sandbox_path).must_equal true
|
275
|
-
format("%o", File.stat(provisioner.sandbox_path).mode)[1, 4]
|
276
|
-
.must_equal "0755"
|
277
|
-
end
|
278
|
-
|
279
|
-
it "#create_sandbox logs an info message" do
|
280
|
-
provisioner.create_sandbox
|
281
|
-
|
282
|
-
logged_output.string.must_match info_line("Preparing files for transfer")
|
283
|
-
end
|
284
|
-
|
285
|
-
it "#create_sandbox logs a debug message" do
|
286
|
-
provisioner.create_sandbox
|
287
|
-
|
288
|
-
logged_output.string
|
289
|
-
.must_match debug_line_starting_with("Creating local sandbox in ")
|
290
|
-
end
|
291
|
-
|
292
|
-
it "#cleanup_sandbox deletes the sandbox directory" do
|
293
|
-
provisioner.create_sandbox
|
294
|
-
provisioner.cleanup_sandbox
|
295
|
-
|
296
|
-
File.directory?(provisioner.sandbox_path).must_equal false
|
297
|
-
end
|
298
|
-
|
299
|
-
it "#cleanup_sandbox logs a debug message" do
|
300
|
-
provisioner.create_sandbox
|
301
|
-
provisioner.cleanup_sandbox
|
302
|
-
|
303
|
-
logged_output.string
|
304
|
-
.must_match debug_line_starting_with("Cleaning up local sandbox in ")
|
305
|
-
end
|
306
|
-
|
307
|
-
def info_line(msg)
|
308
|
-
/^I, .* : #{Regexp.escape(msg)}$/
|
309
|
-
end
|
310
|
-
|
311
|
-
def debug_line_starting_with(msg)
|
312
|
-
/^D, .* : #{Regexp.escape(msg)}/
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
describe "#sudo" do
|
317
|
-
describe "with :sudo set" do
|
318
|
-
before { config[:sudo] = true }
|
319
|
-
|
320
|
-
it "prepends sudo command" do
|
321
|
-
provisioner.send(:sudo, "wakka").must_equal("sudo -E wakka")
|
322
|
-
end
|
323
|
-
|
324
|
-
it "customizes sudo when :sudo_command is set" do
|
325
|
-
config[:sudo_command] = "blueto -Ohai"
|
326
|
-
|
327
|
-
provisioner.send(:sudo, "wakka").must_equal("blueto -Ohai wakka")
|
328
|
-
end
|
329
|
-
end
|
330
|
-
|
331
|
-
describe "with :sudo falsey" do
|
332
|
-
before { config[:sudo] = false }
|
333
|
-
|
334
|
-
it "does not include sudo command" do
|
335
|
-
provisioner.send(:sudo, "wakka").must_equal("wakka")
|
336
|
-
end
|
337
|
-
|
338
|
-
it "does not include sudo command, even when :sudo_command is set" do
|
339
|
-
config[:sudo_command] = "blueto -Ohai"
|
340
|
-
|
341
|
-
provisioner.send(:sudo, "wakka").must_equal("wakka")
|
342
|
-
end
|
343
|
-
end
|
344
|
-
end
|
345
|
-
|
346
|
-
describe "#sudo_command" do
|
347
|
-
describe "with :sudo set" do
|
348
|
-
before { config[:sudo] = true }
|
349
|
-
|
350
|
-
it "returns the default sudo_command" do
|
351
|
-
provisioner.send(:sudo_command).must_equal("sudo -E")
|
352
|
-
end
|
353
|
-
|
354
|
-
it "returns the custom sudo_command" do
|
355
|
-
config[:sudo_command] = "mysudo"
|
356
|
-
|
357
|
-
provisioner.send(:sudo_command).must_equal("mysudo")
|
358
|
-
end
|
359
|
-
end
|
360
|
-
|
361
|
-
describe "with :sudo falsey" do
|
362
|
-
before { config[:sudo] = false }
|
363
|
-
|
364
|
-
it "returns empty string for default sudo_command" do
|
365
|
-
provisioner.send(:sudo_command).must_equal("")
|
366
|
-
end
|
367
|
-
|
368
|
-
it "returns empty string for custom sudo_command" do
|
369
|
-
config[:sudo_command] = "mysudo"
|
370
|
-
|
371
|
-
provisioner.send(:sudo_command).must_equal("")
|
372
|
-
end
|
373
|
-
end
|
374
|
-
end
|
375
|
-
|
376
|
-
describe "#prefix_command" do
|
377
|
-
describe "with :command_prefix set" do
|
378
|
-
before { config[:command_prefix] = "my_prefix" }
|
379
|
-
|
380
|
-
it "prepends the command with the prefix" do
|
381
|
-
provisioner.send(:prefix_command, "my_command").must_equal("my_prefix my_command")
|
382
|
-
end
|
383
|
-
end
|
384
|
-
|
385
|
-
describe "with :command_prefix unset" do
|
386
|
-
before { config[:command_prefix] = nil }
|
387
|
-
|
388
|
-
it "returns an unaltered command" do
|
389
|
-
provisioner.send(:prefix_command, "my_command").must_equal("my_command")
|
390
|
-
end
|
391
|
-
end
|
392
|
-
end
|
393
|
-
end
|