test-kitchen 1.19.2 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +0 -0
  3. data/.github/ISSUE_TEMPLATE.md +0 -0
  4. data/.gitignore +1 -0
  5. data/.kitchen.ci.yml +0 -0
  6. data/.kitchen.dokken.yml +0 -0
  7. data/.kitchen.proxy.yml +0 -0
  8. data/.rubocop.yml +0 -0
  9. data/.travis.yml +0 -0
  10. data/.yardopts +0 -0
  11. data/Berksfile +0 -0
  12. data/CHANGELOG.md +66 -0
  13. data/CONTRIBUTING.md +0 -0
  14. data/ECOSYSTEM.md +0 -0
  15. data/Gemfile +0 -0
  16. data/Gemfile.proxy_tests +0 -0
  17. data/Guardfile +0 -0
  18. data/LICENSE +0 -0
  19. data/MAINTAINERS.md +0 -0
  20. data/README.md +0 -0
  21. data/Rakefile +0 -0
  22. data/appveyor.yml +0 -0
  23. data/features/kitchen_action_commands.feature +0 -0
  24. data/features/kitchen_command.feature +0 -0
  25. data/features/kitchen_console_command.feature +0 -0
  26. data/features/kitchen_defaults.feature +0 -0
  27. data/features/kitchen_diagnose_command.feature +0 -0
  28. data/features/kitchen_help_command.feature +0 -0
  29. data/features/kitchen_init_command.feature +0 -0
  30. data/features/kitchen_list_command.feature +0 -0
  31. data/features/kitchen_login_command.feature +0 -0
  32. data/features/kitchen_sink_command.feature +0 -0
  33. data/features/kitchen_test_command.feature +0 -0
  34. data/features/step_definitions/gem_steps.rb +0 -0
  35. data/features/step_definitions/git_steps.rb +0 -0
  36. data/features/step_definitions/output_steps.rb +0 -0
  37. data/features/support/env.rb +0 -0
  38. data/lib/kitchen.rb +0 -0
  39. data/lib/kitchen/base64_stream.rb +0 -0
  40. data/lib/kitchen/cli.rb +0 -0
  41. data/lib/kitchen/collection.rb +0 -0
  42. data/lib/kitchen/color.rb +0 -0
  43. data/lib/kitchen/command.rb +0 -0
  44. data/lib/kitchen/command/action.rb +0 -0
  45. data/lib/kitchen/command/console.rb +0 -0
  46. data/lib/kitchen/command/diagnose.rb +0 -0
  47. data/lib/kitchen/command/doctor.rb +0 -0
  48. data/lib/kitchen/command/exec.rb +0 -0
  49. data/lib/kitchen/command/list.rb +0 -0
  50. data/lib/kitchen/command/login.rb +0 -0
  51. data/lib/kitchen/command/package.rb +0 -0
  52. data/lib/kitchen/command/sink.rb +0 -0
  53. data/lib/kitchen/command/test.rb +0 -0
  54. data/lib/kitchen/config.rb +0 -0
  55. data/lib/kitchen/configurable.rb +68 -0
  56. data/lib/kitchen/data_munger.rb +0 -0
  57. data/lib/kitchen/diagnostic.rb +0 -0
  58. data/lib/kitchen/driver.rb +0 -0
  59. data/lib/kitchen/driver/base.rb +0 -0
  60. data/lib/kitchen/driver/dummy.rb +0 -0
  61. data/lib/kitchen/driver/exec.rb +0 -0
  62. data/lib/kitchen/driver/proxy.rb +0 -0
  63. data/lib/kitchen/driver/ssh_base.rb +6 -0
  64. data/lib/kitchen/errors.rb +0 -0
  65. data/lib/kitchen/generator/init.rb +0 -0
  66. data/lib/kitchen/instance.rb +0 -0
  67. data/lib/kitchen/lazy_hash.rb +8 -0
  68. data/lib/kitchen/loader/yaml.rb +3 -3
  69. data/lib/kitchen/logger.rb +0 -0
  70. data/lib/kitchen/logging.rb +0 -0
  71. data/lib/kitchen/login_command.rb +0 -0
  72. data/lib/kitchen/metadata_chopper.rb +0 -0
  73. data/lib/kitchen/platform.rb +0 -0
  74. data/lib/kitchen/provisioner.rb +0 -0
  75. data/lib/kitchen/provisioner/base.rb +8 -0
  76. data/lib/kitchen/provisioner/chef/berkshelf.rb +0 -0
  77. data/lib/kitchen/provisioner/chef/common_sandbox.rb +5 -1
  78. data/lib/kitchen/provisioner/chef/librarian.rb +0 -0
  79. data/lib/kitchen/provisioner/chef/policyfile.rb +0 -0
  80. data/lib/kitchen/provisioner/chef_apply.rb +0 -0
  81. data/lib/kitchen/provisioner/chef_base.rb +96 -0
  82. data/lib/kitchen/provisioner/chef_solo.rb +0 -0
  83. data/lib/kitchen/provisioner/chef_zero.rb +0 -0
  84. data/lib/kitchen/provisioner/dummy.rb +0 -0
  85. data/lib/kitchen/provisioner/shell.rb +0 -0
  86. data/lib/kitchen/rake_tasks.rb +0 -0
  87. data/lib/kitchen/shell_out.rb +0 -0
  88. data/lib/kitchen/ssh.rb +0 -0
  89. data/lib/kitchen/state_file.rb +3 -3
  90. data/lib/kitchen/suite.rb +0 -0
  91. data/lib/kitchen/thor_tasks.rb +0 -0
  92. data/lib/kitchen/transport.rb +0 -0
  93. data/lib/kitchen/transport/base.rb +13 -1
  94. data/lib/kitchen/transport/dummy.rb +4 -0
  95. data/lib/kitchen/transport/exec.rb +0 -0
  96. data/lib/kitchen/transport/ssh.rb +71 -9
  97. data/lib/kitchen/transport/winrm.rb +16 -0
  98. data/lib/kitchen/util.rb +0 -0
  99. data/lib/kitchen/verifier.rb +0 -0
  100. data/lib/kitchen/verifier/base.rb +0 -0
  101. data/lib/kitchen/verifier/busser.rb +0 -0
  102. data/lib/kitchen/verifier/dummy.rb +0 -0
  103. data/lib/kitchen/verifier/shell.rb +0 -0
  104. data/lib/kitchen/version.rb +1 -1
  105. data/lib/vendor/hash_recursive_merge.rb +0 -0
  106. data/spec/kitchen/base64_stream_spec.rb +0 -0
  107. data/spec/kitchen/cli_spec.rb +0 -0
  108. data/spec/kitchen/collection_spec.rb +0 -0
  109. data/spec/kitchen/color_spec.rb +0 -0
  110. data/spec/kitchen/config_spec.rb +0 -0
  111. data/spec/kitchen/configurable_spec.rb +0 -0
  112. data/spec/kitchen/data_munger_spec.rb +0 -0
  113. data/spec/kitchen/diagnostic_spec.rb +0 -0
  114. data/spec/kitchen/driver/base_spec.rb +0 -0
  115. data/spec/kitchen/driver/dummy_spec.rb +0 -0
  116. data/spec/kitchen/driver/exec_spec.rb +0 -0
  117. data/spec/kitchen/driver/proxy_spec.rb +0 -0
  118. data/spec/kitchen/driver/ssh_base_spec.rb +42 -1
  119. data/spec/kitchen/driver_spec.rb +0 -0
  120. data/spec/kitchen/errors_spec.rb +0 -0
  121. data/spec/kitchen/instance_spec.rb +0 -0
  122. data/spec/kitchen/lazy_hash_spec.rb +0 -0
  123. data/spec/kitchen/loader/yaml_spec.rb +2 -6
  124. data/spec/kitchen/logger_spec.rb +0 -0
  125. data/spec/kitchen/logging_spec.rb +0 -0
  126. data/spec/kitchen/login_command_spec.rb +0 -0
  127. data/spec/kitchen/metadata_chopper_spec.rb +0 -0
  128. data/spec/kitchen/platform_spec.rb +0 -0
  129. data/spec/kitchen/provisioner/base_spec.rb +25 -0
  130. data/spec/kitchen/provisioner/chef/policyfile_spec.rb +0 -0
  131. data/spec/kitchen/provisioner/chef_apply_spec.rb +0 -0
  132. data/spec/kitchen/provisioner/chef_base_spec.rb +28 -0
  133. data/spec/kitchen/provisioner/chef_solo_spec.rb +0 -0
  134. data/spec/kitchen/provisioner/chef_zero_spec.rb +0 -0
  135. data/spec/kitchen/provisioner/dummy_spec.rb +0 -0
  136. data/spec/kitchen/provisioner/shell_spec.rb +0 -0
  137. data/spec/kitchen/provisioner_spec.rb +0 -0
  138. data/spec/kitchen/shell_out_spec.rb +0 -0
  139. data/spec/kitchen/ssh_spec.rb +0 -0
  140. data/spec/kitchen/state_file_spec.rb +1 -3
  141. data/spec/kitchen/suite_spec.rb +0 -0
  142. data/spec/kitchen/transport/base_spec.rb +17 -0
  143. data/spec/kitchen/transport/exec_spec.rb +0 -0
  144. data/spec/kitchen/transport/ssh_spec.rb +111 -0
  145. data/spec/kitchen/transport/winrm_spec.rb +0 -0
  146. data/spec/kitchen/transport_spec.rb +0 -0
  147. data/spec/kitchen/util_spec.rb +0 -0
  148. data/spec/kitchen/verifier/base_spec.rb +0 -0
  149. data/spec/kitchen/verifier/busser_spec.rb +0 -0
  150. data/spec/kitchen/verifier/dummy_spec.rb +0 -0
  151. data/spec/kitchen/verifier/shell_spec.rb +0 -0
  152. data/spec/kitchen/verifier_spec.rb +0 -0
  153. data/spec/kitchen_spec.rb +0 -0
  154. data/spec/spec_helper.rb +0 -0
  155. data/spec/support/powershell_max_size_spec.rb +0 -0
  156. data/support/busser_install_command.ps1 +0 -0
  157. data/support/busser_install_command.sh +0 -0
  158. data/support/chef-client-fail-if-update-handler.rb +0 -0
  159. data/support/chef_base_init_command.ps1 +0 -0
  160. data/support/chef_base_init_command.sh +0 -0
  161. data/support/chef_base_install_command.ps1 +0 -0
  162. data/support/chef_base_install_command.sh +0 -0
  163. data/support/chef_zero_prepare_command_legacy.ps1 +0 -0
  164. data/support/chef_zero_prepare_command_legacy.sh +0 -0
  165. data/support/download_helpers.sh +0 -0
  166. data/support/dummy-validation.pem +0 -0
  167. data/templates/driver/CHANGELOG.md.erb +0 -0
  168. data/templates/driver/Gemfile.erb +0 -0
  169. data/templates/driver/README.md.erb +0 -0
  170. data/templates/driver/Rakefile.erb +0 -0
  171. data/templates/driver/driver.rb.erb +0 -0
  172. data/templates/driver/gemspec.erb +0 -0
  173. data/templates/driver/gitignore.erb +0 -0
  174. data/templates/driver/license_apachev2.erb +0 -0
  175. data/templates/driver/license_lgplv3.erb +0 -0
  176. data/templates/driver/license_mit.erb +0 -0
  177. data/templates/driver/license_reserved.erb +0 -0
  178. data/templates/driver/tailor.erb +0 -0
  179. data/templates/driver/travis.yml.erb +0 -0
  180. data/templates/driver/version.rb.erb +0 -0
  181. data/templates/init/chefignore.erb +0 -0
  182. data/templates/init/kitchen.yml.erb +0 -0
  183. data/test-kitchen.gemspec +1 -2
  184. data/test/cookbooks/test_cookbook/metadata.rb +0 -0
  185. data/test/cookbooks/test_cookbook/recipes/default.rb +0 -0
  186. data/test/integration/default/default_spec.rb +0 -0
  187. data/testing_windows.md +0 -0
  188. metadata +8 -16
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -66,9 +66,7 @@ describe Kitchen::StateFile do
66
66
  yoinks: zoinks
