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,128 +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/diagnostic"
22
-
23
- describe Kitchen::Diagnostic do
24
- let(:loader) do
25
- stub(diagnose: { who: "loader" })
26
- end
27
-
28
- let(:instances) do
29
- [
30
- stub(
31
- name: "i1",
32
- diagnose: { stuff: "sup" },
33
- diagnose_plugins: {
34
- driver: { name: "driva", a: "b" },
35
- provisioner: { name: "prov", c: "d" },
36
- transport: { name: "transa", e: "f" },
37
- verifier: { name: "verve", g: "h" },
38
- }
39
- ),
40
- stub(
41
- name: "i2",
42
- diagnose: { stuff: "yo" },
43
- diagnose_plugins: {
44
- driver: { name: "driva", a: "b" },
45
- provisioner: { name: "presto", i: "j" },
46
- transport: { name: "tressa", k: "l" },
47
- verifier: { name: "verve", g: "h" },
48
- }
49
- ),
50
- ]
51
- end
52
-
53
- it "#read returns a Hash" do
54
- Kitchen::Diagnostic.new.read.must_be_instance_of Hash
55
- end
56
-
57
- it "#read returns the version of Test Kitchen" do
58
- Kitchen::Diagnostic.new.read["kitchen_version"].must_equal Kitchen::VERSION
59
- end
60
-
61
- it "#read returns a timestamp in UTC" do
62
- Time.stubs(:now).returns(Time.at(0))
63
-
64
- Kitchen::Diagnostic.new.read["timestamp"]
65
- .must_equal "1970-01-01 00:00:00 UTC"
66
- end
67
-
68
- it "#read doesn't return a loader hash if not given one" do
69
- Kitchen::Diagnostic.new.read.key?("loader").must_equal false
70
- end
71
-
72
- it "#read returns the loader's diganose hash if a loader is present" do
73
- Kitchen::Diagnostic.new(loader: loader)
74
- .read["loader"].must_equal("who" => "loader")
75
- end
76
-
77
- it "#read returns an error hash for loader if error hash is passed in" do
78
- Kitchen::Diagnostic.new(loader: { error: "damn" })
79
- .read["loader"].must_equal("error" => "damn")
80
- end
81
-
82
- it "#read returns the unique set of plugins' diagnose hash if :plugins is set" do
83
- Kitchen::Diagnostic.new(instances: instances, plugins: true)
84
- .read["plugins"]
85
- .must_equal(
86
- "driver" => {
87
- "driva" => { "a" => "b" },
88
- },
89
- "provisioner" => {
90
- "prov" => { "c" => "d" },
91
- "presto" => { "i" => "j" },
92
- },
93
- "transport" => {
94
- "transa" => { "e" => "f" },
95
- "tressa" => { "k" => "l" },
96
- },
97
- "verifier" => {
98
- "verve" => { "g" => "h" },
99
- }
100
- )
101
- end
102
-
103
- it "#read returns an empty plugins hash if no instances were given" do
104
- Kitchen::Diagnostic.new(plugins: true)
105
- .read["plugins"].must_equal Hash.new
106
- end
107
-
108
- it "#read returns an empty instances hash if no instances were given" do
109
- Kitchen::Diagnostic.new.read["instances"].must_equal Hash.new
110
- end
111
-
112
- it "#read returns an error hash for plugins if error hash is passed in" do
113
- Kitchen::Diagnostic.new(
114
- instances: { error: "shoot" }, plugins: true
115
- ).read["plugins"].must_equal("error" => "shoot")
116
- end
117
-
118
- it "#read returns the instances' diganose hashes if instances are present" do
119
- Kitchen::Diagnostic.new(instances: instances)
120
- .read["instances"]
121
- .must_equal("i1" => { "stuff" => "sup" }, "i2" => { "stuff" => "yo" })
122
- end
123
-
124
- it "#read returns an error hash for instances if error hash is passed in" do
125
- Kitchen::Diagnostic.new(instances: { error: "shoot" })
126
- .read["instances"].must_equal("error" => "shoot")
127
- end
128
- end
@@ -1,132 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
- #
5
- # Copyright (C) 2012, Fletcher Nichol
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require_relative "../../spec_helper"
20
- require "logger"
21
- require "stringio"
22
-
23
- require "kitchen"
24
-
25
- module Kitchen
26
- module Driver
27
- class Speedy < Base
28
- end
29
-
30
- class Dodgy < Base
31
- no_parallel_for :setup
32
- end
33
-
34
- class Slow < Base
35
- no_parallel_for :create, :destroy
36
- no_parallel_for :verify
37
- end
38
- end
39
- end
40
-
41
- describe Kitchen::Driver::Base do
42
- let(:logged_output) { StringIO.new }
43
- let(:logger) { Logger.new(logged_output) }
44
- let(:config) { Hash.new }
45
- let(:state) { Hash.new }
46
-
47
- let(:busser) do
48
- stub(setup_cmd: "setup", sync_cmd: "sync", run_cmd: "run")
49
- end
50
-
51
- let(:instance) do
52
- stub(
53
- name: "coolbeans",
54
- logger: logger,
55
- busser: busser,
56
- to_str: "instance"
57
- )
58
- end
59
-
60
- let(:driver) do
61
- Kitchen::Driver::Base.new(config).finalize_config!(instance)
62
- end
63
-
64
- it "#instance returns its instance" do
65
- driver.instance.must_equal instance
66
- end
67
-
68
- it "#puts calls logger.info" do
69
- driver.send(:puts, "yo")
70
-
71
- logged_output.string.must_match(/I, /)
72
- logged_output.string.must_match(/yo\n/)
73
- end
74
-
75
- it "#print calls logger.info" do
76
- driver.send(:print, "yo")
77
-
78
- logged_output.string.must_match(/I, /)
79
- logged_output.string.must_match(/yo\n/)
80
- end
81
-
82
- [:create, :setup, :verify, :destroy].each do |action|
83
- it "has a #{action} method that takes state" do
84
- # TODO: revert back
85
- # state = Hash.new
86
- # driver.public_send(action, state).must_be_nil
87
- driver.respond_to?(action)
88
- end
89
- end
90
-
91
- describe ".pre_create_command" do
92
- it "run command" do
93
- Kitchen::Driver::Base.any_instance.stubs(:run_command).returns(true)
94
-
95
- config[:pre_create_command] = "echo works 2&>1 > /dev/null"
96
- driver.expects(:run_command).with("echo works 2&>1 > /dev/null")
97
- driver.send(:pre_create_command)
98
- end
99
-
100
- it "error if cannot run" do
101
- class ShellCommandFailed < Kitchen::ShellOut::ShellCommandFailed; end
102
- Kitchen::Driver::Base.any_instance.stubs(:run_command).raises(ShellCommandFailed, "Expected process to exit with [0], but received '1'")
103
-
104
- config[:pre_create_command] = "touch /this/dir/does/not/exist 2&>1 > /dev/null"
105
- proc { driver.send(:pre_create_command) }.must_raise Kitchen::ActionFailed
106
- end
107
- end
108
-
109
- describe ".no_parallel_for" do
110
- it "registers no serial actions when none are declared" do
111
- Kitchen::Driver::Speedy.serial_actions.must_be_nil
112
- end
113
-
114
- it "registers a single serial action method" do
115
- Kitchen::Driver::Dodgy.serial_actions.must_equal [:setup]
116
- end
117
-
118
- it "registers multiple serial action methods" do
119
- actions = Kitchen::Driver::Slow.serial_actions
120
-
121
- actions.must_include :create
122
- actions.must_include :verify
123
- actions.must_include :destroy
124
- end
125
-
126
- it "raises a ClientError if value is not an action method" do
127
- proc do
128
- Class.new(Kitchen::Driver::Base) { no_parallel_for :telling_stories }
129
- end.must_raise Kitchen::ClientError
130
- end
131
- end
132
- end
@@ -1,193 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
- #
5
- # Copyright (C) 2012, Fletcher Nichol
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require_relative "../../spec_helper"
20
- require "logger"
21
- require "stringio"
22
-
23
- require "kitchen/driver/dummy"
24
-
25
- describe Kitchen::Driver::Dummy do
26
- let(:logged_output) { StringIO.new }
27
- let(:logger) { Logger.new(logged_output) }
28
- let(:config) { Hash.new }
29
- let(:state) { Hash.new }
30
-
31
- let(:instance) do
32
- stub(name: "coolbeans", logger: logger, to_str: "instance")
33
- end
34
-
35
- let(:driver) do
36
- Kitchen::Driver::Dummy.new(config).finalize_config!(instance)
37
- end
38
-
39
- it "driver api_version is 2" do
40
- driver.diagnose_plugin[:api_version].must_equal 2
41
- end
42
-
43
- it "plugin_version is set to Kitchen::VERSION" do
44
- driver.diagnose_plugin[:version].must_equal Kitchen::VERSION
45
- end
46
-
47
- describe "default_config" do
48
- it "sets :sleep to 0 by default" do
49
- driver[:sleep].must_equal 0
50
- end
51
-
52
- it "sets :random_failure to false by default" do
53
- driver[:random_failure].must_equal false
54
- end
55
- end
56
-
57
- describe "#create" do
58
- it "sets :my_id to a unique value as an example" do
59
- driver.create(state)
60
-
61
- state[:my_id].must_match(/^coolbeans-/)
62
- end
63
-
64
- it "calls sleep if :sleep value is greater than 0" do
65
- config[:sleep] = 12.5
66
- driver.expects(:sleep).with(12.5).returns(true)
67
-
68
- driver.create(state)
69
- end
70
-
71
- it "raises ActionFailed if :fail_create is set" do
72
- config[:fail_create] = true
73
-
74
- proc { driver.create(state) }.must_raise Kitchen::ActionFailed
75
- end
76
-
77
- it "randomly raises ActionFailed if :random_failure is set" do
78
- config[:random_failure] = true
79
- driver.stubs(:randomly_fail?).returns(true)
80
-
81
- proc { driver.create(state) }.must_raise Kitchen::ActionFailed
82
- end
83
-
84
- it "will only raise ActionFailed if :random_failure is set" do
85
- config[:random_failure] = true
86
-
87
- begin
88
- driver.create(state)
89
- rescue Kitchen::ActionFailed
90
- # If exception is anything other than Kitchen::ActionFailed, this spec
91
- # will fail
92
- true
93
- end
94
- end
95
-
96
- it "logs a create event to INFO" do
97
- driver.create(state)
98
-
99
- logged_output.string.must_match(/^.+ INFO .+ \[Dummy\] Create on .+$/)
100
- end
101
- end
102
-
103
- describe "#setup" do
104
- it "calls sleep if :sleep value is greater than 0" do
105
- config[:sleep] = 12.5
106
- driver.expects(:sleep).with(12.5).returns(true)
107
-
108
- driver.setup(state)
109
- end
110
-
111
- it "raises ActionFailed if :fail_setup is set" do
112
- config[:fail_setup] = true
113
-
114
- proc { driver.setup(state) }.must_raise Kitchen::ActionFailed
115
- end
116
-
117
- it "randomly raises ActionFailed if :random_failure is set" do
118
- config[:random_failure] = true
119
- driver.stubs(:randomly_fail?).returns(true)
120
-
121
- proc { driver.setup(state) }.must_raise Kitchen::ActionFailed
122
- end
123
-
124
- it "logs a setup event to INFO" do
125
- driver.setup(state)
126
-
127
- logged_output.string.must_match(/^.+ INFO .+ \[Dummy\] Setup on .+$/)
128
- end
129
- end
130
-
131
- describe "#verify" do
132
- it "calls sleep if :sleep value is greater than 0" do
133
- config[:sleep] = 12.5
134
- driver.expects(:sleep).with(12.5).returns(true)
135
-
136
- driver.verify(state)
137
- end
138
-
139
- it "raises ActionFailed if :fail_verify is set" do
140
- config[:fail_verify] = true
141
-
142
- proc { driver.verify(state) }.must_raise Kitchen::ActionFailed
143
- end
144
-
145
- it "randomly raises ActionFailed if :random_failure is set" do
146
- config[:random_failure] = true
147
- driver.stubs(:randomly_fail?).returns(true)
148
-
149
- proc { driver.verify(state) }.must_raise Kitchen::ActionFailed
150
- end
151
-
152
- it "logs a verify event to INFO" do
153
- driver.verify(state)
154
-
155
- logged_output.string.must_match(/^.+ INFO .+ \[Dummy\] Verify on .+$/)
156
- end
157
- end
158
-
159
- describe "#destroy" do
160
- it "removes :my_id from the state hash" do
161
- state[:my_id] = "90210"
162
- driver.destroy(state)
163
-
164
- state[:my_id].must_be_nil
165
- end
166
-
167
- it "calls sleep if :sleep value is greater than 0" do
168
- config[:sleep] = 12.5
169
- driver.expects(:sleep).with(12.5).returns(true)
170
-
171
- driver.verify(state)
172
- end
173
-
174
- it "raises ActionFailed if :fail_destroy is set" do
175
- config[:fail_destroy] = true
176
-
177
- proc { driver.destroy(state) }.must_raise Kitchen::ActionFailed
178
- end
179
-
180
- it "randomly raises ActionFailed if :random_failure is set" do
181
- config[:random_failure] = true
182
- driver.stubs(:randomly_fail?).returns(true)
183
-
184
- proc { driver.destroy(state) }.must_raise Kitchen::ActionFailed
185
- end
186
-
187
- it "logs a destroy event to INFO" do
188
- driver.destroy(state)
189
-
190
- logged_output.string.must_match(/^.+ INFO .+ \[Dummy\] Destroy on .+$/)
191
- end
192
- end
193
- end