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.
Files changed (254) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kitchen/version.rb +1 -1
  3. data/support/chef-client-zero.rb +1 -1
  4. metadata +5 -324
  5. data/.gitattributes +0 -3
  6. data/.github/ISSUE_TEMPLATE.md +0 -56
  7. data/.github/lock.yml +0 -1
  8. data/.gitignore +0 -38
  9. data/.gitmodules +0 -0
  10. data/.kitchen.appveyor.yml +0 -25
  11. data/.kitchen.dokken.yml +0 -31
  12. data/.kitchen.proxy.yml +0 -27
  13. data/.rubocop.yml +0 -5
  14. data/.travis.yml +0 -57
  15. data/.yardopts +0 -3
  16. data/Berksfile +0 -3
  17. data/CHANGELOG.md +0 -1510
  18. data/CONTRIBUTING.md +0 -14
  19. data/ECOSYSTEM.md +0 -93
  20. data/Gemfile +0 -40
  21. data/Gemfile.proxy_tests +0 -4
  22. data/Guardfile +0 -42
  23. data/MAINTAINERS.md +0 -29
  24. data/README.md +0 -138
  25. data/RELEASE_NOTES.md +0 -167
  26. data/Rakefile +0 -77
  27. data/appveyor.yml +0 -47
  28. data/docs/CONTRIBUTING.md +0 -8
  29. data/docs/LICENSE +0 -22
  30. data/docs/README.md +0 -78
  31. data/docs/archetypes/default.md +0 -6
  32. data/docs/config.toml +0 -36
  33. data/docs/content/docs/_index.md +0 -5
  34. data/docs/content/docs/drivers/_index.md +0 -27
  35. data/docs/content/docs/drivers/azurerm.md +0 -44
  36. data/docs/content/docs/drivers/vagrant.md +0 -39
  37. data/docs/content/docs/getting-started/00-introduction.md +0 -14
  38. data/docs/content/docs/getting-started/01-installing.md +0 -64
  39. data/docs/content/docs/getting-started/02-getting-help.md +0 -59
  40. data/docs/content/docs/getting-started/03-creating-cookbook.md +0 -46
  41. data/docs/content/docs/getting-started/04-kitchen-yml.md +0 -56
  42. data/docs/content/docs/getting-started/05-instances.md +0 -79
  43. data/docs/content/docs/getting-started/06-writing-recipe.md +0 -21
  44. data/docs/content/docs/getting-started/07-running-converge.md +0 -134
  45. data/docs/content/docs/getting-started/08-manually-verifying.md +0 -55
  46. data/docs/content/docs/getting-started/09-writing-test.md +0 -49
  47. data/docs/content/docs/getting-started/10-running-verify.md +0 -120
  48. data/docs/content/docs/getting-started/11-running-test.md +0 -168
  49. data/docs/content/docs/getting-started/12-adding-platform.md +0 -206
  50. data/docs/content/docs/getting-started/13-adding-feature.md +0 -30
  51. data/docs/content/docs/getting-started/14-adding-suite.md +0 -60
  52. data/docs/content/docs/getting-started/15-adding-test.md +0 -66
  53. data/docs/content/docs/getting-started/16-adding-recipe.md +0 -53
  54. data/docs/content/docs/getting-started/17-excluding-platforms.md +0 -101
  55. data/docs/content/docs/getting-started/18-next-steps.md +0 -23
  56. data/docs/content/docs/getting-started/_index.md +0 -5
  57. data/docs/content/docs/provisioners/_index.md +0 -36
  58. data/docs/content/docs/provisioners/chef.md +0 -69
  59. data/docs/content/docs/provisioners/shell.md +0 -31
  60. data/docs/content/docs/reference/_index.md +0 -5
  61. data/docs/content/docs/reference/configuration.md +0 -53
  62. data/docs/content/docs/reference/examples.md +0 -97
  63. data/docs/content/docs/reference/faq.md +0 -58
  64. data/docs/content/docs/reference/fixtures.md +0 -32
  65. data/docs/content/docs/reference/glossary.md +0 -34
  66. data/docs/content/docs/reference/lifecycle-hooks.md +0 -68
  67. data/docs/content/docs/reference/reboots.md +0 -24
  68. data/docs/content/docs/verifiers/_index.md +0 -14
  69. data/docs/content/docs/verifiers/inspec.md +0 -44
  70. data/docs/content/docs/verifiers/serverspec.md +0 -20
  71. data/docs/static/images/chef-logo.png +0 -0
  72. data/docs/static/images/chef-logo.svg +0 -1
  73. data/docs/static/images/github-banner.png +0 -0
  74. data/docs/static/images/github-banner.svg +0 -71
  75. data/docs/static/images/kitchen-logo.png +0 -0
  76. data/docs/static/images/logo-block.svg +0 -222
  77. data/docs/static/images/logo.png +0 -0
  78. data/docs/static/images/logos-group.png +0 -0
  79. data/docs/static/images/terminal-1.png +0 -0
  80. data/docs/static/images/terminal-1.svg +0 -589
  81. data/docs/static/images/terminal-2.png +0 -0
  82. data/docs/static/images/terminal-2.svg +0 -235
  83. data/docs/static/images/terminal-3.png +0 -0
  84. data/docs/static/images/terminal-3.svg +0 -439
  85. data/docs/static/index.html +0 -59
  86. data/docs/static/javascripts/all.js +0 -348
  87. data/docs/static/javascripts/vendor/foundation.min.js +0 -4
  88. data/docs/static/javascripts/vendor/jquery.min.js +0 -5
  89. data/docs/static/javascripts/vendor/what-input.js +0 -336
  90. data/docs/static/stylesheets/site.css +0 -4667
  91. data/docs/themes/kitchen/layouts/_default/baseof.html +0 -53
  92. data/docs/themes/kitchen/layouts/_default/list.html +0 -4
  93. data/docs/themes/kitchen/layouts/_default/redirect.html +0 -10
  94. data/docs/themes/kitchen/layouts/_default/single.html +0 -6
  95. data/docs/themes/kitchen/layouts/partials/core/head.html +0 -6
  96. data/docs/themes/kitchen/layouts/partials/kitchen/footer.html +0 -18
  97. data/docs/themes/kitchen/layouts/partials/kitchen/head.html +0 -4
  98. data/docs/themes/kitchen/layouts/partials/kitchen/header.html +0 -26
  99. data/docs/themes/kitchen/layouts/partials/search-docs.html +0 -3
  100. data/docs/themes/kitchen/layouts/partials/sidebar.html +0 -33
  101. data/docs/themes/kitchen/layouts/shortcodes/button.html +0 -1
  102. data/docs/themes/kitchen/layouts/shortcodes/codeblock.html +0 -8
  103. data/docs/themes/kitchen/layouts/shortcodes/cta.html +0 -5
  104. data/docs/themes/kitchen/layouts/shortcodes/danger.html +0 -1
  105. data/docs/themes/kitchen/layouts/shortcodes/example_fqdn.html +0 -1
  106. data/docs/themes/kitchen/layouts/shortcodes/info.html +0 -1
  107. data/docs/themes/kitchen/layouts/shortcodes/ol-styled.html +0 -3
  108. data/docs/themes/kitchen/layouts/shortcodes/success.html +0 -1
  109. data/docs/themes/kitchen/layouts/shortcodes/tip.html +0 -1
  110. data/docs/themes/kitchen/layouts/shortcodes/warning.html +0 -1
  111. data/docs/themes/kitchen/static/css/kitchen.css +0 -10
  112. data/docs/themes/kitchen/static/css/kitchen.css.map +0 -7
  113. data/docs/themes/kitchen/static/fonts/Muli-Bold.ttf +0 -0
  114. data/docs/themes/kitchen/static/fonts/Muli-Regular.ttf +0 -0
  115. data/docs/themes/kitchen/static/fonts/Muli-SemiBold.ttf +0 -0
  116. data/docs/themes/kitchen/static/fonts/fontawesome/fa-brands-400.eot +0 -0
  117. data/docs/themes/kitchen/static/fonts/fontawesome/fa-brands-400.svg +0 -1104
  118. data/docs/themes/kitchen/static/fonts/fontawesome/fa-brands-400.ttf +0 -0
  119. data/docs/themes/kitchen/static/fonts/fontawesome/fa-brands-400.woff +0 -0
  120. data/docs/themes/kitchen/static/fonts/fontawesome/fa-brands-400.woff2 +0 -0
  121. data/docs/themes/kitchen/static/fonts/fontawesome/fa-regular-400.eot +0 -0
  122. data/docs/themes/kitchen/static/fonts/fontawesome/fa-regular-400.svg +0 -372
  123. data/docs/themes/kitchen/static/fonts/fontawesome/fa-regular-400.ttf +0 -0
  124. data/docs/themes/kitchen/static/fonts/fontawesome/fa-regular-400.woff +0 -0
  125. data/docs/themes/kitchen/static/fonts/fontawesome/fa-regular-400.woff2 +0 -0
  126. data/docs/themes/kitchen/static/fonts/fontawesome/fa-solid-900.eot +0 -0
  127. data/docs/themes/kitchen/static/fonts/fontawesome/fa-solid-900.svg +0 -1896
  128. data/docs/themes/kitchen/static/fonts/fontawesome/fa-solid-900.ttf +0 -0
  129. data/docs/themes/kitchen/static/fonts/fontawesome/fa-solid-900.woff +0 -0
  130. data/docs/themes/kitchen/static/fonts/fontawesome/fa-solid-900.woff2 +0 -0
  131. data/docs/themes/kitchen/static/images/chef-logo-light.svg +0 -36
  132. data/docs/themes/kitchen/static/images/chef-logo-white.svg +0 -38
  133. data/docs/themes/kitchen/static/images/chef-logo.svg +0 -37
  134. data/docs/themes/kitchen/static/images/favicon.ico +0 -0
  135. data/docs/themes/kitchen/static/js/scripts-all.js +0 -7
  136. data/docs/themes/kitchen/static/js/source/chef-hugo.js +0 -116
  137. data/docs/themes/kitchen/static/js/source/omnitruck.js +0 -82
  138. data/docs/themes/kitchen/static/js/source/segment.js +0 -52
  139. data/docs/themes/kitchen/static/sass/_buttons.scss +0 -161
  140. data/docs/themes/kitchen/static/sass/_core.scss +0 -24
  141. data/docs/themes/kitchen/static/sass/_forms.scss +0 -14
  142. data/docs/themes/kitchen/static/sass/_mixins.scss +0 -133
  143. data/docs/themes/kitchen/static/sass/_typography.scss +0 -34
  144. data/docs/themes/kitchen/static/sass/_variables.scss +0 -82
  145. data/docs/themes/kitchen/static/sass/kitchen.scss +0 -7
  146. data/docs/themes/kitchen/static/sass/kitchen/_footer.scss +0 -50
  147. data/docs/themes/kitchen/static/sass/kitchen/_header.scss +0 -187
  148. data/docs/themes/kitchen/static/sass/kitchen/_homepage.scss +0 -27
  149. data/docs/themes/kitchen/static/sass/kitchen/_utility-bar.scss +0 -173
  150. data/docs/themes/kitchen/static/sass/partials/_alerts.scss +0 -32
  151. data/docs/themes/kitchen/static/sass/partials/_bg.scss +0 -19
  152. data/docs/themes/kitchen/static/sass/partials/_blurbs.scss +0 -25
  153. data/docs/themes/kitchen/static/sass/partials/_callout.scss +0 -15
  154. data/docs/themes/kitchen/static/sass/partials/_cards.scss +0 -54
  155. data/docs/themes/kitchen/static/sass/partials/_dropdown.scss +0 -77
  156. data/docs/themes/kitchen/static/sass/partials/_grid.scss +0 -87
  157. data/docs/themes/kitchen/static/sass/partials/_padding.scss +0 -73
  158. data/docs/themes/kitchen/static/sass/partials/_sidebar.scss +0 -71
  159. data/docs/themes/kitchen/static/sass/partials/_tabs.scss +0 -125
  160. data/docs/themes/kitchen/static/sass/typography/_chroma.scss +0 -366
  161. data/docs/themes/kitchen/static/sass/typography/_code.scss +0 -72
  162. data/docs/themes/kitchen/static/sass/typography/_headers.scss +0 -90
  163. data/docs/themes/kitchen/static/sass/typography/_links.scss +0 -127
  164. data/docs/themes/kitchen/static/sass/typography/_lists.scss +0 -155
  165. data/docs/themes/kitchen/static/sass/typography/_prose.scss +0 -29
  166. data/docs/themes/kitchen/static/sass/typography/_text.scss +0 -221
  167. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_animated.scss +0 -20
  168. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_bordered-pulled.scss +0 -20
  169. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_core.scss +0 -16
  170. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_fixed-width.scss +0 -6
  171. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_icons.scss +0 -992
  172. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_larger.scss +0 -23
  173. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_list.scss +0 -18
  174. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_mixins.scss +0 -57
  175. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_rotated-flipped.scss +0 -23
  176. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_screen-reader.scss +0 -5
  177. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_stacked.scss +0 -31
  178. data/docs/themes/kitchen/static/sass/vendor/fontawesome/_variables.scss +0 -1005
  179. data/docs/themes/kitchen/static/sass/vendor/fontawesome/fa-brands.scss +0 -21
  180. data/docs/themes/kitchen/static/sass/vendor/fontawesome/fa-regular.scss +0 -22
  181. data/docs/themes/kitchen/static/sass/vendor/fontawesome/fa-solid.scss +0 -23
  182. data/docs/themes/kitchen/static/sass/vendor/fontawesome/fontawesome.scss +0 -16
  183. data/docs/themes/kitchen/theme.toml +0 -8
  184. data/features/kitchen_action_commands.feature +0 -164
  185. data/features/kitchen_command.feature +0 -16
  186. data/features/kitchen_console_command.feature +0 -35
  187. data/features/kitchen_defaults.feature +0 -38
  188. data/features/kitchen_diagnose_command.feature +0 -96
  189. data/features/kitchen_help_command.feature +0 -16
  190. data/features/kitchen_init_command.feature +0 -254
  191. data/features/kitchen_list_command.feature +0 -140
  192. data/features/kitchen_login_command.feature +0 -62
  193. data/features/kitchen_sink_command.feature +0 -30
  194. data/features/kitchen_test_command.feature +0 -88
  195. data/features/step_definitions/gem_steps.rb +0 -24
  196. data/features/step_definitions/git_steps.rb +0 -5
  197. data/features/step_definitions/output_steps.rb +0 -5
  198. data/features/support/env.rb +0 -74
  199. data/spec/kitchen/base64_stream_spec.rb +0 -74
  200. data/spec/kitchen/cli_spec.rb +0 -54
  201. data/spec/kitchen/collection_spec.rb +0 -76
  202. data/spec/kitchen/color_spec.rb +0 -51
  203. data/spec/kitchen/config_spec.rb +0 -434
  204. data/spec/kitchen/configurable_spec.rb +0 -1113
  205. data/spec/kitchen/data_munger_spec.rb +0 -2800
  206. data/spec/kitchen/diagnostic_spec.rb +0 -128
  207. data/spec/kitchen/driver/base_spec.rb +0 -132
  208. data/spec/kitchen/driver/dummy_spec.rb +0 -193
  209. data/spec/kitchen/driver/exec_spec.rb +0 -75
  210. data/spec/kitchen/driver/proxy_spec.rb +0 -127
  211. data/spec/kitchen/driver/ssh_base_spec.rb +0 -1136
  212. data/spec/kitchen/driver_spec.rb +0 -106
  213. data/spec/kitchen/errors_spec.rb +0 -317
  214. data/spec/kitchen/instance_spec.rb +0 -1372
  215. data/spec/kitchen/lazy_hash_spec.rb +0 -113
  216. data/spec/kitchen/lifecycle_hooks_spec.rb +0 -171
  217. data/spec/kitchen/loader/yaml_spec.rb +0 -787
  218. data/spec/kitchen/logger_spec.rb +0 -425
  219. data/spec/kitchen/logging_spec.rb +0 -56
  220. data/spec/kitchen/login_command_spec.rb +0 -67
  221. data/spec/kitchen/metadata_chopper_spec.rb +0 -79
  222. data/spec/kitchen/platform_spec.rb +0 -88
  223. data/spec/kitchen/provisioner/base_spec.rb +0 -393
  224. data/spec/kitchen/provisioner/chef/policyfile_spec.rb +0 -140
  225. data/spec/kitchen/provisioner/chef_apply_spec.rb +0 -131
  226. data/spec/kitchen/provisioner/chef_base_spec.rb +0 -1565
  227. data/spec/kitchen/provisioner/chef_solo_spec.rb +0 -602
  228. data/spec/kitchen/provisioner/chef_zero_spec.rb +0 -1013
  229. data/spec/kitchen/provisioner/dummy_spec.rb +0 -96
  230. data/spec/kitchen/provisioner/shell_spec.rb +0 -623
  231. data/spec/kitchen/provisioner_spec.rb +0 -101
  232. data/spec/kitchen/shell_out_spec.rb +0 -146
  233. data/spec/kitchen/ssh_spec.rb +0 -584
  234. data/spec/kitchen/state_file_spec.rb +0 -122
  235. data/spec/kitchen/suite_spec.rb +0 -61
  236. data/spec/kitchen/transport/base_spec.rb +0 -140
  237. data/spec/kitchen/transport/exec_spec.rb +0 -79
  238. data/spec/kitchen/transport/ssh_spec.rb +0 -1317
  239. data/spec/kitchen/transport/winrm_spec.rb +0 -1320
  240. data/spec/kitchen/transport_spec.rb +0 -106
  241. data/spec/kitchen/util_spec.rb +0 -250
  242. data/spec/kitchen/verifier/base_spec.rb +0 -346
  243. data/spec/kitchen/verifier/busser_spec.rb +0 -580
  244. data/spec/kitchen/verifier/dummy_spec.rb +0 -96
  245. data/spec/kitchen/verifier/shell_spec.rb +0 -157
  246. data/spec/kitchen/verifier_spec.rb +0 -114
  247. data/spec/kitchen_spec.rb +0 -112
  248. data/spec/spec_helper.rb +0 -110
  249. data/spec/support/powershell_max_size_spec.rb +0 -39
  250. data/test-kitchen.gemspec +0 -49
  251. data/test/cookbooks/test_cookbook/metadata.rb +0 -6
  252. data/test/cookbooks/test_cookbook/recipes/default.rb +0 -1
  253. data/test/integration/default/default_spec.rb +0 -3
  254. data/testing_windows.md +0 -38