67
67
  YAML
68
68
 
69
- state_file.read.class.wont_equal YamledState
70
- state_file.read.class.must_equal Hash
71
- state_file.read.must_equal(yoinks: "zoinks")
69
+ proc { state_file.read }.must_raise Kitchen::StateFileLoadError
72
70
  end
73
71
 
74
72
  it "raises a StateFileLoadError if the state file cannot be parsed" do
File without changes
@@ -97,6 +97,11 @@ describe Kitchen::Transport::Base::Connection do
97
97
  .must_raise Kitchen::ClientError
98
98
  end
99
99
 
100
+ it "has an #download method which raises a ClientError" do
101
+ proc { connection.download(["remote"], "local") }
102
+ .must_raise Kitchen::ClientError
103
+ end
104
+
100
105
  it "has a #wait_until_ready method that does nothing" do
101
106
  connection.wait_until_ready.must_be_nil
102
107
  end
@@ -120,4 +125,16 @@ describe Kitchen::Transport::Base::Connection do
120
125
  connection.execute_with_retry("Hi", [123], 3, 1).must_equal "Hello"
121
126
  end
122
127
  end
128
+
129
+ describe "#retry?" do
130
+ it "raises an exception when multiple retryable exit codes are passed as a String" do
131
+ proc { connection.retry?(2, 2, "35 1", 35) }
132
+ .must_raise("undefined method `flatten' for \"35 1\":String")
133
+ end
134
+
135
+ it "returns true when the retryable exit codes are formatted in a nested array" do
136
+ connection.retry?(1, 2, [[35, 1]], 35).must_equal true
137
+ end
138
+ end
139
+
123
140
  end
