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,602 +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/chef_solo"
|
23
|
-
|
24
|
-
describe Kitchen::Provisioner::ChefSolo do
|
25
|
-
let(:logged_output) { StringIO.new }
|
26
|
-
let(:logger) { Logger.new(logged_output) }
|
27
|
-
let(:platform) { stub(os_type: nil) }
|
28
|
-
let(:suite) { stub(name: "fries") }
|
29
|
-
|
30
|
-
let(:config) do
|
31
|
-
{ test_base_path: "/b", kitchen_root: "/r" }
|
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
|
-
Kitchen::Provisioner::ChefSolo.new(config).finalize_config!(instance)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "provisioner api_version is 2" do
|
48
|
-
provisioner.diagnose_plugin[:api_version].must_equal 2
|
49
|
-
end
|
50
|
-
|
51
|
-
it "plugin_version is set to Kitchen::VERSION" do
|
52
|
-
provisioner.diagnose_plugin[:version].must_equal Kitchen::VERSION
|
53
|
-
end
|
54
|
-
|
55
|
-
describe "default config" do
|
56
|
-
describe "for unix operating systems" do
|
57
|
-
before { platform.stubs(:os_type).returns("unix") }
|
58
|
-
|
59
|
-
it "sets :chef_solo_path to a path using :chef_omnibus_root" do
|
60
|
-
config[:chef_omnibus_root] = "/nice/place"
|
61
|
-
|
62
|
-
provisioner[:chef_solo_path].must_equal "/nice/place/bin/chef-solo"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "for windows operating systems" do
|
67
|
-
before { platform.stubs(:os_type).returns("windows") }
|
68
|
-
|
69
|
-
it "sets :chef_solo_path to a path using :chef_omnibus_root" do
|
70
|
-
config[:chef_omnibus_root] = '$env:systemdrive\\nice\\place'
|
71
|
-
|
72
|
-
provisioner[:chef_solo_path]
|
73
|
-
.must_equal '$env:systemdrive\\nice\\place\\bin\\chef-solo.bat'
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
it "sets :solo_rb to an empty Hash" do
|
78
|
-
provisioner[:solo_rb].must_equal Hash.new
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "#create_sandbox" do
|
83
|
-
before do
|
84
|
-
@root = Dir.mktmpdir
|
85
|
-
config[:kitchen_root] = @root
|
86
|
-
end
|
87
|
-
|
88
|
-
after do
|
89
|
-
FileUtils.remove_entry(@root)
|
90
|
-
begin
|
91
|
-
provisioner.cleanup_sandbox
|
92
|
-
rescue # rubocop:disable Lint/HandleExceptions
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe "solo.rb file" do
|
97
|
-
let(:file) do
|
98
|
-
IO.read(sandbox_path("solo.rb")).lines.map(&:chomp)
|
99
|
-
end
|
100
|
-
|
101
|
-
let(:file_no_updated_resources) do
|
102
|
-
IO.read(sandbox_path("client_no_updated_resources.rb")).lines.map(&:chomp)
|
103
|
-
end
|
104
|
-
|
105
|
-
it "creates a solo.rb" do
|
106
|
-
provisioner.create_sandbox
|
107
|
-
|
108
|
-
sandbox_path("solo.rb").file?.must_equal true
|
109
|
-
end
|
110
|
-
|
111
|
-
it "logs a message on info" do
|
112
|
-
provisioner.create_sandbox
|
113
|
-
|
114
|
-
logged_output.string.must_match info_line("Preparing solo.rb")
|
115
|
-
end
|
116
|
-
|
117
|
-
it "logs a message on debug" do
|
118
|
-
provisioner.create_sandbox
|
119
|
-
|
120
|
-
logged_output.string
|
121
|
-
.must_match debug_line_starting_with("Creating solo.rb from {")
|
122
|
-
end
|
123
|
-
|
124
|
-
describe "defaults" do
|
125
|
-
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
126
|
-
def self.common_solo_rb_specs
|
127
|
-
it "sets node_name to the instance name" do
|
128
|
-
file.must_include %{node_name "#{instance.name}"}
|
129
|
-
end
|
130
|
-
|
131
|
-
it "sets checksum_path" do
|
132
|
-
file.must_include %{checksum_path "#{base}checksums"}
|
133
|
-
end
|
134
|
-
|
135
|
-
it "sets file_backup_path" do
|
136
|
-
file.must_include %{file_backup_path "#{base}backup"}
|
137
|
-
end
|
138
|
-
|
139
|
-
it "sets cookbook_path" do
|
140
|
-
file.must_include %{cookbook_path } +
|
141
|
-
%{["#{base}cookbooks", "#{base}site-cookbooks"]}
|
142
|
-
end
|
143
|
-
|
144
|
-
it "sets data_bag_path" do
|
145
|
-
file.must_include %{data_bag_path "#{base}data_bags"}
|
146
|
-
end
|
147
|
-
|
148
|
-
it "sets environment_path" do
|
149
|
-
file.must_include %{environment_path "#{base}environments"}
|
150
|
-
end
|
151
|
-
|
152
|
-
it "sets node_path" do
|
153
|
-
file.must_include %{node_path "#{base}nodes"}
|
154
|
-
end
|
155
|
-
|
156
|
-
it "sets role_path" do
|
157
|
-
file.must_include %{role_path "#{base}roles"}
|
158
|
-
end
|
159
|
-
|
160
|
-
it "sets client_path" do
|
161
|
-
file.must_include %{client_path "#{base}clients"}
|
162
|
-
end
|
163
|
-
|
164
|
-
it "sets user_path" do
|
165
|
-
file.must_include %{user_path "#{base}users"}
|
166
|
-
end
|
167
|
-
|
168
|
-
it "sets validation_key" do
|
169
|
-
file.must_include %{validation_key "#{base}validation.pem"}
|
170
|
-
end
|
171
|
-
|
172
|
-
it "sets client_key" do
|
173
|
-
file.must_include %{client_key "#{base}client.pem"}
|
174
|
-
end
|
175
|
-
|
176
|
-
it "sets chef_server_url" do
|
177
|
-
file.must_include %{chef_server_url "http://127.0.0.1:8889"}
|
178
|
-
end
|
179
|
-
|
180
|
-
it "sets encrypted_data_bag_secret" do
|
181
|
-
file.must_include %{encrypted_data_bag_secret } +
|
182
|
-
%{"#{base}encrypted_data_bag_secret"}
|
183
|
-
end
|
184
|
-
end
|
185
|
-
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
186
|
-
|
187
|
-
describe "for unix os types" do
|
188
|
-
before do
|
189
|
-
platform.stubs(:os_type).returns("unix")
|
190
|
-
provisioner.create_sandbox
|
191
|
-
end
|
192
|
-
|
193
|
-
let(:base) { "/tmp/kitchen/" }
|
194
|
-
|
195
|
-
common_solo_rb_specs
|
196
|
-
end
|
197
|
-
|
198
|
-
describe "for windows os types with full path" do
|
199
|
-
before do
|
200
|
-
platform.stubs(:os_type).returns("windows")
|
201
|
-
config[:root_path] = '\\a\\b'
|
202
|
-
provisioner.create_sandbox
|
203
|
-
end
|
204
|
-
|
205
|
-
let(:base) { '\\\\a\\\\b\\\\' }
|
206
|
-
|
207
|
-
common_solo_rb_specs
|
208
|
-
end
|
209
|
-
|
210
|
-
describe "for windows os types with $env:TEMP prefixed paths" do
|
211
|
-
before do
|
212
|
-
platform.stubs(:os_type).returns("windows")
|
213
|
-
config[:root_path] = '$env:TEMP\\a'
|
214
|
-
provisioner.create_sandbox
|
215
|
-
end
|
216
|
-
|
217
|
-
let(:base) { "\#{ENV['TEMP']}\\\\a\\\\" }
|
218
|
-
|
219
|
-
common_solo_rb_specs
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
it "supports overwriting defaults" do
|
224
|
-
config[:solo_rb] = {
|
225
|
-
node_name: "eagles",
|
226
|
-
user_path: "/a/b/c/u",
|
227
|
-
client_key: "lol",
|
228
|
-
}
|
229
|
-
provisioner.create_sandbox
|
230
|
-
|
231
|
-
file.must_include %{node_name "eagles"}
|
232
|
-
file.must_include %{user_path "/a/b/c/u"}
|
233
|
-
file.must_include %{client_key "lol"}
|
234
|
-
end
|
235
|
-
|
236
|
-
it "supports adding new configuration" do
|
237
|
-
config[:solo_rb] = {
|
238
|
-
dark_secret: "golang",
|
239
|
-
}
|
240
|
-
provisioner.create_sandbox
|
241
|
-
|
242
|
-
file.must_include %{dark_secret "golang"}
|
243
|
-
end
|
244
|
-
|
245
|
-
it "formats array values correctly" do
|
246
|
-
config[:solo_rb] = {
|
247
|
-
foos: %w{foo1 foo2},
|
248
|
-
}
|
249
|
-
provisioner.create_sandbox
|
250
|
-
|
251
|
-
file.must_include %{foos ["foo1", "foo2"]}
|
252
|
-
end
|
253
|
-
|
254
|
-
it "formats integer values correctly" do
|
255
|
-
config[:solo_rb] = {
|
256
|
-
foo: 7,
|
257
|
-
}
|
258
|
-
provisioner.create_sandbox
|
259
|
-
|
260
|
-
file.must_include %{foo 7}
|
261
|
-
end
|
262
|
-
|
263
|
-
it "formats symbol-looking string values correctly" do
|
264
|
-
config[:solo_rb] = {
|
265
|
-
foo: ":bar",
|
266
|
-
}
|
267
|
-
provisioner.create_sandbox
|
268
|
-
|
269
|
-
file.must_include %{foo :bar}
|
270
|
-
end
|
271
|
-
|
272
|
-
it "formats boolean values correctly" do
|
273
|
-
config[:solo_rb] = {
|
274
|
-
foo: false,
|
275
|
-
bar: true,
|
276
|
-
}
|
277
|
-
provisioner.create_sandbox
|
278
|
-
|
279
|
-
file.must_include %{foo false}
|
280
|
-
file.must_include %{bar true}
|
281
|
-
end
|
282
|
-
|
283
|
-
it "supports idempotency check " do
|
284
|
-
config[:multiple_converge] = 2
|
285
|
-
config[:enforce_idempotency] = true
|
286
|
-
provisioner.create_sandbox
|
287
|
-
|
288
|
-
file_no_updated_resources.join.must_match(/handler_file =.*chef-client-fail-if-update-handler.rb/)
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
def sandbox_path(path)
|
293
|
-
Pathname.new(provisioner.sandbox_path).join(path)
|
294
|
-
end
|
295
|
-
end
|
296
|
-
|
297
|
-
describe "#run_command" do
|
298
|
-
let(:cmd) { provisioner.run_command }
|
299
|
-
|
300
|
-
describe "common behavior" do
|
301
|
-
before { platform.stubs(:shell_type).returns("fake") }
|
302
|
-
|
303
|
-
it "prefixs the whole command with the command_prefix if set" do
|
304
|
-
config[:command_prefix] = "my_prefix"
|
305
|
-
|
306
|
-
cmd.must_match(/\Amy_prefix /)
|
307
|
-
end
|
308
|
-
|
309
|
-
it "does not prefix the command if command_prefix is not set" do
|
310
|
-
config[:command_prefix] = nil
|
311
|
-
|
312
|
-
cmd.wont_match(/\Amy_prefix /)
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
describe "for bourne shells" do
|
317
|
-
before { platform.stubs(:shell_type).returns("bourne") }
|
318
|
-
|
319
|
-
it "uses bourne shell" do
|
320
|
-
cmd.must_match(/\Ash -c '$/)
|
321
|
-
cmd.must_match(/'\Z/)
|
322
|
-
end
|
323
|
-
|
324
|
-
it "ends with a single quote" do
|
325
|
-
cmd.must_match(/'\Z/)
|
326
|
-
end
|
327
|
-
|
328
|
-
it "contains a standard second run if multiple_converge is set to 2" do
|
329
|
-
config[:multiple_converge] = 2
|
330
|
-
cmd.must_match(/chef-solo.*&&.*chef-solo.*/m)
|
331
|
-
cmd.wont_match(/chef-solo.*&&.*chef-solo.*client_no_updated_resources.rb/m)
|
332
|
-
end
|
333
|
-
|
334
|
-
it "contains a specific second run if enforce_idempotency is set" do
|
335
|
-
config[:multiple_converge] = 2
|
336
|
-
config[:enforce_idempotency] = true
|
337
|
-
cmd.must_match(/chef-solo.*&&.*chef-solo.*client_no_updated_resources.rb/m)
|
338
|
-
end
|
339
|
-
|
340
|
-
it "exports http_proxy & HTTP_PROXY when :http_proxy is set" do
|
341
|
-
config[:http_proxy] = "http://proxy"
|
342
|
-
|
343
|
-
cmd.lines.to_a[1..2].must_equal([
|
344
|
-
%{http_proxy="http://proxy"; export http_proxy\n},
|
345
|
-
%{HTTP_PROXY="http://proxy"; export HTTP_PROXY\n},
|
346
|
-
])
|
347
|
-
end
|
348
|
-
|
349
|
-
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
350
|
-
config[:https_proxy] = "https://proxy"
|
351
|
-
|
352
|
-
cmd.lines.to_a[1..2].must_equal([
|
353
|
-
%{https_proxy="https://proxy"; export https_proxy\n},
|
354
|
-
%{HTTPS_PROXY="https://proxy"; export HTTPS_PROXY\n},
|
355
|
-
])
|
356
|
-
end
|
357
|
-
|
358
|
-
it "exports all http proxy variables when both are set" do
|
359
|
-
config[:http_proxy] = "http://proxy"
|
360
|
-
config[:https_proxy] = "https://proxy"
|
361
|
-
|
362
|
-
cmd.lines.to_a[1..4].must_equal([
|
363
|
-
%{http_proxy="http://proxy"; export http_proxy\n},
|
364
|
-
%{HTTP_PROXY="http://proxy"; export HTTP_PROXY\n},
|
365
|
-
%{https_proxy="https://proxy"; export https_proxy\n},
|
366
|
-
%{HTTPS_PROXY="https://proxy"; export HTTPS_PROXY\n},
|
367
|
-
])
|
368
|
-
end
|
369
|
-
|
370
|
-
it "does no powershell PATH reloading for older chef packages" do
|
371
|
-
cmd.wont_match regexify(%{[System.Environment]::})
|
372
|
-
end
|
373
|
-
|
374
|
-
it "uses sudo for chef-solo when configured" do
|
375
|
-
config[:chef_omnibus_root] = "/c"
|
376
|
-
config[:sudo] = true
|
377
|
-
|
378
|
-
cmd.must_match regexify("sudo -E /c/bin/chef-solo ", :partial_line)
|
379
|
-
end
|
380
|
-
|
381
|
-
it "does not use sudo for chef-solo when configured" do
|
382
|
-
config[:chef_omnibus_root] = "/c"
|
383
|
-
config[:sudo] = false
|
384
|
-
|
385
|
-
cmd.must_match regexify("chef-solo ", :partial_line)
|
386
|
-
cmd.wont_match regexify("sudo -E /c/bin/chef-solo ", :partial_line)
|
387
|
-
end
|
388
|
-
|
389
|
-
it "sets config flag on chef-solo" do
|
390
|
-
cmd.must_match regexify(" --config /tmp/kitchen/solo.rb", :partial_line)
|
391
|
-
end
|
392
|
-
|
393
|
-
it "sets config flag for custom root_path" do
|
394
|
-
config[:root_path] = "/a/b"
|
395
|
-
|
396
|
-
cmd.must_match regexify(" --config /a/b/solo.rb", :partial_line)
|
397
|
-
end
|
398
|
-
|
399
|
-
it "sets json attributes flag on chef-solo" do
|
400
|
-
cmd.must_match regexify(
|
401
|
-
" --json-attributes /tmp/kitchen/dna.json", :partial_line)
|
402
|
-
end
|
403
|
-
|
404
|
-
it "sets json attribtes flag for custom root_path" do
|
405
|
-
config[:root_path] = "/booyah"
|
406
|
-
|
407
|
-
cmd.must_match regexify(
|
408
|
-
" --json-attributes /booyah/dna.json", :partial_line)
|
409
|
-
end
|
410
|
-
|
411
|
-
it "sets log level flag on chef-solo to auto by default" do
|
412
|
-
cmd.must_match regexify(" --log_level auto", :partial_line)
|
413
|
-
end
|
414
|
-
|
415
|
-
it "sets log level flag on chef-solo to info by default if running Chef < 11" do
|
416
|
-
config[:require_chef_omnibus] = "10.34.6"
|
417
|
-
cmd.must_match regexify(" --log_level info", :partial_line)
|
418
|
-
end
|
419
|
-
|
420
|
-
it "set log level flag for custom level" do
|
421
|
-
config[:log_level] = :extreme
|
422
|
-
|
423
|
-
cmd.must_match regexify(" --log_level extreme", :partial_line)
|
424
|
-
end
|
425
|
-
|
426
|
-
it "sets force formatter flag on chef-solo" do
|
427
|
-
cmd.must_match regexify(" --force-formatter", :partial_line)
|
428
|
-
end
|
429
|
-
|
430
|
-
it "does not set force formatter flag on chef-solo if running Chef < 11" do
|
431
|
-
config[:require_chef_omnibus] = "10.34.6"
|
432
|
-
cmd.wont_match regexify(" --force-formatter", :partial_line)
|
433
|
-
end
|
434
|
-
|
435
|
-
it "sets no color flag on chef-solo" do
|
436
|
-
cmd.must_match regexify(" --no-color", :partial_line)
|
437
|
-
end
|
438
|
-
|
439
|
-
it "does not set logfile flag by default" do
|
440
|
-
cmd.wont_match regexify(" --logfile ", :partial_line)
|
441
|
-
end
|
442
|
-
|
443
|
-
it "sets logfile flag for custom value" do
|
444
|
-
config[:log_file] = "/a/out.log"
|
445
|
-
|
446
|
-
cmd.must_match regexify(" --logfile /a/out.log", :partial_line)
|
447
|
-
end
|
448
|
-
|
449
|
-
it "sets profile-ruby flag when config element is set" do
|
450
|
-
config[:profile_ruby] = true
|
451
|
-
|
452
|
-
cmd.must_match regexify(
|
453
|
-
" --profile-ruby", :partial_line)
|
454
|
-
end
|
455
|
-
|
456
|
-
it "does not set profile-ruby flag when config element is falsey" do
|
457
|
-
config[:profile_ruby] = false
|
458
|
-
|
459
|
-
cmd.wont_match regexify(" --profile-ruby", :partial_line)
|
460
|
-
end
|
461
|
-
|
462
|
-
it "sets legacy-mode flag when config element is set" do
|
463
|
-
config[:legacy_mode] = true
|
464
|
-
|
465
|
-
cmd.must_match regexify(" --legacy-mode", :partial_line)
|
466
|
-
end
|
467
|
-
|
468
|
-
it "does not set legacy-mode flag when config element is falsey" do
|
469
|
-
config[:legacy_mode] = false
|
470
|
-
|
471
|
-
cmd.wont_match regexify(" --legacy-mode", :partial_line)
|
472
|
-
end
|
473
|
-
end
|
474
|
-
|
475
|
-
describe "for powershell shells on windows os types" do
|
476
|
-
before do
|
477
|
-
platform.stubs(:shell_type).returns("powershell")
|
478
|
-
platform.stubs(:os_type).returns("windows")
|
479
|
-
end
|
480
|
-
|
481
|
-
it "contains a standard second run if multiple_converge is set to 2" do
|
482
|
-
config[:multiple_converge] = 2
|
483
|
-
cmd.must_match(/chef-solo.*;.*chef-solo.*/m)
|
484
|
-
cmd.wont_match(/chef-solo.*;.*chef-solo.*client_no_updated_resources.rb/m)
|
485
|
-
end
|
486
|
-
|
487
|
-
it "contains a specific second run if enforce_idempotency is set" do
|
488
|
-
config[:multiple_converge] = 2
|
489
|
-
config[:enforce_idempotency] = true
|
490
|
-
cmd.must_match(/chef-solo.*;.*chef-solo.*client_no_updated_resources.rb/m)
|
491
|
-
end
|
492
|
-
|
493
|
-
it "exports http_proxy & HTTP_PROXY when :http_proxy is set" do
|
494
|
-
config[:http_proxy] = "http://proxy"
|
495
|
-
|
496
|
-
cmd.lines.to_a[0..1].must_equal([
|
497
|
-
%{$env:http_proxy = "http://proxy"\n},
|
498
|
-
%{$env:HTTP_PROXY = "http://proxy"\n},
|
499
|
-
])
|
500
|
-
end
|
501
|
-
|
502
|
-
it "exports https_proxy & HTTPS_PROXY when :https_proxy is set" do
|
503
|
-
config[:https_proxy] = "https://proxy"
|
504
|
-
|
505
|
-
cmd.lines.to_a[0..1].must_equal([
|
506
|
-
%{$env:https_proxy = "https://proxy"\n},
|
507
|
-
%{$env:HTTPS_PROXY = "https://proxy"\n},
|
508
|
-
])
|
509
|
-
end
|
510
|
-
|
511
|
-
it "exports all http proxy variables when both are set" do
|
512
|
-
config[:http_proxy] = "http://proxy"
|
513
|
-
config[:https_proxy] = "https://proxy"
|
514
|
-
|
515
|
-
cmd.lines.to_a[0..3].must_equal([
|
516
|
-
%{$env:http_proxy = "http://proxy"\n},
|
517
|
-
%{$env:HTTP_PROXY = "http://proxy"\n},
|
518
|
-
%{$env:https_proxy = "https://proxy"\n},
|
519
|
-
%{$env:HTTPS_PROXY = "https://proxy"\n},
|
520
|
-
])
|
521
|
-
end
|
522
|
-
|
523
|
-
it "reloads PATH for older chef packages" do
|
524
|
-
cmd.must_match regexify("$env:PATH = try {\n" \
|
525
|
-
"[System.Environment]::GetEnvironmentVariable('PATH','Machine')\n" \
|
526
|
-
"} catch { $env:PATH }")
|
527
|
-
end
|
528
|
-
|
529
|
-
it "calls the chef-solo command from :chef_solo_path" do
|
530
|
-
config[:chef_solo_path] = '\\r\\chef-solo.bat'
|
531
|
-
|
532
|
-
cmd.must_match regexify('& \\r\\chef-solo.bat ', :partial_line)
|
533
|
-
end
|
534
|
-
|
535
|
-
it "sets config flag on chef-solo" do
|
536
|
-
cmd.must_match regexify(
|
537
|
-
' --config $env:TEMP\\kitchen\\solo.rb', :partial_line)
|
538
|
-
end
|
539
|
-
|
540
|
-
it "sets config flag for custom root_path" do
|
541
|
-
config[:root_path] = '\\a\\b'
|
542
|
-
|
543
|
-
cmd.must_match regexify(
|
544
|
-
' --config \\a\\b\\solo.rb', :partial_line)
|
545
|
-
end
|
546
|
-
|
547
|
-
it "sets json attributes flag on chef-solo" do
|
548
|
-
cmd.must_match regexify(
|
549
|
-
' --json-attributes $env:TEMP\\kitchen\\dna.json', :partial_line)
|
550
|
-
end
|
551
|
-
|
552
|
-
it "sets json attribtes flag for custom root_path" do
|
553
|
-
config[:root_path] = '\\booyah'
|
554
|
-
|
555
|
-
cmd.must_match regexify(
|
556
|
-
' --json-attributes \\booyah\\dna.json', :partial_line)
|
557
|
-
end
|
558
|
-
|
559
|
-
it "sets log level flag on chef-solo to auto by default" do
|
560
|
-
cmd.must_match regexify(" --log_level auto", :partial_line)
|
561
|
-
end
|
562
|
-
|
563
|
-
it "set log level flag for custom level" do
|
564
|
-
config[:log_level] = :extreme
|
565
|
-
|
566
|
-
cmd.must_match regexify(" --log_level extreme", :partial_line)
|
567
|
-
end
|
568
|
-
|
569
|
-
it "sets force formatter flag on chef-solo" do
|
570
|
-
cmd.must_match regexify(" --force-formatter", :partial_line)
|
571
|
-
end
|
572
|
-
|
573
|
-
it "sets no color flag on chef-solo" do
|
574
|
-
cmd.must_match regexify(" --no-color", :partial_line)
|
575
|
-
end
|
576
|
-
|
577
|
-
it "does not set logfile flag by default" do
|
578
|
-
cmd.wont_match regexify(" --logfile ", :partial_line)
|
579
|
-
end
|
580
|
-
|
581
|
-
it "sets logfile flag for custom value" do
|
582
|
-
config[:log_file] = '\\a\\out.log'
|
583
|
-
|
584
|
-
cmd.must_match regexify(' --logfile \\a\\out.log', :partial_line)
|
585
|
-
end
|
586
|
-
end
|
587
|
-
end
|
588
|
-
|
589
|
-
def info_line(msg)
|
590
|
-
/^I, .* : #{Regexp.escape(msg)}$/
|
591
|
-
end
|
592
|
-
|
593
|
-
def debug_line_starting_with(msg)
|
594
|
-
/^D, .* : #{Regexp.escape(msg)}/
|
595
|
-
end
|
596
|
-
|
597
|
-
def regexify(str, line = :whole_line)
|
598
|
-
r = Regexp.escape(str)
|
599
|
-
r = "^\s*#{r}$" if line == :whole_line
|
600
|
-
Regexp.new(r)
|
601
|
-
end
|
602
|
-
end
|