@@ -1,106 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Matt Wrock (<matt@mattwrock.com>)
4
- #
5
- # Copyright (C) 2014, Matt Wrock
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/configurable"
22
- require "kitchen/errors"
23
- require "kitchen/logging"
24
- require "kitchen/transport"
25
- require "kitchen/transport/base"
26
-
27
- module Kitchen
28
- module Transport
29
- class Coolbeans < Kitchen::Transport::Base
30
- end
31
-
32
- class ItDepends < Kitchen::Transport::Base
33
- attr_reader :verify_call_count
34
-
35
- def initialize(config = {})
36
- @verify_call_count = 0
37
- super
38
- end
39
-
40
- def verify_dependencies
41
- @verify_call_count += 1
42
- end
43
- end
44
-
45
- class UnstableDepends < Kitchen::Transport::Base
46
- def verify_dependencies
47
- raise UserError, "Oh noes, you don't have software!"
48
- end
49
- end
50
- end
51
- end
52
-
53
- describe Kitchen::Transport do
54
- describe ".for_plugin" do
55
- before do
56
- Kitchen::Transport.stubs(:require).returns(true)
57
- end
58
-
59
- it "returns a transport object of the correct class" do
60
- transport = Kitchen::Transport.for_plugin("coolbeans", {})
61
-
62
- transport.must_be_kind_of Kitchen::Transport::Coolbeans
63
- end
64
-
65
- it "returns a transport initialized with its config" do
66
- transport = Kitchen::Transport.for_plugin("coolbeans", foo: "bar")
67
-
68
- transport[:foo].must_equal "bar"
69
- end
70
-
71
- it "calls #verify_dependencies on the transport object" do
72
- transport = Kitchen::Transport.for_plugin("it_depends", {})
73
-
74
- transport.verify_call_count.must_equal 1
75
- end
76
-
77
- it "calls #verify_dependencies once per transport require" do
78
- Kitchen::Transport.stubs(:require).returns(true, false)
79
- transport1 = Kitchen::Transport.for_plugin("it_depends", {})
80
- transport1.verify_call_count.must_equal 1
81
- transport2 = Kitchen::Transport.for_plugin("it_depends", {})
82
-
83
- transport2.verify_call_count.must_equal 0
84
- end
85
-
86
- it "raises ClientError if the transport could not be required" do
87
- Kitchen::Transport.stubs(:require).raises(LoadError)
88
-
89
- proc { Kitchen::Transport.for_plugin("coolbeans", {}) }
90
- .must_raise Kitchen::ClientError
91
- end
92
-
93
- it "raises ClientError if the transport's class constant was not found" do
94
- # pretend require worked
95
- Kitchen::Transport.stubs(:require).returns(true)
96
-
97
- proc { Kitchen::Transport.for_plugin("nope", {}) }
98
- .must_raise Kitchen::ClientError
99
- end
100
-
101
- it "raises UserError if #verify_dependencies failes" do
102
- proc { Kitchen::Transport.for_plugin("unstable_depends", {}) }
103
- .must_raise Kitchen::UserError
104
- end
105
- end
106
- end
@@ -1,250 +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
-
21
- require "logger"
22
-
23
- require "kitchen/util"
24
-
25
- describe Kitchen::Util do
26
- describe ".to_logger_level" do
27
- it "returns nil for invalid symbols" do
28
- Kitchen::Util.to_logger_level(:nope).must_be_nil
29
- end
30
-
31
- %w{debug info warn error fatal}.each do |level|
32
- it "returns Logger::#{level.upcase} for :#{level} input" do
33
- Kitchen::Util.to_logger_level(level.to_sym)
34
- .must_equal Logger.const_get(level.upcase)
35
- end
36
- end
37
- end
38
-
39
- describe ".from_logger_level" do
40
- it "returns :fatal for invalid symbols" do
41
- Kitchen::Util.from_logger_level("nope").must_equal :fatal
42
- end
43
-
44
- %w{debug info warn error fatal}.each do |level|
45
- it "returns :#{level} for Logger::#{level.upcase} input" do
46
- Kitchen::Util.from_logger_level(Logger.const_get(level.upcase))
47
- .must_equal(level.to_sym)
48
- end
49
- end
50
- end
51
-
52
- describe ".symbolized_hash" do
53
- it "returns itself if not a hash" do
54
- obj = Object.new
55
- Kitchen::Util.symbolized_hash(obj).must_equal obj
56
- end
57
-
58
- it "preserves a symbolized hash" do
59
- hash = { one: [{ two: "three" }] }
60
- Kitchen::Util.symbolized_hash(hash).must_equal hash
61
- end
62
-
63
- it "converts string keys into symbols" do
64
- Kitchen::Util
65
- .symbolized_hash("one" => [{ "two" => :three, :four => "five" }])
66
- .must_equal(one: [{ two: :three, four: "five" }])
67
- end
68
- end
69
-
70
- describe ".stringified_hash" do
71
- it "returns itself if not a hash" do
72
- obj = Object.new
73
- Kitchen::Util.stringified_hash(obj).must_equal obj
74
- end
75
-
76
- it "preserves a stringified hash" do
77
- hash = { "one" => [{ "two" => "three" }] }
78
- Kitchen::Util.stringified_hash(hash).must_equal hash
79
- end
80
-
81
- it "converts symbol keys into strings" do
82
- Kitchen::Util
83
- .stringified_hash(one: [{ :two => :three, "four" => "five" }])
84
- .must_equal("one" => [{ "two" => :three, "four" => "five" }])
85
- end
86
- end
87
-
88
- describe ".duration" do
89
- it "turns nil into a zero" do
90
- Kitchen::Util.duration(nil).must_equal "(0m0.00s)"
91
- end
92
-
93
- it "formats seconds to 2 digits" do
94
- Kitchen::Util.duration(60).must_equal "(1m0.00s)"
95
- end
96
-
97
- it "formats large values into minutes and seconds" do
98
- Kitchen::Util.duration(48_033).must_equal "(800m33.00s)"
99
- end
100
- end
101
-
102
- describe ".wrap_unix_command" do
103
- it "returns the wrapped command" do
104
- end
105
-
106
- it "returns a false if command is nil" do
107
- Kitchen::Util.wrap_command(nil).must_equal("sh -c '\nfalse\n'")
108
- end
109
-
110
- it "returns a true if command string is empty" do
111
- Kitchen::Util.wrap_command("yoyo").must_equal("sh -c '\nyoyo\n'")
112
- end
113
-
114
- it "handles a command string with a trailing newline" do
115
- Kitchen::Util.wrap_command("yep\n").must_equal("sh -c '\nyep\n'")
116
- end
117
- end
118
-
119
- describe ".outdent!" do
120
- it "modifies the argument string in place, destructively" do
121
- string = "yep"
122
-
123
- Kitchen::Util.outdent!(string).object_id.must_equal string.object_id
124
- end
125
-
126
- it "returns the same string if no leading whitespace exists" do
127
- string = "one\ntwo\nthree"
128
-
129
- Kitchen::Util.outdent!(string).must_equal "one\ntwo\nthree"
130
- end
131
-
132
- it "strips same amount of leading whitespace as found on first line" do
133
- string = " one\n two\n three\nfour"
134
-
135
- Kitchen::Util.outdent!(string).must_equal "one\n two\n three\nfour"
136
- end
137
- end
138
-
139
- describe ".shell_helpers" do
140
- %w{
141
- exists do_wget do_curl do_fetch do_perl do_python do_download
142
- }.each do |func|
143
- it "contains a #{func} shell function" do
144
- Kitchen::Util.shell_helpers.must_match "#{func}() {"
145
- end
146
- end
147
-
148
- it "does not contain bare single quotes" do
149
- Kitchen::Util.shell_helpers.wont_match "'"
150
- end
151
-
152
- def regexify(str)
153
- Regexp.new("^ +" + Regexp.escape(str) + "$")
154
- end
155
- end
156
-
157
- describe ".list_directory" do
158
- before do
159
- @root = Dir.mktmpdir
160
- FileUtils.touch(File.join(@root, "foo"))
161
- Dir.mkdir(File.join(@root, "bar"))
162
- FileUtils.touch(File.join(@root, ".foo"))
163
- FileUtils.touch(File.join(@root, "bar", "baz"))
164
- FileUtils.touch(File.join(@root, "bar", ".baz"))
165
- end
166
-
167
- after do
168
- FileUtils.remove_entry(@root)
169
- end
170
-
171
- it "returns [] when the directory does not exist" do
172
- Kitchen::Util.list_directory(File.join(@root, "notexist")).must_equal []
173
- end
174
-
175
- it "lists one level with no dot files by default" do
176
- listed = Kitchen::Util.list_directory(@root)
177
- expected = %w{
178
- foo
179
- bar
180
- }.map { |f| File.join(@root, f) }
181
- (listed - expected).must_equal []
182
- (expected - listed).must_equal []
183
- end
184
-
185
- it "matches dot files only when include_dot" do
186
- listed = Kitchen::Util.list_directory(@root, include_dot: true)
187
- expected = [
188
- "foo",
189
- ".foo",
190
- "bar",
191
- ].map { |f| File.join(@root, f) }
192
- (listed - expected).must_equal []
193
- (expected - listed).must_equal []
194
- end
195
-
196
- it "recusivly lists only when recurse" do
197
- listed = Kitchen::Util.list_directory(@root, recurse: true)
198
- expected = [
199
- "foo",
200
- "bar",
201
- "bar/baz",
202
- ].map { |f| File.join(@root, f) }
203
- (listed - expected).must_equal []
204
- (expected - listed).must_equal []
205
- end
206
-
207
- it "recusivly lists and provides dots when recurse and include_dot" do
208
- listed = Kitchen::Util.list_directory(@root, recurse: true, include_dot: true)
209
- expected = [
210
- "foo",
211
- ".foo",
212
- "bar",
213
- "bar/baz",
214
- "bar/.",
215
- "bar/.baz",
216
- ].map { |f| File.join(@root, f) }
217
- (listed - expected).must_equal []
218
- (expected - listed).must_equal []
219
- end
220
- end
221
-
222
- describe ".safe_glob" do
223
- before do
224
- @root = Dir.mktmpdir
225
- FileUtils.touch(File.join(@root, "foo"))
226
- Dir.mkdir(File.join(@root, "bar"))
227
- FileUtils.touch(File.join(@root, "foo"))
228
- FileUtils.touch(File.join(@root, "foo.rb"))
229
- FileUtils.touch(File.join(@root, "bar", "baz.rb"))
230
- end
231
-
232
- after do
233
- FileUtils.remove_entry(@root)
234
- end
235
-
236
- it "globs without parameters" do
237
- Kitchen::Util.safe_glob(@root, "**/*").must_equal Dir.glob(File.join(@root, "**/*"))
238
- end
239
-
240
- it "globs with parameters" do
241
- Kitchen::Util.safe_glob(@root, "**/*", File::FNM_DOTMATCH).must_equal(
242
- Dir.glob(File.join(@root, "**/*"), File::FNM_DOTMATCH))
243
- end
244
-
245
- it "globs a folder that does not exist" do
246
- dne_dir = File.join(@root, "notexist")
247
- Kitchen::Util.safe_glob(dne_dir, "**/*").must_equal Dir.glob(File.join(dne_dir, "**/*"))
248
- end
249
- end
250
- end
@@ -1,346 +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
- require_relative "../ssh_spec"
21
-
22
- require "logger"
23
- require "stringio"
24
-
25
- require "kitchen/verifier/base"
26
- require "kitchen/transport/base"
27
-
28
- module Kitchen
29
- module Verifier
30
- class TestingDummy < Kitchen::Verifier::Base
31
- attr_reader :called_create_sandbox, :called_cleanup_sandbox
32
-
33
- def install_command
34
- "install"
35
- end
36
-
37
- def init_command
38
- "init"
39
- end
40
-
41
- def prepare_command
42
- "prepare"
43
- end
44
-
45
- def run_command
46
- "run"
47
- end
48
-
49
- def create_sandbox
50
- @called_create_sandbox = true
51
- end
52
-
53
- def cleanup_sandbox
54
- @called_cleanup_sandbox = true
55
- end
56
-
57
- def sandbox_path
58
- "/tmp/sandbox"
59
- end
60
- end
61
- end
62
- end
63
-
64
- describe Kitchen::Verifier::Base do
65
- let(:logged_output) { StringIO.new }
66
- let(:logger) { Logger.new(logged_output) }
67
- let(:platform) { stub(os_type: nil, shell_type: nil) }
68
- let(:suite) { stub(name: "germany") }
69
- let(:config) { Hash.new }
70
-
71
- let(:transport) do
72
- t = mock("transport")
73
- t.responds_like_instance_of(Kitchen::Transport::Base)
74
- t
75
- end
76
-
77
- let(:instance) do
78
- stub(
79
- name: "coolbeans",
80
- to_str: "instance",
81
- logger: logger,
82
- platform: platform,
83
- suite: suite,
84
- transport: transport
85
- )
86
- end
87
-
88
- let(:verifier) do
89
- Kitchen::Verifier::Base.new(config).finalize_config!(instance)
90
- end
91
-
92
- describe "configuration" do
93
- describe "for unix operating systems" do
94
- before { platform.stubs(:os_type).returns("unix") }
95
-
96
- it ":sudo defaults to true" do
97
- verifier[:sudo].must_equal true
98
- end
99
-
100
- it ":sudo_command defaults to sudo -E" do
101
- verifier[:sudo_command].must_equal "sudo -E"
102
- end
103
-
104
- it ":root_path defaults to '/tmp/verifier'" do
105
- verifier[:root_path].must_equal "/tmp/verifier"
106
- end
107
- end
108
-
109
- describe "for windows operating systems" do
110
- before { platform.stubs(:os_type).returns("windows") }
111
-
112
- it ":sudo defaults to nil" do
113
- verifier[:sudo].must_be_nil
114
- end
115
-
116
- it ":sudo_command defaults to nil" do
117
- verifier[:sudo_command].must_be_nil
118
- end
119
-
120
- it ':root_path defaults to $env:TEMP\\verifier' do
121
- verifier[:root_path].must_equal '$env:TEMP\\verifier'
122
- end
123
- end
124
-
125
- it ":suite_name defaults to the passed in suite name" do
126
- verifier[:suite_name].must_equal "germany"
127
- end
128
-
129
- it ":http_proxy defaults to nil" do
130
- verifier[:http_proxy].must_be_nil
131
- end
132
-
133
- it ":http_proxys defaults to nil" do
134
- verifier[:https_proxy].must_be_nil
135
- end
136
-
137
- it ":ftp_proxy defaults to nil" do
138
- verifier[:ftp_proxy].must_be_nil
139
- end
140
- end
141
-
142
- describe "#call" do
143
- let(:state) { Hash.new }
144
- let(:cmd) { verifier.call(state) }
145
-
146
- let(:connection) do
147
- c = mock("transport_connection")
148
- c.responds_like_instance_of(Kitchen::Transport::Base::Connection)
149
- c
150
- end
151
-
152
- let(:verifier) do
153
- Kitchen::Verifier::TestingDummy.new(config).finalize_config!(instance)
154
- end
155
-
156
- before do
157
- FakeFS.activate!
158
- FileUtils.mkdir_p(File.join(verifier.sandbox_path, "stuff"))
159
- transport.stubs(:connection).yields(connection)
160
- connection.stubs(:execute)
161
- connection.stubs(:upload)
162
- end
163
-
164
- after do
165
- FakeFS.deactivate!
166
- FakeFS::FileSystem.clear
167
- end
168
-
169
- it "creates the sandbox" do
170
- verifier.expects(:create_sandbox)
171
-
172
- cmd
173
- end
174
-
175
- it "ensures that the sandbox is cleanup up" do
176
- transport.stubs(:connection).raises
177
- verifier.expects(:cleanup_sandbox)
178
-
179
- begin
180
- cmd
181
- rescue # rubocop:disable Lint/HandleExceptions
182
- end
183
- end
184
-
185
- it "yields a connection given the state" do
186
- state[:a] = "b"
187
- transport.expects(:connection).with(state).yields(connection)
188
-
189
- cmd
190
- end
191
-
192
- it "invokes the verifier commands over the transport" do
193
- order = sequence("order")
194
- connection.expects(:execute).with("install").in_sequence(order)
195
- connection.expects(:execute).with("init").in_sequence(order)
196
- connection.expects(:execute).with("prepare").in_sequence(order)
197
- connection.expects(:execute).with("run").in_sequence(order)
198
-
199
- cmd
200
- end
201
-
202
- it "logs to info" do
203
- cmd
204
-
205
- logged_output.string
206
- .must_match(/INFO -- : Transferring files to instance$/)
207
- end
208
-
209
- it "uploads sandbox files" do
210
- connection.expects(:upload).with(["/tmp/sandbox/stuff"], "/tmp/verifier")
211
-
212
- cmd
213
- end
214
-
215
- it "logs to debug" do
216
- cmd
217
-
218
- logged_output.string.must_match(/DEBUG -- : Transfer complete$/)
219
- end
220
-
221
- it "raises an ActionFailed on transfer when TransportFailed is raised" do
222
- connection.stubs(:upload)
223
- .raises(Kitchen::Transport::TransportFailed.new("dang"))
224
-
225
- proc { cmd }.must_raise Kitchen::ActionFailed
226
- end
227
-
228
- it "raises an ActionFailed on execute when TransportFailed is raised" do
229
- connection.stubs(:execute)
230
- .raises(Kitchen::Transport::TransportFailed.new("dang"))
231
-
232
- proc { cmd }.must_raise Kitchen::ActionFailed
233
- end
234
- end
235
-
236
- [:init_command, :install_command, :prepare_command, :run_command].each do |cmd|
237
- it "has a #{cmd} method" do
238
- verifier.public_send(cmd).must_be_nil
239
- end
240
- end
241
-
242
- describe "sandbox" do
243
- after do
244
- begin
245
- verifier.cleanup_sandbox
246
- rescue # rubocop:disable Lint/HandleExceptions
247
- end
248
- end
249
-
250
- it "raises ClientError if #sandbox_path is called before #create_sandbox" do
251
- proc { verifier.sandbox_path }.must_raise Kitchen::ClientError
252
- end
253
-
254
- it "#create_sandbox creates a temporary directory" do
255
- verifier.create_sandbox
256
-
257
- File.directory?(verifier.sandbox_path).must_equal true
258
- format("%o", File.stat(verifier.sandbox_path).mode)[1, 4]
259
- .must_equal "0755"
260
- end
261
-
262
- it "#create_sandbox logs an info message" do
263
- verifier.create_sandbox
264
-
265
- logged_output.string.must_match info_line("Preparing files for transfer")
266
- end
267
-
268
- it "#create_sandbox logs a debug message" do
269
- verifier.create_sandbox
270
-
271
- logged_output.string
272
- .must_match debug_line_starting_with("Creating local sandbox in ")
273
- end
274
-
275
- it "#cleanup_sandbox deletes the sandbox directory" do
276
- verifier.create_sandbox
277
- verifier.cleanup_sandbox
278
-
279
- File.directory?(verifier.sandbox_path).must_equal false
280
- end
281
-
282
- it "#cleanup_sandbox logs a debug message" do
283
- verifier.create_sandbox
284
- verifier.cleanup_sandbox
285
-
286
- logged_output.string
287
- .must_match debug_line_starting_with("Cleaning up local sandbox in ")
288
- end
289
-
290
- def info_line(msg)
291
- /^I, .* : #{Regexp.escape(msg)}$/
292
- end
293
-
294
- def debug_line_starting_with(msg)
295
- /^D, .* : #{Regexp.escape(msg)}/
296
- end
297
- end
298
-
299
- describe "#sudo" do
300
- describe "with :sudo set" do
301
- before { config[:sudo] = true }
302
-
303
- it "prepends sudo command" do
304
- verifier.send(:sudo, "wakka").must_equal("sudo -E wakka")
305
- end
306
-
307
- it "customizes sudo when :sudo_command is set" do
308
- config[:sudo_command] = "blueto -Ohai"
309
-
310
- verifier.send(:sudo, "wakka").must_equal("blueto -Ohai wakka")
311
- end
312
- end
313
-
314
- describe "with :sudo falsey" do
315
- before { config[:sudo] = false }
316
-
317
- it "does not include sudo command" do
318
- verifier.send(:sudo, "wakka").must_equal("wakka")
319
- end
320
-
321
- it "does not include sudo command, even when :sudo_command is set" do
322
- config[:sudo_command] = "blueto -Ohai"
323
-
324
- verifier.send(:sudo, "wakka").must_equal("wakka")
325
- end
326
- end
327
- end
328
-
329
- describe "#prefix_command" do
330
- describe "with :command_prefix set" do
331
- before { config[:command_prefix] = "my_prefix" }
332
-
333
- it "prepends the command with the prefix" do
334
- verifier.send(:prefix_command, "my_command").must_equal("my_prefix my_command")
335
- end
336
- end
337
-
338
- describe "with :command_prefix unset" do
339
- before { config[:command_prefix] = nil }
340
-
341
- it "returns an unaltered command" do
342
- verifier.send(:prefix_command, "my_command").must_equal("my_command")
343
- end
344
- end
345
- end
346
- end