File without changes
@@ -120,13 +120,41 @@ describe Kitchen::Transport::Ssh do
120
120
  it "sets :max_ssh_sessions to 9 by default" do
121
121
  transport[:max_ssh_sessions].must_equal 9
122
122
  end
123
+
124
+ it "sets :ssh_http_proxy to nil by default" do
125
+ transport[:ssh_http_proxy].must_be_nil
126
+ end
127
+
128
+ it "sets :ssh_http_proxy_port to nil by default" do
129
+ transport[:ssh_http_proxy_port].must_be_nil
130
+ end
131
+
132
+ it "sets :ssh_http_proxy_user to nil by default" do
133
+ transport[:ssh_http_proxy_user].must_be_nil
134
+ end
135
+
136
+ it "sets :ssh_http_proxy_password to nil by default" do
137
+ transport[:ssh_http_proxy_password].must_be_nil
138
+ end
123
139
  end
124
140
 
125
141
  describe "#connection" do
126
142
  let(:klass) { Kitchen::Transport::Ssh::Connection }
143
+ let(:options_http_proxy) { Hash.new }
144
+ let(:proxy_conn) do
145
+ state[:ssh_http_proxy] = "ssh_http_proxy_from_state"
146
+ state[:ssh_http_proxy_port] = "ssh_http_proxy_port_from_state"
147
+ options_http_proxy[:user] = state[:ssh_http_proxy_user]
148
+ options_http_proxy[:password] = state[:ssh_http_proxy_password]
149
+ Net::SSH::Proxy::HTTP.new(state[:ssh_http_proxy], state[:ssh_http_proxy_port], options_http_proxy)
150
+ end
127
151
 
