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,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/verifier/dummy"
25
-
26
- describe Kitchen::Verifier::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(:verifier) do
48
- Kitchen::Verifier::Dummy.new(config).finalize_config!(instance)
49
- end
50
-
51
- it "verifier api_version is 1" do
52
- verifier.diagnose_plugin[:api_version].must_equal 1
53
- end
54
-
55
- it "plugin_version is set to Kitchen::VERSION" do
56
- verifier.diagnose_plugin[:version].must_equal Kitchen::VERSION
57
- end
58
-
59
- describe "configuration" do
60
- it "sets :sleep to 0 by default" do
61
- verifier[:sleep].must_equal 0
62
- end
63
-
64
- it "sets :random_failure to false by default" do
65
- verifier[: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
- verifier.expects(:sleep).with(12.5).returns(true)
73
-
74
- verifier.call(state)
75
- end
76
-
77
- it "raises ActionFailed if :fail is set" do
78
- config[:fail] = true
79
-
80
- proc { verifier.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
- verifier.stubs(:randomly_fail?).returns(true)
86
-
87
- proc { verifier.call(state) }.must_raise Kitchen::ActionFailed
88
- end
89
-
90
- it "logs a converge event to INFO" do
91
- verifier.call(state)
92
-
93
- logged_output.string.must_match(/^.+ INFO .+ \[Dummy\] Verify on .+$/)
94
- end
95
- end
96
- end
@@ -1,157 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: SAWANOBORI Yukihiko (<sawanoboriyu@higanworks.com>)
4
- #
5
- # Copyright (C) 2015, HiganWorks LLC
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/verifier/shell"
25
- require "kitchen/transport/ssh"
26
-
27
- describe Kitchen::Verifier::Shell do
28
- let(:logged_output) { StringIO.new }
29
- let(:logger) { Logger.new(logged_output) }
30
- let(:platform) { stub(os_type: nil, shell_type: nil, name: "coolbeans") }
31
- let(:suite) { stub(name: "fries") }
32
- let(:state) { Hash.new }
33
-
34
- let(:config) do
35
- { test_base_path: "/basist", kitchen_root: "/rooty" }
36
- end
37
-
38
- let(:instance) do
39
- stub(
40
- name: [platform.name, suite.name].join("-"),
41
- to_str: "instance",
42
- logger: logger,
43
- suite: suite,
44
- platform: platform
45
- )
46
- end
47
-
48
- let(:verifier) do
49
- Kitchen::Verifier::Shell.new(config).finalize_config!(instance)
50
- end
51
-
52
- it "verifier api_version is 1" do
53
- verifier.diagnose_plugin[:api_version].must_equal 1
54
- end
55
-
56
- it "plugin_version is set to Kitchen::VERSION" do
57
- verifier.diagnose_plugin[:version].must_equal Kitchen::VERSION
58
- end
59
-
60
- describe "configuration" do
61
- it "sets :sleep to 0 by default" do
62
- verifier[:sleep].must_equal 0
63
- end
64
-
65
- it "sets :command to 'true' by default" do
66
- verifier[:command].must_equal "true"
67
- end
68
-
69
- it "sets :live_stream to stdout by default" do
70
- verifier[:live_stream].must_equal $stdout
71
- end
72
- end
73
-
74
- describe "#call" do
75
- describe "#shell_out" do
76
- it "calls sleep if :sleep value is greater than 0" do
77
- config[:sleep] = 3
78
- verifier.expects(:sleep).with(1).returns(true).at_least(3)
79
-
80
- verifier.call(state)
81
- end
82
-
83
- it "states are set to environment" do
84
- state[:hostname] = "testhost"
85
- state[:server_id] = "i-xxxxxx"
86
- state[:port] = 22
87
- verifier.call(state)
88
- config[:shellout_opts][:environment]["KITCHEN_HOSTNAME"].must_equal "testhost"
89
- config[:shellout_opts][:environment]["KITCHEN_SERVER_ID"].must_equal "i-xxxxxx"
90
- config[:shellout_opts][:environment]["KITCHEN_PORT"].must_equal "22"
91
- config[:shellout_opts][:environment]["KITCHEN_INSTANCE"].must_equal "coolbeans-fries"
92
- config[:shellout_opts][:environment]["KITCHEN_PLATFORM"].must_equal "coolbeans"
93
- config[:shellout_opts][:environment]["KITCHEN_SUITE"].must_equal "fries"
94
- end
95
-
96
- it "raises ActionFailed if set false to :command" do
97
- config[:command] = "false"
98
-
99
- proc { verifier.call(state) }.must_raise Kitchen::ActionFailed
100
- end
101
-
102
- it "logs a converge event to INFO" do
103
- verifier.call(state)
104
-
105
- logged_output.string.must_match(/^.+ INFO .+ \[Shell\] Verify on .+$/)
106
- end
107
- end
108
-
109
- describe "remote_exec" do
110
- let(:transport) do
111
- t = mock("transport")
112
- t.responds_like_instance_of(Kitchen::Transport::Ssh)
113
- t
114
- end
115
-
116
- let(:connection) do
117
- c = mock("transport_connection")
118
- c.responds_like_instance_of(Kitchen::Transport::Ssh::Connection)
119
- c
120
- end
121
-
122
- let(:instance) do
123
- stub(
124
- name: "coolbeans",
125
- to_str: "instance",
126
- logger: logger,
127
- platform: platform,
128
- suite: suite,
129
- transport: transport
130
- )
131
- end
132
-
133
- before do
134
- transport.stubs(:connection).yields(connection)
135
- connection.stubs(:execute)
136
- end
137
-
138
- it "execute command onto instance." do
139
- config[:remote_exec] = true
140
-
141
- transport.expects(:connection).with(state).yields(connection)
142
- verifier.call(state)
143
- end
144
- end
145
- end
146
-
147
- describe "#run_command" do
148
- it "execute localy and returns nil" do
149
- verifier.run_command
150
- end
151
-
152
- it "returns string when remote_exec" do
153
- config[:remote_exec] = true
154
- verifier.run_command.must_equal "true"
155
- end
156
- end
157
- end
@@ -1,114 +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 "kitchen/verifier"
22
-
23
- require "kitchen/configurable"
24
- module Kitchen
25
- module Verifier
26
- class Base
27
- include Configurable
28
- def initialize(config = {})
29
- init_config(config)
30
- end
31
- end
32
- end
33
- end
34
-
35
- module Kitchen
36
- module Verifier
37
- class Coolbeans < Kitchen::Verifier::Base
38
- end
39
-
40
- class ItDepends < Kitchen::Verifier::Base
41
- attr_reader :verify_call_count
42
-
43
- def initialize(config = {})
44
- @verify_call_count = 0
45
- super
46
- end
47
-
48
- def verify_dependencies
49
- @verify_call_count += 1
50
- end
51
- end
52
-
53
- class UnstableDepends < Kitchen::Verifier::Base
54
- def verify_dependencies
55
- raise UserError, "Oh noes, you don't have software!"
56
- end
57
- end
58
- end
59
- end
60
-
61
- describe Kitchen::Verifier do
62
- describe ".for_plugin" do
63
- before do
64
- Kitchen::Verifier.stubs(:require).returns(true)
65
- end
66
-
67
- it "returns a verifier object of the correct class" do
68
- verifier = Kitchen::Verifier.for_plugin("coolbeans", {})
69
-
70
- verifier.must_be_kind_of Kitchen::Verifier::Coolbeans
71
- end
72
-
73
- it "returns a verifier initialized with its config" do
74
- verifier = Kitchen::Verifier.for_plugin("coolbeans", foo: "bar")
75
-
76
- verifier[:foo].must_equal "bar"
77
- end
78
-
79
- it "calls #verify_dependencies on the transport object" do
80
- verifier = Kitchen::Verifier.for_plugin("it_depends", {})
81
-
82
- verifier.verify_call_count.must_equal 1
83
- end
84
-
85
- it "calls #verify_dependencies once per verifier require" do
86
- Kitchen::Verifier.stubs(:require).returns(true, false)
87
- verifier1 = Kitchen::Verifier.for_plugin("it_depends", {})
88
- verifier1.verify_call_count.must_equal 1
89
- verifier2 = Kitchen::Verifier.for_plugin("it_depends", {})
90
-
91
- verifier2.verify_call_count.must_equal 0
92
- end
93
-
94
- it "raises ClientError if the verifier could not be required" do
95
- Kitchen::Verifier.stubs(:require).raises(LoadError)
96
-
97
- proc { Kitchen::Verifier.for_plugin("coolbeans", {}) }
98
- .must_raise Kitchen::ClientError
99
- end
100
-
101
- it "raises ClientError if the verifier's class constant was not found" do
102
- # pretend require worked
103
- Kitchen::Verifier.stubs(:require).returns(true)
104
-
105
- proc { Kitchen::Verifier.for_plugin("nope", {}) }
106
- .must_raise Kitchen::ClientError
107
- end
108
-
109
- it "raises UserError if #verify_dependencies failes" do
110
- proc { Kitchen::Verifier.for_plugin("unstable_depends", {}) }
111
- .must_raise Kitchen::UserError
112
- end
113
- end
114
- end
@@ -1,112 +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
-
23
- describe "Kitchen" do
24
- let(:stdout) { StringIO.new }
25
-
26
- before do
27
- FakeFS.activate!
28
- FileUtils.mkdir_p(Dir.pwd)
29
- stdout.stubs(:tty?).returns(true)
30
- @orig_stdout = $stdout
31
- $stdout = stdout
32
- end
33
-
34
- after do
35
- $stdout = @orig_stdout
36
- FakeFS.deactivate!
37
- FakeFS::FileSystem.clear
38
- end
39
-
40
- describe "defaults" do
41
- it "sets DEFAULT_LOG_LEVEL to :info" do
42
- Kitchen::DEFAULT_LOG_LEVEL.must_equal :info
43
- end
44
-
45
- it "sets DEFAULT_TEST_DIR to test/integration, which is frozen" do
46
- Kitchen::DEFAULT_TEST_DIR.must_equal "test/integration"
47
- Kitchen::DEFAULT_TEST_DIR.frozen?.must_equal true
48
- end
49
-
50
- it "sets DEFAULT_LOG_DIR to .kitchen/logs, which is frozen" do
51
- Kitchen::DEFAULT_LOG_DIR.must_equal ".kitchen/logs"
52
- Kitchen::DEFAULT_LOG_DIR.frozen?.must_equal true
53
- end
54
- end
55
-
56
- it ".tty? returns true if $stdout.tty? is true" do
57
- Kitchen.tty?.must_equal true
58
- end
59
-
60
- it ".tty? returns flse is $stdout.tty? is false" do
61
- stdout.stubs(:tty?).returns(false)
62
-
63
- Kitchen.tty?.must_equal false
64
- end
65
-
66
- it ".source_root returns the root path of the gem" do
67
- Kitchen.source_root
68
- .must_equal Pathname.new(File.expand_path("../..", __FILE__))
69
- end
70
-
71
- it ".default_logger is a Kitchen::Logger" do
72
- Kitchen.default_logger.must_be_instance_of Kitchen::Logger
73
- end
74
-
75
- it ".default_logger returns a $stdout logger" do
76
- Kitchen.default_logger.warn("uhoh")
77
-
78
- stdout.string.must_match %r{ uhoh$}
79
- end
80
-
81
- it ".default_file_logger is a Kitchen::Logger" do
82
- Kitchen.default_file_logger.must_be_instance_of Kitchen::Logger
83
- end
84
-
85
- it ".default_file_logger returns a logger that uses $stdout" do
86
- Kitchen.default_logger.warn("uhoh")
87
-
88
- stdout.string.must_match %r{ uhoh$}
89
- end
90
-
91
- it ".default_file_logger returns a logger that uses a file" do
92
- Kitchen.default_file_logger.warn("uhoh")
93
-
94
- IO.read(File.join(%w{.kitchen logs kitchen.log}))
95
- .must_match %r{ -- Kitchen: uhoh$}
96
- end
97
-
98
- it ".default_file_logger accepts a level and log_overwrite" do
99
- l = Kitchen.default_file_logger(:error, false)
100
-
101
- l.level.must_equal 3
102
- l.log_overwrite.must_equal false
103
- end
104
-
105
- it "sets Kitchen.logger to a Kitchen::Logger" do
106
- Kitchen.default_logger.must_be_instance_of Kitchen::Logger
107
- end
108
-
109
- it "sets Kitchen.mutex to a Mutex" do
110
- Kitchen.mutex.must_be_instance_of Mutex
111
- end
112
- end