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.
- checksums.yaml +4 -4
- data/.gitattributes +0 -0
- data/.github/ISSUE_TEMPLATE.md +0 -0
- data/.gitignore +1 -0
- data/.kitchen.ci.yml +0 -0
- data/.kitchen.dokken.yml +0 -0
- data/.kitchen.proxy.yml +0 -0
- data/.rubocop.yml +0 -0
- data/.travis.yml +0 -0
- data/.yardopts +0 -0
- data/Berksfile +0 -0
- data/CHANGELOG.md +66 -0
- data/CONTRIBUTING.md +0 -0
- data/ECOSYSTEM.md +0 -0
- data/Gemfile +0 -0
- data/Gemfile.proxy_tests +0 -0
- data/Guardfile +0 -0
- data/LICENSE +0 -0
- data/MAINTAINERS.md +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/appveyor.yml +0 -0
- data/features/kitchen_action_commands.feature +0 -0
- data/features/kitchen_command.feature +0 -0
- data/features/kitchen_console_command.feature +0 -0
- data/features/kitchen_defaults.feature +0 -0
- data/features/kitchen_diagnose_command.feature +0 -0
- data/features/kitchen_help_command.feature +0 -0
- data/features/kitchen_init_command.feature +0 -0
- data/features/kitchen_list_command.feature +0 -0
- data/features/kitchen_login_command.feature +0 -0
- data/features/kitchen_sink_command.feature +0 -0
- data/features/kitchen_test_command.feature +0 -0
- data/features/step_definitions/gem_steps.rb +0 -0
- data/features/step_definitions/git_steps.rb +0 -0
- data/features/step_definitions/output_steps.rb +0 -0
- data/features/support/env.rb +0 -0
- data/lib/kitchen.rb +0 -0
- data/lib/kitchen/base64_stream.rb +0 -0
- data/lib/kitchen/cli.rb +0 -0
- data/lib/kitchen/collection.rb +0 -0
- data/lib/kitchen/color.rb +0 -0
- data/lib/kitchen/command.rb +0 -0
- data/lib/kitchen/command/action.rb +0 -0
- data/lib/kitchen/command/console.rb +0 -0
- data/lib/kitchen/command/diagnose.rb +0 -0
- data/lib/kitchen/command/doctor.rb +0 -0
- data/lib/kitchen/command/exec.rb +0 -0
- data/lib/kitchen/command/list.rb +0 -0
- data/lib/kitchen/command/login.rb +0 -0
- data/lib/kitchen/command/package.rb +0 -0
- data/lib/kitchen/command/sink.rb +0 -0
- data/lib/kitchen/command/test.rb +0 -0
- data/lib/kitchen/config.rb +0 -0
- data/lib/kitchen/configurable.rb +68 -0
- data/lib/kitchen/data_munger.rb +0 -0
- data/lib/kitchen/diagnostic.rb +0 -0
- data/lib/kitchen/driver.rb +0 -0
- data/lib/kitchen/driver/base.rb +0 -0
- data/lib/kitchen/driver/dummy.rb +0 -0
- data/lib/kitchen/driver/exec.rb +0 -0
- data/lib/kitchen/driver/proxy.rb +0 -0
- data/lib/kitchen/driver/ssh_base.rb +6 -0
- data/lib/kitchen/errors.rb +0 -0
- data/lib/kitchen/generator/init.rb +0 -0
- data/lib/kitchen/instance.rb +0 -0
- data/lib/kitchen/lazy_hash.rb +8 -0
- data/lib/kitchen/loader/yaml.rb +3 -3
- data/lib/kitchen/logger.rb +0 -0
- data/lib/kitchen/logging.rb +0 -0
- data/lib/kitchen/login_command.rb +0 -0
- data/lib/kitchen/metadata_chopper.rb +0 -0
- data/lib/kitchen/platform.rb +0 -0
- data/lib/kitchen/provisioner.rb +0 -0
- data/lib/kitchen/provisioner/base.rb +8 -0
- data/lib/kitchen/provisioner/chef/berkshelf.rb +0 -0
- data/lib/kitchen/provisioner/chef/common_sandbox.rb +5 -1
- data/lib/kitchen/provisioner/chef/librarian.rb +0 -0
- data/lib/kitchen/provisioner/chef/policyfile.rb +0 -0
- data/lib/kitchen/provisioner/chef_apply.rb +0 -0
- data/lib/kitchen/provisioner/chef_base.rb +96 -0
- data/lib/kitchen/provisioner/chef_solo.rb +0 -0
- data/lib/kitchen/provisioner/chef_zero.rb +0 -0
- data/lib/kitchen/provisioner/dummy.rb +0 -0
- data/lib/kitchen/provisioner/shell.rb +0 -0
- data/lib/kitchen/rake_tasks.rb +0 -0
- data/lib/kitchen/shell_out.rb +0 -0
- data/lib/kitchen/ssh.rb +0 -0
- data/lib/kitchen/state_file.rb +3 -3
- data/lib/kitchen/suite.rb +0 -0
- data/lib/kitchen/thor_tasks.rb +0 -0
- data/lib/kitchen/transport.rb +0 -0
- data/lib/kitchen/transport/base.rb +13 -1
- data/lib/kitchen/transport/dummy.rb +4 -0
- data/lib/kitchen/transport/exec.rb +0 -0
- data/lib/kitchen/transport/ssh.rb +71 -9
- data/lib/kitchen/transport/winrm.rb +16 -0
- data/lib/kitchen/util.rb +0 -0
- data/lib/kitchen/verifier.rb +0 -0
- data/lib/kitchen/verifier/base.rb +0 -0
- data/lib/kitchen/verifier/busser.rb +0 -0
- data/lib/kitchen/verifier/dummy.rb +0 -0
- data/lib/kitchen/verifier/shell.rb +0 -0
- data/lib/kitchen/version.rb +1 -1
- data/lib/vendor/hash_recursive_merge.rb +0 -0
- data/spec/kitchen/base64_stream_spec.rb +0 -0
- data/spec/kitchen/cli_spec.rb +0 -0
- data/spec/kitchen/collection_spec.rb +0 -0
- data/spec/kitchen/color_spec.rb +0 -0
- data/spec/kitchen/config_spec.rb +0 -0
- data/spec/kitchen/configurable_spec.rb +0 -0
- data/spec/kitchen/data_munger_spec.rb +0 -0
- data/spec/kitchen/diagnostic_spec.rb +0 -0
- data/spec/kitchen/driver/base_spec.rb +0 -0
- data/spec/kitchen/driver/dummy_spec.rb +0 -0
- data/spec/kitchen/driver/exec_spec.rb +0 -0
- data/spec/kitchen/driver/proxy_spec.rb +0 -0
- data/spec/kitchen/driver/ssh_base_spec.rb +42 -1
- data/spec/kitchen/driver_spec.rb +0 -0
- data/spec/kitchen/errors_spec.rb +0 -0
- data/spec/kitchen/instance_spec.rb +0 -0
- data/spec/kitchen/lazy_hash_spec.rb +0 -0
- data/spec/kitchen/loader/yaml_spec.rb +2 -6
- data/spec/kitchen/logger_spec.rb +0 -0
- data/spec/kitchen/logging_spec.rb +0 -0
- data/spec/kitchen/login_command_spec.rb +0 -0
- data/spec/kitchen/metadata_chopper_spec.rb +0 -0
- data/spec/kitchen/platform_spec.rb +0 -0
- data/spec/kitchen/provisioner/base_spec.rb +25 -0
- data/spec/kitchen/provisioner/chef/policyfile_spec.rb +0 -0
- data/spec/kitchen/provisioner/chef_apply_spec.rb +0 -0
- data/spec/kitchen/provisioner/chef_base_spec.rb +28 -0
- data/spec/kitchen/provisioner/chef_solo_spec.rb +0 -0
- data/spec/kitchen/provisioner/chef_zero_spec.rb +0 -0
- data/spec/kitchen/provisioner/dummy_spec.rb +0 -0
- data/spec/kitchen/provisioner/shell_spec.rb +0 -0
- data/spec/kitchen/provisioner_spec.rb +0 -0
- data/spec/kitchen/shell_out_spec.rb +0 -0
- data/spec/kitchen/ssh_spec.rb +0 -0
- data/spec/kitchen/state_file_spec.rb +1 -3
- data/spec/kitchen/suite_spec.rb +0 -0
- data/spec/kitchen/transport/base_spec.rb +17 -0
- data/spec/kitchen/transport/exec_spec.rb +0 -0
- data/spec/kitchen/transport/ssh_spec.rb +111 -0
- data/spec/kitchen/transport/winrm_spec.rb +0 -0
- data/spec/kitchen/transport_spec.rb +0 -0
- data/spec/kitchen/util_spec.rb +0 -0
- data/spec/kitchen/verifier/base_spec.rb +0 -0
- data/spec/kitchen/verifier/busser_spec.rb +0 -0
- data/spec/kitchen/verifier/dummy_spec.rb +0 -0
- data/spec/kitchen/verifier/shell_spec.rb +0 -0
- data/spec/kitchen/verifier_spec.rb +0 -0
- data/spec/kitchen_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/support/powershell_max_size_spec.rb +0 -0
- data/support/busser_install_command.ps1 +0 -0
- data/support/busser_install_command.sh +0 -0
- data/support/chef-client-fail-if-update-handler.rb +0 -0
- data/support/chef_base_init_command.ps1 +0 -0
- data/support/chef_base_init_command.sh +0 -0
- data/support/chef_base_install_command.ps1 +0 -0
- data/support/chef_base_install_command.sh +0 -0
- data/support/chef_zero_prepare_command_legacy.ps1 +0 -0
- data/support/chef_zero_prepare_command_legacy.sh +0 -0
- data/support/download_helpers.sh +0 -0
- data/support/dummy-validation.pem +0 -0
- data/templates/driver/CHANGELOG.md.erb +0 -0
- data/templates/driver/Gemfile.erb +0 -0
- data/templates/driver/README.md.erb +0 -0
- data/templates/driver/Rakefile.erb +0 -0
- data/templates/driver/driver.rb.erb +0 -0
- data/templates/driver/gemspec.erb +0 -0
- data/templates/driver/gitignore.erb +0 -0
- data/templates/driver/license_apachev2.erb +0 -0
- data/templates/driver/license_lgplv3.erb +0 -0
- data/templates/driver/license_mit.erb +0 -0
- data/templates/driver/license_reserved.erb +0 -0
- data/templates/driver/tailor.erb +0 -0
- data/templates/driver/travis.yml.erb +0 -0
- data/templates/driver/version.rb.erb +0 -0
- data/templates/init/chefignore.erb +0 -0
- data/templates/init/kitchen.yml.erb +0 -0
- data/test-kitchen.gemspec +1 -2
- data/test/cookbooks/test_cookbook/metadata.rb +0 -0
- data/test/cookbooks/test_cookbook/recipes/default.rb +0 -0
- data/test/integration/default/default_spec.rb +0 -0
- data/testing_windows.md +0 -0
- metadata +8 -16
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/kitchen/rake_tasks.rb
CHANGED
File without changes
|
data/lib/kitchen/shell_out.rb
CHANGED
File without changes
|
data/lib/kitchen/ssh.rb
CHANGED
File without changes
|
data/lib/kitchen/state_file.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
|
19
|
-
require "
|
19
|
+
require "yaml"
|
20
20
|
|
21
21
|
module Kitchen
|
22
22
|
# Exception class for any exceptions raised when reading and parsing a state
|
@@ -96,8 +96,8 @@ module Kitchen
|
|
96
96
|
# @raise [StateFileLoadError] if the string document cannot be parsed
|
97
97
|
# @api private
|
98
98
|
def deserialize_string(string)
|
99
|
-
|
100
|
-
rescue SyntaxError, Psych::SyntaxError => ex
|
99
|
+
YAML.safe_load(string)
|
100
|
+
rescue SyntaxError, Psych::SyntaxError, Psych::DisallowedClass => ex
|
101
101
|
raise StateFileLoadError, "Error parsing #{file_name} (#{ex.message})"
|
102
102
|
end
|
103
103
|
|
data/lib/kitchen/suite.rb
CHANGED
File without changes
|
data/lib/kitchen/thor_tasks.rb
CHANGED
File without changes
|
data/lib/kitchen/transport.rb
CHANGED
File without changes
|
@@ -140,7 +140,7 @@ module Kitchen
|
|
140
140
|
def retry?(current_try, max_retries, retryable_exit_codes, exit_code)
|
141
141
|
current_try <= max_retries &&
|
142
142
|
!retryable_exit_codes.nil? &&
|
143
|
-
retryable_exit_codes.include?(exit_code)
|
143
|
+
retryable_exit_codes.flatten.include?(exit_code)
|
144
144
|
end
|
145
145
|
|
146
146
|
# Builds a LoginCommand which can be used to open an interactive
|
@@ -163,6 +163,18 @@ module Kitchen
|
|
163
163
|
raise ClientError, "#{self.class}#upload must be implemented"
|
164
164
|
end
|
165
165
|
|
166
|
+
# Download remote files or directories to local host.
|
167
|
+
#
|
168
|
+
# @param remotes [Array<String>] paths to remote files or directories
|
169
|
+
# @param local [String] path to local destination. If `local` is an
|
170
|
+
# existing directory, `remote` will be downloaded into the directory
|
171
|
+
# using its original name
|
172
|
+
# @raise [TransportFailed] if the files could not all be downloaded
|
173
|
+
# successfully, which may vary by implementation
|
174
|
+
def download(remotes, local) # rubocop:disable Lint/UnusedMethodArgument
|
175
|
+
raise ClientError, "#{self.class}#download must be implemented"
|
176
|
+
end
|
177
|
+
|
166
178
|
# Block and return only when the remote host is prepared and ready to
|
167
179
|
# execute command and upload files. The semantics and details will
|
168
180
|
# vary by implementation, but a round trip through the hosted
|
@@ -51,6 +51,10 @@ module Kitchen
|
|
51
51
|
report(:upload, "#{locals.inspect} => #{remote}")
|
52
52
|
end
|
53
53
|
|
54
|
+
def download(remotes, local)
|
55
|
+
report(:download, "#{remotes.inspect} => #{local}")
|
56
|
+
end
|
57
|
+
|
54
58
|
private
|
55
59
|
|
56
60
|
# Report what action is taking place, sleeping if so configured, and
|
File without changes
|
@@ -18,8 +18,10 @@
|
|
18
18
|
|
19
19
|
require "kitchen"
|
20
20
|
|
21
|
+
require "fileutils"
|
21
22
|
require "net/ssh"
|
22
23
|
require "net/ssh/gateway"
|
24
|
+
require "net/ssh/proxy/http"
|
23
25
|
require "net/scp"
|
24
26
|
require "timeout"
|
25
27
|
require "benchmark"
|
@@ -54,6 +56,11 @@ module Kitchen
|
|
54
56
|
default_config :ssh_gateway, nil
|
55
57
|
default_config :ssh_gateway_username, nil
|
56
58
|
|
59
|
+
default_config :ssh_http_proxy, nil
|
60
|
+
default_config :ssh_http_proxy_port, nil
|
61
|
+
default_config :ssh_http_proxy_user, nil
|
62
|
+
default_config :ssh_http_proxy_password, nil
|
63
|
+
|
57
64
|
default_config :ssh_key, nil
|
58
65
|
expand_path_for :ssh_key
|
59
66
|
|
@@ -181,6 +188,30 @@ module Kitchen
|
|
181
188
|
raise SshFailed, "SCP upload failed (#{ex.message})"
|
182
189
|
end
|
183
190
|
|
191
|
+
# (see Base::Connection#download)
|
192
|
+
def download(remotes, local)
|
193
|
+
# ensure the parent dir of the local target exists
|
194
|
+
FileUtils.mkdir_p(File.dirname(local))
|
195
|
+
|
196
|
+
Array(remotes).each do |file|
|
197
|
+
begin
|
198
|
+
logger.debug("Attempting to download '#{file}' as file")
|
199
|
+
session.scp.download!(file, local)
|
200
|
+
rescue Net::SCP::Error
|
201
|
+
begin
|
202
|
+
logger.debug("Attempting to download '#{file}' as directory")
|
203
|
+
session.scp.download!(file, local, recursive: true)
|
204
|
+
rescue Net::SCP::Error
|
205
|
+
logger.warn(
|
206
|
+
"SCP download failed for file or directory '#{file}', perhaps it does not exist?"
|
207
|
+
)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
rescue Net::SSH::Exception => ex
|
212
|
+
raise SshFailed, "SCP download failed (#{ex.message})"
|
213
|
+
end
|
214
|
+
|
184
215
|
# (see Base::Connection#wait_until_ready)
|
185
216
|
def wait_until_ready
|
186
217
|
delay = 3
|
@@ -246,6 +277,26 @@ module Kitchen
|
|
246
277
|
# @api private
|
247
278
|
attr_reader :ssh_gateway_username
|
248
279
|
|
280
|
+
# @return [String] The kitchen ssh proxy to use when connecting to the
|
281
|
+
# remote SSH host via http proxy
|
282
|
+
# @api private
|
283
|
+
attr_reader :ssh_http_proxy
|
284
|
+
|
285
|
+
# @return [Integer] The port to use when using an kitchen ssh proxy
|
286
|
+
# remote SSH host via http proxy
|
287
|
+
# @api private
|
288
|
+
attr_reader :ssh_http_proxy_port
|
289
|
+
|
290
|
+
# @return [String] The username to use when using an kitchen ssh proxy
|
291
|
+
# remote SSH host via http proxy
|
292
|
+
# @api private
|
293
|
+
attr_reader :ssh_http_proxy_user
|
294
|
+
|
295
|
+
# @return [String] The password to use when using an kitchen ssh proxy
|
296
|
+
# remote SSH host via http proxy
|
297
|
+
# @api private
|
298
|
+
attr_reader :ssh_http_proxy_password
|
299
|
+
|
249
300
|
# Establish an SSH session on the remote host using a gateway host.
|
250
301
|
#
|
251
302
|
# @param opts [Hash] retry options
|
@@ -346,15 +397,19 @@ module Kitchen
|
|
346
397
|
# (see Base::Connection#init_options)
|
347
398
|
def init_options(options)
|
348
399
|
super
|
349
|
-
@username
|
350
|
-
@hostname
|
351
|
-
@port
|
352
|
-
@connection_retries
|
353
|
-
@connection_retry_sleep
|
354
|
-
@max_ssh_sessions
|
355
|
-
@max_wait_until_ready
|
356
|
-
@ssh_gateway
|
357
|
-
@ssh_gateway_username
|
400
|
+
@username = @options.delete(:username)
|
401
|
+
@hostname = @options.delete(:hostname)
|
402
|
+
@port = @options[:port] # don't delete from options
|
403
|
+
@connection_retries = @options.delete(:connection_retries)
|
404
|
+
@connection_retry_sleep = @options.delete(:connection_retry_sleep)
|
405
|
+
@max_ssh_sessions = @options.delete(:max_ssh_sessions)
|
406
|
+
@max_wait_until_ready = @options.delete(:max_wait_until_ready)
|
407
|
+
@ssh_gateway = @options.delete(:ssh_gateway)
|
408
|
+
@ssh_gateway_username = @options.delete(:ssh_gateway_username)
|
409
|
+
@ssh_http_proxy = @options.delete(:ssh_http_proxy)
|
410
|
+
@ssh_http_proxy_user = @options.delete(:ssh_http_proxy_user)
|
411
|
+
@ssh_http_proxy_password = @options.delete(:ssh_http_proxy_password)
|
412
|
+
@ssh_http_proxy_port = @options.delete(:ssh_http_proxy_port)
|
358
413
|
end
|
359
414
|
|
360
415
|
# Returns a connection session, or establishes one when invoked the
|
@@ -421,6 +476,13 @@ module Kitchen
|
|
421
476
|
opts[:auth_methods] = ["publickey"]
|
422
477
|
end
|
423
478
|
|
479
|
+
if data[:ssh_http_proxy]
|
480
|
+
options_http_proxy = {}
|
481
|
+
options_http_proxy[:user] = data[:ssh_http_proxy_user]
|
482
|
+
options_http_proxy[:password] = data[:ssh_http_proxy_password]
|
483
|
+
opts[:proxy] = Net::SSH::Proxy::HTTP.new(data[:ssh_http_proxy], data[:ssh_http_proxy_port], options_http_proxy)
|
484
|
+
end
|
485
|
+
|
424
486
|
if data[:ssh_key_only]
|
425
487
|
opts[:auth_methods] = ["publickey"]
|
426
488
|
end
|
@@ -137,6 +137,22 @@ module Kitchen
|
|
137
137
|
file_transporter.upload(locals, remote)
|
138
138
|
end
|
139
139
|
|
140
|
+
# (see Base::Connection#download)
|
141
|
+
def download(remotes, local)
|
142
|
+
# ensure the parent dir of the local target exists
|
143
|
+
FileUtils.mkdir_p(File.dirname(local))
|
144
|
+
|
145
|
+
Array(remotes).each do |remote|
|
146
|
+
file_manager.download(remote, local)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# @return [Winrm::FileManager] a file transporter
|
151
|
+
# @api private
|
152
|
+
def file_manager
|
153
|
+
@file_manager ||= WinRM::FS::FileManager.new(connection)
|
154
|
+
end
|
155
|
+
|
140
156
|
# (see Base::Connection#wait_until_ready)
|
141
157
|
def wait_until_ready
|
142
158
|
delay = 3
|
data/lib/kitchen/util.rb
CHANGED
File without changes
|
data/lib/kitchen/verifier.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/kitchen/version.rb
CHANGED
File without changes
|
File without changes
|
data/spec/kitchen/cli_spec.rb
CHANGED
File without changes
|
File without changes
|
data/spec/kitchen/color_spec.rb
CHANGED
File without changes
|
data/spec/kitchen/config_spec.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -270,12 +270,16 @@ describe Kitchen::Driver::SSHBase do
|
|
270
270
|
|
271
271
|
describe "#converge" do
|
272
272
|
let(:cmd) { driver.converge(state) }
|
273
|
-
let(:connection) { stub(execute: true, upload: true) }
|
273
|
+
let(:connection) { stub(execute: true, upload: true, download: true) }
|
274
274
|
|
275
275
|
before do
|
276
276
|
state[:hostname] = "fizzy"
|
277
277
|
state[:username] = "bork"
|
278
278
|
provisioner.stubs(:[]).with(:root_path).returns("/rooty")
|
279
|
+
provisioner.stubs(:[]).with(:downloads).returns(
|
280
|
+
["/tmp/kitchen/nodes", "/tmp/kitchen/data_bags"] => "./test/fixtures",
|
281
|
+
"/remote" => "/local"
|
282
|
+
)
|
279
283
|
FakeFS.activate!
|
280
284
|
FileUtils.mkdir_p("/tmp")
|
281
285
|
@original_env = ENV.to_hash
|
@@ -471,6 +475,43 @@ describe Kitchen::Driver::SSHBase do
|
|
471
475
|
end
|
472
476
|
end
|
473
477
|
|
478
|
+
describe "downloading files" do
|
479
|
+
before do
|
480
|
+
transport.stubs(:connection).yields(connection)
|
481
|
+
connection.stubs(:download)
|
482
|
+
end
|
483
|
+
|
484
|
+
it "downloads files" do
|
485
|
+
connection.expects(:download).with(
|
486
|
+
["/tmp/kitchen/nodes", "/tmp/kitchen/data_bags"],
|
487
|
+
"./test/fixtures"
|
488
|
+
)
|
489
|
+
connection.expects(:download).with("/remote", "/local")
|
490
|
+
|
491
|
+
cmd
|
492
|
+
end
|
493
|
+
|
494
|
+
it "logs to info" do
|
495
|
+
cmd
|
496
|
+
|
497
|
+
logged_output.string.must_match(
|
498
|
+
/INFO -- : Downloading files from instance$/
|
499
|
+
)
|
500
|
+
end
|
501
|
+
|
502
|
+
it "logs to debug" do
|
503
|
+
cmd
|
504
|
+
|
505
|
+
logged_output.string.must_match(
|
506
|
+
%r{DEBUG -- : Downloading /tmp/kitchen/nodes, /tmp/kitchen/data_bags to ./test/fixtures$}
|
507
|
+
)
|
508
|
+
logged_output.string.must_match(
|
509
|
+
%r{DEBUG -- : Downloading /remote to /local$}
|
510
|
+
)
|
511
|
+
logged_output.string.must_match(/DEBUG -- : Download complete$/)
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
474
515
|
it "raises an ActionFailed on execute when SshFailed is raised" do
|
475
516
|
transport.stubs(:connection).yields(connection)
|
476
517
|
connection.stubs(:execute).raises(Kitchen::Transport::SshFailed.new("dang"))
|
data/spec/kitchen/driver_spec.rb
CHANGED
File without changes
|
data/spec/kitchen/errors_spec.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -344,9 +344,7 @@ describe Kitchen::Loader::YAML do
|
|
344
344
|
YAML
|
345
345
|
end
|
346
346
|
|
347
|
-
loader.read.
|
348
|
-
loader.read.class.must_equal Hash
|
349
|
-
loader.read.must_equal(foo: "bar")
|
347
|
+
proc { loader.read }.must_raise Kitchen::UserError
|
350
348
|
end
|
351
349
|
|
352
350
|
it "arbitrary objects aren't deserialized in kitchen.local.yml" do
|
@@ -359,9 +357,7 @@ describe Kitchen::Loader::YAML do
|
|
359
357
|
end
|
360
358
|
stub_yaml!({})
|
361
359
|
|
362
|
-
loader.read.
|
363
|
-
loader.read.class.must_equal Hash
|
364
|
-
loader.read.must_equal(wakka: "boop")
|
360
|
+
proc { loader.read }.must_raise Kitchen::UserError
|
365
361
|
end
|
366
362
|
|
367
363
|
it "raises a UserError if kitchen.yml cannot be parsed" do
|
data/spec/kitchen/logger_spec.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -151,6 +151,11 @@ describe Kitchen::Provisioner::Base do
|
|
151
151
|
connection.stubs(:execute)
|
152
152
|
connection.stubs(:execute_with_retry)
|
153
153
|
connection.stubs(:upload)
|
154
|
+
connection.stubs(:download)
|
155
|
+
config[:downloads] = {
|
156
|
+
["/tmp/kitchen/nodes", "/tmp/kitchen/data_bags"] => "./test/fixtures",
|
157
|
+
"/remote" => "/local",
|
158
|
+
}
|
154
159
|
end
|
155
160
|
|
156
161
|
after do
|
@@ -196,6 +201,8 @@ describe Kitchen::Provisioner::Base do
|
|
196
201
|
|
197
202
|
logged_output.string
|
198
203
|
.must_match(/INFO -- : Transferring files to instance$/)
|
204
|
+
logged_output.string
|
205
|
+
.must_match(/INFO -- : Downloading files from instance$/)
|
199
206
|
end
|
200
207
|
|
201
208
|
it "uploads sandbox files" do
|
@@ -208,6 +215,24 @@ describe Kitchen::Provisioner::Base do
|
|
208
215
|
cmd
|
209
216
|
|
210
217
|
logged_output.string.must_match(/DEBUG -- : Transfer complete$/)
|
218
|
+
logged_output.string.must_match(
|
219
|
+
%r{DEBUG -- : Downloading /tmp/kitchen/nodes, /tmp/kitchen/data_bags to ./test/fixtures$}
|
220
|
+
)
|
221
|
+
logged_output.string.must_match(
|
222
|
+
%r{DEBUG -- : Downloading /remote to /local$}
|
223
|
+
)
|
224
|
+
logged_output.string.must_match(/DEBUG -- : Download complete$/)
|
225
|
+
end
|
226
|
+
|
227
|
+
it "downloads files" do
|
228
|
+
connection.expects(:download).with(
|
229
|
+
["/tmp/kitchen/nodes", "/tmp/kitchen/data_bags"],
|
230
|
+
"./test/fixtures"
|
231
|
+
)
|
232
|
+
|
233
|
+
connection.expects(:download).with("/remote", "/local")
|
234
|
+
|
235
|
+
cmd
|
211
236
|
end
|
212
237
|
|
213
238
|
it "raises an ActionFailed on transfer when TransportFailed is raised" do
|
File without changes
|
File without changes
|
@@ -519,6 +519,34 @@ describe Kitchen::Provisioner::ChefBase do
|
|
519
519
|
end.returns(installer)
|
520
520
|
cmd
|
521
521
|
end
|
522
|
+
|
523
|
+
describe "when driver implements the cache_directory" do
|
524
|
+
|
525
|
+
describe "for windows" do
|
526
|
+
before { driver.stubs(:cache_directory).returns('$env:TEMP\\dummy\\place') }
|
527
|
+
|
528
|
+
it "will have the set behavior on windows" do
|
529
|
+
platform.stubs(:shell_type).returns("powershell")
|
530
|
+
platform.stubs(:os_type).returns("windows")
|
531
|
+
|
532
|
+
Mixlib::Install.expects(:new).with do |opts|
|
533
|
+
opts[:install_command_options][:download_directory].must_equal '$env:TEMP\\dummy\\place'
|
534
|
+
end.returns(installer)
|
535
|
+
cmd
|
536
|
+
end
|
537
|
+
end
|
538
|
+
|
539
|
+
describe "for shell" do
|
540
|
+
before { driver.stubs(:cache_directory).returns("/tmp") }
|
541
|
+
|
542
|
+
it "will have the set behavior on non-windows" do
|
543
|
+
Mixlib::Install.expects(:new).with do |opts|
|
544
|
+
opts[:install_command_options][:cmdline_dl_dir].must_equal "/tmp"
|
545
|
+
end.returns(installer)
|
546
|
+
cmd
|
547
|
+
end
|
548
|
+
end
|
549
|
+
end
|
522
550
|
end
|
523
551
|
|
524
552
|
describe "when install_strategy is skipped" do
|