128
152
  # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
129
153
  def self.common_connection_specs
154
+ before do
155
+ Net::SSH::Proxy::HTTP.stubs(:new).returns(proxy_conn)
156
+ end
157
+
130
158
  it "returns a Kitchen::Transport::Ssh::Connection object" do
131
159
  transport.connection(state).must_be_kind_of klass
132
160
  end
@@ -417,6 +445,16 @@ describe Kitchen::Transport::Ssh do
417
445
  make_connection
418
446
  end
419
447
 
448
+ it "sets :proxy to proxy if :ssh_http_proxy is set in state" do
449
+ config[:ssh_http_proxy] = true
450
+
451
+ klass.expects(:new).with do |hash|
452
+ hash[:proxy] == proxy_conn
453
+ end
454
+
455
+ make_connection
456
+ end
457
+
420
458
  it "sets :keys to an array if :ssh_key is set in config" do
421
459
  config[:kitchen_root] = "/r"
422
460
  config[:ssh_key] = "ssh_key_from_config"
@@ -1092,6 +1130,79 @@ describe Kitchen::Transport::Ssh::Connection do
1092
1130
  end
1093
1131
  end
1094
1132
 
1133
+ describe "#download" do
1134
+ let(:conn) { mock("session") }
1135
+ let(:scp) { mock("scp") }
1136
+
1137
+ before do
1138
+ Net::SSH.stubs(:start).returns(conn)
1139
+ conn.stubs(:scp).returns(scp)
1140
+ @local_parent = Dir.mktmpdir("dir")
1141
+ @local = File.join(@local_parent, "local")
1142
+ end
1143
+
1144
+ after do
1145
+ FileUtils.remove_entry_secure(@local_parent)
1146
+ end
1147
+
1148
+ describe "for a file" do
1149
+ it "downloads a file from a remote over scp" do
1150
+ FileUtils.expects(:mkdir_p).with(@local_parent)
1151
+ scp.expects(:download!).with("/remote", @local)
1152
+
1153
+ connection.download("/remote", @local)
1154
+ end
1155
+ end
1156
+
1157
+ describe "for a list of files" do
1158
+ it "downloads the files from a remote over scp" do
1159
+ FileUtils.expects(:mkdir_p).with(@local_parent)
1160
+ scp.expects(:download!).with("/remote-1", @local)
1161
+ scp.expects(:download!).with("/remote-2", @local)
1162
+
1163
+ connection.download(["/remote-1", "/remote-2"], @local)
1164
+ end
1165
+ end
1166
+
1167
+ describe "for a directory" do
1168
+ it "downloads the directory from a remote over scp" do
1169
+ FileUtils.expects(:mkdir_p).with(@local_parent)
1170
+ scp.expects(:download!).with("/remote-dir", @local).raises(Net::SCP::Error)
1171
+ scp.expects(:download!).with("/remote-dir", @local, recursive: true)
1172
+
1173
+ connection.download("/remote-dir", @local)
1174
+ end
1175
+ end
1176
+
1177
+ describe "for a file that does not exist" do
1178
+ it "logs a warning" do
1179
+ FileUtils.expects(:mkdir_p).with(@local_parent)
1180
+ scp.expects(:download!).with("/remote", @local).raises(Net::SCP::Error)
1181
+ scp.expects(:download!).with("/remote", @local, recursive: true)
1182
+ .raises(Net::SCP::Error)
1183
+
1184
+ connection.download("/remote", @local)
1185
+
1186
+ logged_output.string.lines.count do |l|
1187
+ l =~ warn_line_with(
1188
+ "SCP download failed for file or directory '/remote', perhaps it does not exist?"
1189
+ )
1190
+ end.must_equal 1
1191
+ end
1192
+ end
1193
+
1194
+ describe "for a failed download" do
1195
+ it "raises SshFailed when an SSH exception is raised" do
1196
+ conn.stubs(:scp).raises(Net::SSH::Exception)
1197
+
1198
+ e = proc do
1199
+ connection.download("nope", "fail")
1200
+ end.must_raise Kitchen::Transport::SshFailed
1201
+ e.message.must_match regexify("SCP download failed")
1202
+ end
1203
+ end
1204
+ end
1205
+
1095
1206
  describe "#wait_until_ready" do
