test-kitchen 1.23.3 → 1.23.4
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/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,96 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
|
4
|
-
#
|
|
5
|
-
# Copyright (C) 2015, 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 "logger"
|
|
22
|
-
require "stringio"
|
|
23
|
-
|
|
24
|
-
require "kitchen/provisioner/dummy"
|
|
25
|
-
|
|
26
|
-
describe Kitchen::Provisioner::Dummy do
|
|
27
|
-
let(:logged_output) { StringIO.new }
|
|
28
|
-
let(:logger) { Logger.new(logged_output) }
|
|
29
|
-
let(:platform) { stub(os_type: nil, shell_type: nil) }
|
|
30
|
-
let(:suite) { stub(name: "fries") }
|
|
31
|
-
let(:state) { Hash.new }
|
|
32
|
-
|
|
33
|
-
let(:config) do
|
|
34
|
-
{ test_base_path: "/basist", kitchen_root: "/rooty" }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
let(:instance) do
|
|
38
|
-
stub(
|
|
39
|
-
name: "coolbeans",
|
|
40
|
-
to_str: "instance",
|
|
41
|
-
logger: logger,
|
|
42
|
-
suite: suite,
|
|
43
|
-
platform: platform
|
|
44
|
-
)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
let(:provisioner) do
|
|
48
|
-
Kitchen::Provisioner::Dummy.new(config).finalize_config!(instance)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
it "provisioner api_version is 2" do
|
|
52
|
-
provisioner.diagnose_plugin[:api_version].must_equal 2
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
it "plugin_version is set to Kitchen::VERSION" do
|
|
56
|
-
provisioner.diagnose_plugin[:version].must_equal Kitchen::VERSION
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
describe "configuration" do
|
|
60
|
-
it "sets :sleep to 0 by default" do
|
|
61
|
-
provisioner[:sleep].must_equal 0
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it "sets :random_failure to false by default" do
|
|
65
|
-
provisioner[:random_failure].must_equal false
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
describe "#call" do
|
|
70
|
-
it "calls sleep if :sleep value is greater than 0" do
|
|
71
|
-
config[:sleep] = 12.5
|
|
72
|
-
provisioner.expects(:sleep).with(12.5).returns(true)
|
|
73
|
-
|
|
74
|
-
provisioner.call(state)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
it "raises ActionFailed if :fail is set" do
|
|
78
|
-
config[:fail] = true
|
|
79
|
-
|
|
80
|
-
proc { provisioner.call(state) }.must_raise Kitchen::ActionFailed
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
it "randomly raises ActionFailed if :random_failure is set" do
|
|
84
|
-
config[:random_failure] = true
|
|
85
|
-
provisioner.stubs(:randomly_fail?).returns(true)
|
|
86
|
-
|
|
87
|
-
proc { provisioner.call(state) }.must_raise Kitchen::ActionFailed
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
it "logs a converge event to INFO" do
|
|
91
|
-
provisioner.call(state)
|
|
92
|
-
|
|
93
|
-
logged_output.string.must_match(/^.+ INFO .+ \[Dummy\] Converge on .+$/)
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
|
@@ -1,623 +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"
|
|
22
|
-
require "kitchen/provisioner/shell"
|
|
23
|
-
|
|
24
|
-
describe Kitchen::Provisioner::Shell do
|
|
25
|
-
let(:logged_output) { StringIO.new }
|
|
26
|
-
let(:logger) { Logger.new(logged_output) }
|
|
27
|
-
let(:platform) { stub(os_type: nil, shell_type: nil) }
|
|
28
|
-
let(:suite) { stub(name: "fries") }
|
|
29
|
-
|
|
30
|
-
let(:config) do
|
|
31
|
-
{ test_base_path: "/basist", kitchen_root: "/rooty" }
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
let(:instance) do
|
|
35
|
-
stub(
|
|
36
|
-
name: "coolbeans",
|
|
37
|
-
logger: logger,
|
|
38
|
-
suite: suite,
|
|
39
|
-
platform: platform
|
|
40
|
-
)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
let(:provisioner) do
|
|
44
|
-
Class.new(Kitchen::Provisioner::Shell) do
|
|
45
|
-
def calculate_path(path, _opts = {})
|
|
46
|
-
"<calculated>/#{path}"
|
|
47
|
-
end
|
|
48
|
-
end.new(config).finalize_config!(instance)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
it "provisioner api_version is 2" do
|
|
52
|
-
provisioner = Kitchen::Provisioner::Shell.new(config).finalize_config!(instance)
|
|
53
|
-
provisioner.diagnose_plugin[:api_version].must_equal 2
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
it "plugin_version is set to Kitchen::VERSION" do
|
|
57
|
-
provisioner = Kitchen::Provisioner::Shell.new(config).finalize_config!(instance)
|
|
58
|
-
provisioner.diagnose_plugin[:version].must_equal Kitchen::VERSION
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe "configuration" do
|
|
62
|
-
describe "for bourne shells" do
|
|
63
|
-
before { platform.stubs(:shell_type).returns("bourne") }
|
|
64
|
-
|
|
65
|
-
it ":script uses calculate_path and is expanded" do
|
|
66
|
-
provisioner[:script].must_equal os_safe_root_path("/rooty/<calculated>/bootstrap.sh")
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
describe "for powershell shells" do
|
|
71
|
-
before { platform.stubs(:shell_type).returns("powershell") }
|
|
72
|
-
|
|
73
|
-
it ":script uses calculate_path and is expanded" do
|
|
74
|
-
provisioner[:script].must_equal os_safe_root_path("/rooty/<calculated>/bootstrap.ps1")
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
it ":data_path uses calculate_path and is expanded" do
|
|
79
|
-
provisioner[:data_path].must_equal os_safe_root_path("/rooty/<calculated>/data")
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
describe "#init_command" do
|
|
84
|
-
let(:cmd) { provisioner.init_command }
|
|
85
|
-
|
|
86
|
-
describe "for bourne shells" do
|
|
87
|
-
before { platform.stubs(:shell_type).returns("bourne") }
|
|
88
|
-
|
|
89
|
-
it "uses bourne shell" do
|
|
90
|
-
cmd.must_match(/\Ash -c '$/)
|
|
91
|
-
cmd.must_match(/'\Z/)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it "ends with a single quote" do
|
|
95
|
-
cmd.must_match(/'\Z/)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
it "exports http_proxy & HTTP_PROXY when :http_proxy is set" do
|
|
99
|
-
config[:http_proxy] = "http://proxy"
|
|
100
|
-
|
|
101
|
-
cmd.lines.to_a[1..2].must_equal([
|
|
102
|
-
%{http_proxy="http://proxy"; export http_proxy\n},
|
|
103
|
-
%{HTTP_PROXY="http://proxy"; export HTTP_PROXY\n},
|
|
104
|
-
])
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
|
108
|
-
config[:https_proxy] = "https://proxy"
|
|
109
|
-
|
|
110
|
-
cmd.lines.to_a[1..2].must_equal([
|
|
111
|
-
%{https_proxy="https://proxy"; export https_proxy\n},
|
|
112
|
-
%{HTTPS_PROXY="https://proxy"; export HTTPS_PROXY\n},
|
|
113
|
-
])
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
it "exports ftp_proxy & FTP_PROXY when :ftp_proxy is set" do
|
|
117
|
-
config[:ftp_proxy] = "ftp://proxy"
|
|
118
|
-
|
|
119
|
-
cmd.lines.to_a[1..2].must_equal([
|
|
120
|
-
%{ftp_proxy="ftp://proxy"; export ftp_proxy\n},
|
|
121
|
-
%{FTP_PROXY="ftp://proxy"; export FTP_PROXY\n},
|
|
122
|
-
])
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
it "exports all proxy variables when all are set" do
|
|
126
|
-
config[:http_proxy] = "http://proxy"
|
|
127
|
-
config[:https_proxy] = "https://proxy"
|
|
128
|
-
config[:ftp_proxy] = "ftp://proxy"
|
|
129
|
-
|
|
130
|
-
cmd.lines.to_a[1..6].must_equal([
|
|
131
|
-
%{http_proxy="http://proxy"; export http_proxy\n},
|
|
132
|
-
%{HTTP_PROXY="http://proxy"; export HTTP_PROXY\n},
|
|
133
|
-
%{https_proxy="https://proxy"; export https_proxy\n},
|
|
134
|
-
%{HTTPS_PROXY="https://proxy"; export HTTPS_PROXY\n},
|
|
135
|
-
%{ftp_proxy="ftp://proxy"; export ftp_proxy\n},
|
|
136
|
-
%{FTP_PROXY="ftp://proxy"; export FTP_PROXY\n},
|
|
137
|
-
])
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
it "uses sudo for rm when configured" do
|
|
141
|
-
config[:sudo] = true
|
|
142
|
-
|
|
143
|
-
cmd.must_match regexify("sudo -E rm -rf ", :partial_line)
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
it "does not use sudo for rm when configured" do
|
|
147
|
-
config[:sudo] = false
|
|
148
|
-
|
|
149
|
-
provisioner.init_command
|
|
150
|
-
.must_match regexify("rm -rf ", :partial_line)
|
|
151
|
-
provisioner.init_command
|
|
152
|
-
.wont_match regexify("sudo -E rm -rf ", :partial_line)
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
it "removes the data directory" do
|
|
156
|
-
config[:root_path] = "/route"
|
|
157
|
-
|
|
158
|
-
cmd.must_match %r{rm -rf\b.*\s+/route/data\s+}
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
it "creates :root_path directory" do
|
|
162
|
-
config[:root_path] = "/root/path"
|
|
163
|
-
|
|
164
|
-
cmd.must_match regexify("mkdir -p /root/path", :partial_line)
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
it "respects command" do
|
|
168
|
-
config[:command] = "asdf"
|
|
169
|
-
|
|
170
|
-
cmd.must_be_nil
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
describe "for powershell shells on windows os types" do
|
|
175
|
-
before do
|
|
176
|
-
platform.stubs(:os_type).returns("windows")
|
|
177
|
-
platform.stubs(:shell_type).returns("powershell")
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
it "exports http_proxy & HTTP_PROXY when :http_proxy is set" do
|
|
181
|
-
config[:http_proxy] = "http://proxy"
|
|
182
|
-
|
|
183
|
-
cmd.lines.to_a[0..1].must_equal([
|
|
184
|
-
%{$env:http_proxy = "http://proxy"\n},
|
|
185
|
-
%{$env:HTTP_PROXY = "http://proxy"\n},
|
|
186
|
-
])
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
|
190
|
-
config[:https_proxy] = "https://proxy"
|
|
191
|
-
|
|
192
|
-
cmd.lines.to_a[0..1].must_equal([
|
|
193
|
-
%{$env:https_proxy = "https://proxy"\n},
|
|
194
|
-
%{$env:HTTPS_PROXY = "https://proxy"\n},
|
|
195
|
-
])
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
it "exports ftp_proxy & FTP_PROXY when :ftp_proxy is set" do
|
|
199
|
-
config[:ftp_proxy] = "ftp://proxy"
|
|
200
|
-
|
|
201
|
-
cmd.lines.to_a[0..1].must_equal([
|
|
202
|
-
%{$env:ftp_proxy = "ftp://proxy"\n},
|
|
203
|
-
%{$env:FTP_PROXY = "ftp://proxy"\n},
|
|
204
|
-
])
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
it "exports all proxy variables when all are set" do
|
|
208
|
-
config[:http_proxy] = "http://proxy"
|
|
209
|
-
config[:https_proxy] = "https://proxy"
|
|
210
|
-
config[:ftp_proxy] = "ftp://proxy"
|
|
211
|
-
|
|
212
|
-
cmd.lines.to_a[0..5].must_equal([
|
|
213
|
-
%{$env:http_proxy = "http://proxy"\n},
|
|
214
|
-
%{$env:HTTP_PROXY = "http://proxy"\n},
|
|
215
|
-
%{$env:https_proxy = "https://proxy"\n},
|
|
216
|
-
%{$env:HTTPS_PROXY = "https://proxy"\n},
|
|
217
|
-
%{$env:ftp_proxy = "ftp://proxy"\n},
|
|
218
|
-
%{$env:FTP_PROXY = "ftp://proxy"\n},
|
|
219
|
-
])
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
it "removes the data directory" do
|
|
223
|
-
config[:root_path] = '\\route'
|
|
224
|
-
|
|
225
|
-
cmd.must_match regexify(Kitchen::Util.outdent!(<<-POWERSHELL).chomp)
|
|
226
|
-
if (Test-Path "\\route\\data") {
|
|
227
|
-
Remove-Item "\\route\\data" -Recurse -Force
|
|
228
|
-
}
|
|
229
|
-
POWERSHELL
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
it "creates the :root_path directory" do
|
|
233
|
-
config[:root_path] = '\\route'
|
|
234
|
-
|
|
235
|
-
cmd.must_match regexify(Kitchen::Util.outdent!(<<-POWERSHELL).chomp)
|
|
236
|
-
if (-Not (Test-Path "\\route")) {
|
|
237
|
-
New-Item "\\route" -ItemType directory | Out-Null
|
|
238
|
-
}
|
|
239
|
-
POWERSHELL
|
|
240
|
-
end
|
|
241
|
-
end
|
|
242
|
-
end
|
|
243
|
-
|
|
244
|
-
describe "#prepare_command" do
|
|
245
|
-
let(:cmd) { provisioner.prepare_command }
|
|
246
|
-
|
|
247
|
-
describe "for bourne shells" do
|
|
248
|
-
before { platform.stubs(:shell_type).returns("bourne") }
|
|
249
|
-
|
|
250
|
-
it "uses bourne shell" do
|
|
251
|
-
cmd.must_match(/\Ash -c '$/)
|
|
252
|
-
cmd.must_match(/'\Z/)
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
it "ends with a single quote" do
|
|
256
|
-
cmd.must_match(/'\Z/)
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
it "uses sudo for script when configured" do
|
|
260
|
-
config[:root_path] = "/r"
|
|
261
|
-
config[:sudo] = true
|
|
262
|
-
|
|
263
|
-
cmd.must_match regexify("sudo -E chmod +x /r/bootstrap.sh", :partial_line)
|
|
264
|
-
end
|
|
265
|
-
|
|
266
|
-
it "does not use sudo for script when configured" do
|
|
267
|
-
config[:root_path] = "/r"
|
|
268
|
-
config[:sudo] = false
|
|
269
|
-
|
|
270
|
-
cmd.must_match regexify("chmod +x /r/bootstrap.sh", :partial_line)
|
|
271
|
-
cmd.wont_match regexify("sudo -E chmod +x /r/bootstrap.sh", :partial_line)
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
it "uses command_prefix for script when configured" do
|
|
275
|
-
config[:command_prefix] = "TEST=yes"
|
|
276
|
-
config[:root_path] = "/r"
|
|
277
|
-
config[:sudo] = false
|
|
278
|
-
|
|
279
|
-
cmd.must_match(/^TEST=yes/)
|
|
280
|
-
end
|
|
281
|
-
|
|
282
|
-
it "respects command" do
|
|
283
|
-
config[:command] = "dothingy.rb"
|
|
284
|
-
|
|
285
|
-
cmd.must_be_nil
|
|
286
|
-
end
|
|
287
|
-
end
|
|
288
|
-
|
|
289
|
-
describe "for powershell shells on windows os types" do
|
|
290
|
-
before do
|
|
291
|
-
platform.stubs(:shell_type).returns("powershell")
|
|
292
|
-
platform.stubs(:os_type).returns("windows")
|
|
293
|
-
end
|
|
294
|
-
|
|
295
|
-
it "does nothing when given a script" do
|
|
296
|
-
cmd.must_be_nil
|
|
297
|
-
end
|
|
298
|
-
|
|
299
|
-
it "respects command" do
|
|
300
|
-
config[:command] = "dothingy.rb"
|
|
301
|
-
|
|
302
|
-
cmd.must_be_nil
|
|
303
|
-
end
|
|
304
|
-
end
|
|
305
|
-
end
|
|
306
|
-
|
|
307
|
-
describe "#run_command" do
|
|
308
|
-
let(:cmd) { provisioner.run_command }
|
|
309
|
-
|
|
310
|
-
describe "for bourne shells" do
|
|
311
|
-
before { platform.stubs(:shell_type).returns("bourne") }
|
|
312
|
-
|
|
313
|
-
it "uses bourne shell" do
|
|
314
|
-
cmd.must_match(/\Ash -c '$/)
|
|
315
|
-
cmd.must_match(/'\Z/)
|
|
316
|
-
end
|
|
317
|
-
|
|
318
|
-
it "ends with a single quote" do
|
|
319
|
-
cmd.must_match(/'\Z/)
|
|
320
|
-
end
|
|
321
|
-
|
|
322
|
-
it "exports http_proxy & HTTP_PROXY when :http_proxy is set" do
|
|
323
|
-
config[:http_proxy] = "http://proxy"
|
|
324
|
-
|
|
325
|
-
cmd.lines.to_a[1..2].must_equal([
|
|
326
|
-
%{http_proxy="http://proxy"; export http_proxy\n},
|
|
327
|
-
%{HTTP_PROXY="http://proxy"; export HTTP_PROXY\n},
|
|
328
|
-
])
|
|
329
|
-
end
|
|
330
|
-
|
|
331
|
-
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
|
332
|
-
config[:https_proxy] = "https://proxy"
|
|
333
|
-
|
|
334
|
-
cmd.lines.to_a[1..2].must_equal([
|
|
335
|
-
%{https_proxy="https://proxy"; export https_proxy\n},
|
|
336
|
-
%{HTTPS_PROXY="https://proxy"; export HTTPS_PROXY\n},
|
|
337
|
-
])
|
|
338
|
-
end
|
|
339
|
-
|
|
340
|
-
it "exports ftp_proxy & FTP_PROXY when :ftp_proxy is set" do
|
|
341
|
-
config[:ftp_proxy] = "ftp://proxy"
|
|
342
|
-
|
|
343
|
-
cmd.lines.to_a[1..2].must_equal([
|
|
344
|
-
%{ftp_proxy="ftp://proxy"; export ftp_proxy\n},
|
|
345
|
-
%{FTP_PROXY="ftp://proxy"; export FTP_PROXY\n},
|
|
346
|
-
])
|
|
347
|
-
end
|
|
348
|
-
|
|
349
|
-
it "exports all proxy variables when all are set" do
|
|
350
|
-
config[:http_proxy] = "http://proxy"
|
|
351
|
-
config[:https_proxy] = "https://proxy"
|
|
352
|
-
config[:ftp_proxy] = "ftp://proxy"
|
|
353
|
-
|
|
354
|
-
cmd.lines.to_a[1..6].must_equal([
|
|
355
|
-
%{http_proxy="http://proxy"; export http_proxy\n},
|
|
356
|
-
%{HTTP_PROXY="http://proxy"; export HTTP_PROXY\n},
|
|
357
|
-
%{https_proxy="https://proxy"; export https_proxy\n},
|
|
358
|
-
%{HTTPS_PROXY="https://proxy"; export HTTPS_PROXY\n},
|
|
359
|
-
%{ftp_proxy="ftp://proxy"; export ftp_proxy\n},
|
|
360
|
-
%{FTP_PROXY="ftp://proxy"; export FTP_PROXY\n},
|
|
361
|
-
])
|
|
362
|
-
end
|
|
363
|
-
|
|
364
|
-
it "uses sudo for script when configured" do
|
|
365
|
-
config[:root_path] = "/r"
|
|
366
|
-
config[:sudo] = true
|
|
367
|
-
|
|
368
|
-
cmd.must_match regexify("sudo -E /r/bootstrap.sh", :partial_line)
|
|
369
|
-
end
|
|
370
|
-
|
|
371
|
-
it "does not use sudo for script when configured" do
|
|
372
|
-
config[:root_path] = "/r"
|
|
373
|
-
config[:sudo] = false
|
|
374
|
-
|
|
375
|
-
cmd.must_match regexify("/r/bootstrap.sh", :partial_line)
|
|
376
|
-
cmd.wont_match regexify("sudo -E /r/bootstrap.sh", :partial_line)
|
|
377
|
-
end
|
|
378
|
-
|
|
379
|
-
it "uses command_prefix for script when configured" do
|
|
380
|
-
config[:command_prefix] = "TEST=yes"
|
|
381
|
-
config[:root_path] = "/r"
|
|
382
|
-
config[:sudo] = false
|
|
383
|
-
|
|
384
|
-
cmd.must_match(/^TEST=yes/)
|
|
385
|
-
end
|
|
386
|
-
|
|
387
|
-
it "accepts arguments when configured" do
|
|
388
|
-
config[:arguments] = "--php 70 --mysql 57"
|
|
389
|
-
cmd.must_match(/--php 70 --mysql 57/)
|
|
390
|
-
end
|
|
391
|
-
|
|
392
|
-
it "respects command" do
|
|
393
|
-
config[:command] = "dothingy.rb"
|
|
394
|
-
|
|
395
|
-
cmd.must_match regexify("dothingy.rb", :partial_line)
|
|
396
|
-
end
|
|
397
|
-
end
|
|
398
|
-
|
|
399
|
-
describe "for powershell shells on windows os types" do
|
|
400
|
-
before do
|
|
401
|
-
platform.stubs(:shell_type).returns("powershell")
|
|
402
|
-
platform.stubs(:os_type).returns("windows")
|
|
403
|
-
end
|
|
404
|
-
|
|
405
|
-
it "exports http_proxy & HTTP_PROXY when :http_proxy is set" do
|
|
406
|
-
config[:http_proxy] = "http://proxy"
|
|
407
|
-
|
|
408
|
-
cmd.lines.to_a[0..1].must_equal([
|
|
409
|
-
%{$env:http_proxy = "http://proxy"\n},
|
|
410
|
-
%{$env:HTTP_PROXY = "http://proxy"\n},
|
|
411
|
-
])
|
|
412
|
-
end
|
|
413
|
-
|
|
414
|
-
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
|
415
|
-
config[:https_proxy] = "https://proxy"
|
|
416
|
-
|
|
417
|
-
cmd.lines.to_a[0..1].must_equal([
|
|
418
|
-
%{$env:https_proxy = "https://proxy"\n},
|
|
419
|
-
%{$env:HTTPS_PROXY = "https://proxy"\n},
|
|
420
|
-
])
|
|
421
|
-
end
|
|
422
|
-
|
|
423
|
-
it "exports ftp_proxy & FTP_PROXY when :ftp_proxy is set" do
|
|
424
|
-
config[:ftp_proxy] = "ftp://proxy"
|
|
425
|
-
|
|
426
|
-
cmd.lines.to_a[0..1].must_equal([
|
|
427
|
-
%{$env:ftp_proxy = "ftp://proxy"\n},
|
|
428
|
-
%{$env:FTP_PROXY = "ftp://proxy"\n},
|
|
429
|
-
])
|
|
430
|
-
end
|
|
431
|
-
|
|
432
|
-
it "exports all proxy variables when all are set" do
|
|
433
|
-
config[:http_proxy] = "http://proxy"
|
|
434
|
-
config[:https_proxy] = "https://proxy"
|
|
435
|
-
config[:ftp_proxy] = "ftp://proxy"
|
|
436
|
-
|
|
437
|
-
cmd.lines.to_a[0..5].must_equal([
|
|
438
|
-
%{$env:http_proxy = "http://proxy"\n},
|
|
439
|
-
%{$env:HTTP_PROXY = "http://proxy"\n},
|
|
440
|
-
%{$env:https_proxy = "https://proxy"\n},
|
|
441
|
-
%{$env:HTTPS_PROXY = "https://proxy"\n},
|
|
442
|
-
%{$env:ftp_proxy = "ftp://proxy"\n},
|
|
443
|
-
%{$env:FTP_PROXY = "ftp://proxy"\n},
|
|
444
|
-
])
|
|
445
|
-
end
|
|
446
|
-
|
|
447
|
-
it "invokes the bootstrap.ps1 script" do
|
|
448
|
-
config[:root_path] = '\\r'
|
|
449
|
-
|
|
450
|
-
cmd.must_match regexify(%{& "\\r\\bootstrap.ps1"})
|
|
451
|
-
end
|
|
452
|
-
end
|
|
453
|
-
end
|
|
454
|
-
|
|
455
|
-
describe "#create_sandbox" do
|
|
456
|
-
before do
|
|
457
|
-
@root = Dir.mktmpdir
|
|
458
|
-
config[:kitchen_root] = @root
|
|
459
|
-
end
|
|
460
|
-
|
|
461
|
-
after do
|
|
462
|
-
FileUtils.remove_entry(@root)
|
|
463
|
-
begin
|
|
464
|
-
provisioner.cleanup_sandbox
|
|
465
|
-
rescue # rubocop:disable Lint/HandleExceptions
|
|
466
|
-
end
|
|
467
|
-
end
|
|
468
|
-
|
|
469
|
-
let(:provisioner) do
|
|
470
|
-
Kitchen::Provisioner::Shell.new(config).finalize_config!(instance)
|
|
471
|
-
end
|
|
472
|
-
|
|
473
|
-
describe "data files" do
|
|
474
|
-
before do
|
|
475
|
-
create_files_under("#{config[:kitchen_root]}/my_data")
|
|
476
|
-
config[:data_path] = "#{config[:kitchen_root]}/my_data"
|
|
477
|
-
end
|
|
478
|
-
|
|
479
|
-
it "skips directory creation if :data_path is not set" do
|
|
480
|
-
config[:data_path] = nil
|
|
481
|
-
provisioner.create_sandbox
|
|
482
|
-
|
|
483
|
-
sandbox_path("data").directory?.must_equal false
|
|
484
|
-
end
|
|
485
|
-
|
|
486
|
-
it "copies tree from :data_path into sandbox" do
|
|
487
|
-
provisioner.create_sandbox
|
|
488
|
-
|
|
489
|
-
sandbox_path("data/alpha.txt").file?.must_equal true
|
|
490
|
-
IO.read(sandbox_path("data/alpha.txt")).must_equal "stuff"
|
|
491
|
-
sandbox_path("data/sub").directory?.must_equal true
|
|
492
|
-
sandbox_path("data/sub/bravo.txt").file?.must_equal true
|
|
493
|
-
IO.read(sandbox_path("data/sub/bravo.txt")).must_equal "junk"
|
|
494
|
-
end
|
|
495
|
-
|
|
496
|
-
it "logs a message on info" do
|
|
497
|
-
provisioner.create_sandbox
|
|
498
|
-
|
|
499
|
-
logged_output.string.must_match info_line("Preparing data")
|
|
500
|
-
end
|
|
501
|
-
|
|
502
|
-
it "logs a message on debug" do
|
|
503
|
-
provisioner.create_sandbox
|
|
504
|
-
|
|
505
|
-
logged_output.string.must_match debug_line(
|
|
506
|
-
"Using data from #{config[:kitchen_root]}/my_data")
|
|
507
|
-
end
|
|
508
|
-
end
|
|
509
|
-
|
|
510
|
-
describe "script file" do
|
|
511
|
-
describe "with a valid :script file" do
|
|
512
|
-
before do
|
|
513
|
-
File.open("#{config[:kitchen_root]}/my_script", "wb") do |file|
|
|
514
|
-
file.write("gonuts")
|
|
515
|
-
end
|
|
516
|
-
config[:script] = "#{config[:kitchen_root]}/my_script"
|
|
517
|
-
end
|
|
518
|
-
|
|
519
|
-
it "creates a file in the sandbox directory" do
|
|
520
|
-
provisioner.create_sandbox
|
|
521
|
-
|
|
522
|
-
sandbox_path("my_script").file?.must_equal true
|
|
523
|
-
IO.read(sandbox_path("my_script")).must_equal "gonuts"
|
|
524
|
-
end
|
|
525
|
-
|
|
526
|
-
it "logs a message on info" do
|
|
527
|
-
provisioner.create_sandbox
|
|
528
|
-
|
|
529
|
-
logged_output.string.must_match info_line("Preparing script")
|
|
530
|
-
end
|
|
531
|
-
|
|
532
|
-
it "logs a message on debug" do
|
|
533
|
-
provisioner.create_sandbox
|
|
534
|
-
|
|
535
|
-
logged_output.string.must_match debug_line(
|
|
536
|
-
"Using script from #{config[:kitchen_root]}/my_script")
|
|
537
|
-
end
|
|
538
|
-
end
|
|
539
|
-
|
|
540
|
-
describe "with no :script file" do
|
|
541
|
-
before { config[:script] = nil }
|
|
542
|
-
|
|
543
|
-
it "has no run command" do
|
|
544
|
-
provisioner.run_command.must_be_nil
|
|
545
|
-
end
|
|
546
|
-
|
|
547
|
-
describe "for bourne shells" do
|
|
548
|
-
before { platform.stubs(:shell_type).returns("bourne") }
|
|
549
|
-
|
|
550
|
-
it "logs a message on info" do
|
|
551
|
-
provisioner.create_sandbox
|
|
552
|
-
|
|
553
|
-
logged_output.string.must_match info_line("Preparing script")
|
|
554
|
-
end
|
|
555
|
-
|
|
556
|
-
it "logs a warning on info" do
|
|
557
|
-
provisioner.create_sandbox
|
|
558
|
-
|
|
559
|
-
logged_output.string.must_match info_line(
|
|
560
|
-
"No provisioner script file specified, skipping")
|
|
561
|
-
end
|
|
562
|
-
|
|
563
|
-
it "does not create a file in the sandbox directory" do
|
|
564
|
-
provisioner.create_sandbox
|
|
565
|
-
|
|
566
|
-
sandbox_path("bootstrap.sh").file?.must_equal false
|
|
567
|
-
end
|
|
568
|
-
end
|
|
569
|
-
|
|
570
|
-
describe "for powershell shells" do
|
|
571
|
-
before { platform.stubs(:shell_type).returns("powershell") }
|
|
572
|
-
|
|
573
|
-
it "logs a message on info" do
|
|
574
|
-
provisioner.create_sandbox
|
|
575
|
-
|
|
576
|
-
logged_output.string.must_match info_line("Preparing script")
|
|
577
|
-
end
|
|
578
|
-
|
|
579
|
-
it "logs a warning on info" do
|
|
580
|
-
provisioner.create_sandbox
|
|
581
|
-
|
|
582
|
-
logged_output.string.must_match info_line(
|
|
583
|
-
"No provisioner script file specified, skipping")
|
|
584
|
-
end
|
|
585
|
-
|
|
586
|
-
it "does not create a file in the sandbox directory" do
|
|
587
|
-
provisioner.create_sandbox
|
|
588
|
-
|
|
589
|
-
sandbox_path("bootstrap.ps1").file?.must_equal false
|
|
590
|
-
end
|
|
591
|
-
end
|
|
592
|
-
end
|
|
593
|
-
end
|
|
594
|
-
|
|
595
|
-
def sandbox_path(path)
|
|
596
|
-
Pathname.new(provisioner.sandbox_path).join(path)
|
|
597
|
-
end
|
|
598
|
-
|
|
599
|
-
def create_files_under(path)
|
|
600
|
-
FileUtils.mkdir_p(File.join(path, "sub"))
|
|
601
|
-
File.open(File.join(path, "alpha.txt"), "wb") do |file|
|
|
602
|
-
file.write("stuff")
|
|
603
|
-
end
|
|
604
|
-
File.open(File.join(path, "sub", "bravo.txt"), "wb") do |file|
|
|
605
|
-
file.write("junk")
|
|
606
|
-
end
|
|
607
|
-
end
|
|
608
|
-
|
|
609
|
-
def info_line(msg)
|
|
610
|
-
/^I, .* : #{Regexp.escape(msg)}$/
|
|
611
|
-
end
|
|
612
|
-
|
|
613
|
-
def debug_line(msg)
|
|
614
|
-
/^D, .* : #{Regexp.escape(msg)}$/
|
|
615
|
-
end
|
|
616
|
-
end
|
|
617
|
-
|
|
618
|
-
def regexify(str, line = :whole_line)
|
|
619
|
-
r = Regexp.escape(str)
|
|
620
|
-
r = "^\s*#{r}$" if line == :whole_line
|
|
621
|
-
Regexp.new(r)
|
|
622
|
-
end
|
|
623
|
-
end
|