1096
1207
  before do
1097
1208
  options[:max_wait_until_ready] = 300
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -27,7 +27,6 @@ Gem::Specification.new do |gem|
27
27
  gem.add_dependency "net-scp", "~> 1.1"
28
28
  gem.add_dependency "net-ssh", ">= 2.9", "< 5.0"
29
29
  gem.add_dependency "net-ssh-gateway", "~> 1.2"
30
- gem.add_dependency "safe_yaml", "~> 1.0"
31
30
  gem.add_dependency "thor", "~> 0.19", "< 0.19.2"
32
31
  gem.add_dependency "mixlib-install", "~> 3.6"
33
32
  gem.add_dependency "winrm", "~> 2.0"
@@ -42,7 +41,7 @@ Gem::Specification.new do |gem|
42
41
 
43
42
  gem.add_development_dependency "aruba", "~> 0.11"
44
43
  gem.add_development_dependency "fakefs", "~> 0.4"
45
- gem.add_development_dependency "minitest", "~> 5.3"
44
+ gem.add_development_dependency "minitest", "~> 5.3", "< 5.11"
46
45
  gem.add_development_dependency "mocha", "~> 1.1"
47
46
  gem.add_development_dependency "cucumber", "~> 2.1"
48
47
  gem.add_development_dependency "countloc", "~> 0.4"
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-kitchen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.2
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-28 00:00:00.000000000 Z
11
+ date: 2018-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -78,20 +78,6 @@ dependencies:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
80
  version: '1.2'
81
- - !ruby/object:Gem::Dependency
82
- name: safe_yaml
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - "~>"
86
- - !ruby/object:Gem::Version
87
- version: '1.0'
88
- type: :runtime
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - "~>"
93
- - !ruby/object:Gem::Version
94
- version: '1.0'
95
81
  - !ruby/object:Gem::Dependency
96
82
  name: thor
97
83
  requirement: !ruby/object:Gem::Requirement
@@ -259,6 +245,9 @@ dependencies:
259
245
  - - "~>"
260
246
  - !ruby/object:Gem::Version
261
247
  version: '5.3'
248
+ - - "<"
249
+ - !ruby/object:Gem::Version
250
+ version: '5.11'
262
251
  type: :development
263
252
  prerelease: false
264
253
  version_requirements: !ruby/object:Gem::Requirement
@@ -266,6 +255,9 @@ dependencies:
266
255
  - - "~>"
267
256
  - !ruby/object:Gem::Version
268
257
  version: '5.3'
258
+ - - "<"
259
+ - !ruby/object:Gem::Version
260
+ version: '5.11'
269
261
  - !ruby/object:Gem::Dependency
270
262
  name: mocha
271
263
  requirement: !ruby/object:Gem::Requirement