test-kitchen 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ad48e5953da8eb9d58bd3a8e2933450d669caa8
4
- data.tar.gz: 9d661157b18854c43bb1ce3094cb95888b9e0f95
3
+ metadata.gz: d0bfb5c1983b33e20f7925f0a16a11715722709f
4
+ data.tar.gz: 94e6416a2bd326c8af32f5f487d9ea03a3955c60
5
5
  SHA512:
6
- metadata.gz: 61f25a72986488f05691bbbcb1189e08bac9a6953c52bbc93980c0f7caa283ac80a197da1a296e273217d99f43115f1cecfc136ccc43804eefc985a97e170894
7
- data.tar.gz: 344538d21ba1ce73e9c892bb895ad59f31a078eb661552ef8661d6c878f5d4f187eee6eb5f13756eb81fd894f2ee632a1a360fa87a9452fb8f06f3a4bb5ba3dd
6
+ metadata.gz: 915072c1d3a53cf5efd32f13b39e05265dc16b5784cc1c865e71a2e4aae0c040c52e605c0f98b58694379575ccee537ee4e34e51573972efa5720519a9809774
7
+ data.tar.gz: 8c66b2c4a90bfa708304a8174c834f6192f8721c7407137f71336f6a71cb79b380dcfa8bc417dec135731641e18fa24f81735d501fdaa3d6ca17e7850fcc8fa9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Change Log
2
2
 
3
+ ## [1.9.0](https://github.com/test-kitchen/test-kitchen/tree/1.9.0) (2016-05-26)
4
+ [Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.8.0...1.9.0)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - Buffer errors until the end of an action [\#1034](https://github.com/test-kitchen/test-kitchen/pull/1034) ([smurawski](https://github.com/smurawski))
9
+ - Added ECOSYSTEM doc highlight all the core Test-Kitchen and community plugins. [\#1015](https://github.com/test-kitchen/test-kitchen/pull/1015) ([jjasghar](https://github.com/jjasghar))
10
+ - Add kitchen-azurerm to list of community-provided drivers [\#1024](https://github.com/test-kitchen/test-kitchen/pull/1024) ([stuartpreston](https://github.com/stuartpreston))
11
+ - uploads: reuse connections+disable compression [\#1023](https://github.com/test-kitchen/test-kitchen/pull/1023) ([lamont-granquist](https://github.com/lamont-granquist))
12
+
13
+ **Fixed bugs:**
14
+
15
+ - Use command\_prefix provided by Kitchen::Provisioner::Base in shell provisioner [\#1033](https://github.com/test-kitchen/test-kitchen/pull/1033) ([pstengel](https://github.com/pstengel))
16
+ - Empty string for the config setting for proxies did not really work [\#1027](https://github.com/test-kitchen/test-kitchen/pull/1027) ([smurawski](https://github.com/smurawski))
17
+ - Update `chef\_omnbius\_url` default value [\#1028](https://github.com/test-kitchen/test-kitchen/pull/1028) ([schisamo](https://github.com/schisamo))
18
+ - Fix grammar in common\_sandbox warning message [\#1031](https://github.com/test-kitchen/test-kitchen/pull/1031) ([emachnic](https://github.com/emachnic))
19
+
3
20
  ## [1.8.0](https://github.com/test-kitchen/test-kitchen/tree/1.8.0) (2016-05-05)
4
21
  [Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.7.3...1.8.0)
5
22
 
data/ECOSYSTEM.md ADDED
@@ -0,0 +1,92 @@
1
+ # Community and Ecosystem plugins
2
+
3
+ Here is collection of possible extensions to the base test-kitchen application:
4
+
5
+ The following are in the test-kitchen organization
6
+
7
+ [kitchen-ec2][ec2] | [kitchen-digitalocean][do] | [kitchen-openstack][open] | [kitchen-rackspace][rs] | [kitchen-google][google] | [kitchen-vagrant][vagrant]
8
+ ---- | ---- | ---- | ---- | ---- | ----
9
+ [![Status](https://travis-ci.org/test-kitchen/kitchen-ec2.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-ec2)| [![Status](https://travis-ci.org/test-kitchen/kitchen-digitalocean.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-digitalocean) | [![Status](https://travis-ci.org/test-kitchen/kitchen-openstack.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-openstack) | [![Status](https://travis-ci.org/test-kitchen/kitchen-rackspace.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-rackspace) | [![Status](https://travis-ci.org/test-kitchen/kitchen-google.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-google) | [![Status](https://travis-ci.org/test-kitchen/kitchen-vagrant.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-vagrant)
10
+ [![Gem Version](https://badge.fury.io/rb/kitchen-ec2.svg)](http://badge.fury.io/rb/kitchen-ec2) | [![Gem Version](https://badge.fury.io/rb/kitchen-digitalocean.svg)](http://badge.fury.io/rb/kitchen-digitalocean) | [![Gem Version](https://badge.fury.io/rb/kitchen-openstack.svg)](http://badge.fury.io/rb/kitchen-openstack) | [![Gem Version](https://badge.fury.io/rb/kitchen-rackspace.svg)](http://badge.fury.io/rb/kitchen-rackspace) | [![Gem Version](https://badge.fury.io/rb/kitchen-google.svg)](http://badge.fury.io/rb/kitchen-google) | [![Gem Version](https://badge.fury.io/rb/kitchen-vagrant.svg)](http://badge.fury.io/rb/kitchen-vagrant)
11
+
12
+ [kitchen-dsc][dsc] | [kitchen-pester][pester] | [kitchen-joyent][joyent] | [kitchen-opennebula][opennebula] | [kitchen-hyperv][hyperv] | [kitchen-cloudstack][cloudstack]
13
+ ---- | ---- | ---- | ---- | ---- | ----
14
+ [![Status](https://travis-ci.org/test-kitchen/kitchen-dsc.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-dsc)| [![Status](https://travis-ci.org/test-kitchen/kitchen-pester.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-pester) | [![Status](https://travis-ci.org/test-kitchen/kitchen-joyent.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-joyent) | [![Status](https://travis-ci.org/test-kitchen/kitchen-opennebula.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-opennebula) | [![Status](https://travis-ci.org/test-kitchen/kitchen-hyperv.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-hyperv) | [![Status](https://travis-ci.org/test-kitchen/kitchen-cloudstack.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-cloudstack)
15
+ [![Gem Version](https://badge.fury.io/rb/kitchen-dsc.svg)](http://badge.fury.io/rb/kitchen-dsc) | [![Gem Version](https://badge.fury.io/rb/kitchen-pester.svg)](http://badge.fury.io/rb/kitchen-pester) | [![Gem Version](https://badge.fury.io/rb/kitchen-joyent.svg)](http://badge.fury.io/rb/kitchen-joyent) | [![Gem Version](https://badge.fury.io/rb/kitchen-opennebula.svg)](http://badge.fury.io/rb/kitchen-opennebula) | [![Gem Version](https://badge.fury.io/rb/kitchen-hyperv.svg)](http://badge.fury.io/rb/kitchen-hyperv) | [![Gem Version](https://badge.fury.io/rb/kitchen-cloudstack.svg)](http://badge.fury.io/rb/kitchen-cloudstack)
16
+
17
+ The following are written by the [chef][chef] organization.
18
+
19
+ [kitchen-appbundle-updater][appbundle-updater] | [kitchen-inspec][inspec] |
20
+ ---- | ---- | ---- | ---- | ---- | ----
21
+ [![Status](https://travis-ci.org/chef/kitchen-appbundle-updater.svg?branch=master)](https://travis-ci.org/chef/kitchen-appbundle-updater)| [![Status](https://travis-ci.org/chef/kitchen-inspec.svg?branch=master)](https://travis-ci.org/chef/kitchen-inspec) |
22
+ [![Gem Version](https://badge.fury.io/rb/kitchen-appbundle-updater.svg)](http://badge.fury.io/rb/kitchen-appbundle-updater) | [![Gem Version](https://badge.fury.io/rb/kitchen-inspec.svg)](http://badge.fury.io/rb/kitchen-inspec) |
23
+
24
+ The following are written by the [chef-partners][chefpartners] organization.
25
+
26
+ [kitchen-vra][vra] | [kitchen-vro][vro] | [kitchen-vcair][vcair] | [kitchen-oraclecloud][oracle] | [kitchen-ssh-cisco][sadpanda]
27
+ ---- | ---- | ---- | ---- | ---- | ----
28
+ [![Status](https://travis-ci.org/chef-partners/kitchen-vra.svg?branch=master)](https://travis-ci.org/chef-partners/kitchen-vra)| [![Status](https://travis-ci.org/chef-partners/kitchen-vro.svg?branch=master)](https://travis-ci.org/chef-partners/kitchen-vro) | [![Status](https://travis-ci.org/chef-partners/kitchen-vcair.svg?branch=master)](https://travis-ci.org/chef-partners/kitchen-vcair) | [![Status](https://travis-ci.org/chef-partners/kitchen-oraclecloud.svg?branch=master)](https://travis-ci.org/chef-partners/kitchen-oraclecloud) | [![Status](https://travis-ci.org/chef-partners/kitchen-ssh-cisco.svg?branch=master)](https://travis-ci.org/chef-partners/kitchen-ssh-cisco) | [![Status](https://travis-ci.org/test-kitchen/kitchen-cloudstack.svg?branch=master)](https://travis-ci.org/test-kitchen/kitchen-cloudstack)
29
+ [![Gem Version](https://badge.fury.io/rb/kitchen-vra.svg)](http://badge.fury.io/rb/kitchen-vra) | [![Gem Version](https://badge.fury.io/rb/kitchen-vro.svg)](http://badge.fury.io/rb/kitchen-vro) | [![Gem Version](https://badge.fury.io/rb/kitchen-vcair.svg)](http://badge.fury.io/rb/kitchen-vcair) | [![Gem Version](https://badge.fury.io/rb/kitchen-oraclecloud.svg)](http://badge.fury.io/rb/kitchen-oraclecloud) | [![Gem Version](https://badge.fury.io/rb/kitchen-ssh-cisco.svg)](http://badge.fury.io/rb/kitchen-ssh-cisco)
30
+
31
+ The following are community driven plugins.
32
+
33
+ [kitchen-sync][sync] | [kitchen-ansible][ansible] | [kitchen-puppet][puppet] | [kitchen-salt][salt] | [kitchen-dokken][dokken] | [kitchen-lxc][lxc]
34
+ ---- | ---- | ---- | ---- | ---- | ----
35
+ [![Status](https://travis-ci.org/coderanger/kitchen-sync.svg?branch=master)](https://travis-ci.org/coderanger/kitchen-sync)| [![Status](https://travis-ci.org/neillturner/kitchen-ansible.svg?branch=master)](https://travis-ci.org/neillturner/kitchen-ansible) | [![Status](https://travis-ci.org/neillturner/kitchen-puppet.svg?branch=master)](https://travis-ci.org/neillturner/kitchen-puppet) | [![Status](https://travis-ci.org/kitchen-salt/kitchen-salt.svg?branch=master)](https://travis-ci.org/kitchen-salt/kitchen-salt) | [![Status](https://travis-ci.org/someara/kitchen-dokken.svg?branch=master)](https://travis-ci.org/someara/kitchen-dokken) | [![Status](https://travis-ci.org/chrisroberts/kitchen-lxc.svg?branch=master)](https://travis-ci.org/chrisroberts/kitchen-lxc)
36
+ [![Gem Version](https://badge.fury.io/rb/kitchen-sync.svg)](http://badge.fury.io/rb/kitchen-sync) | [![Gem Version](https://badge.fury.io/rb/kitchen-ansible.svg)](http://badge.fury.io/rb/kitchen-ansible) | [![Gem Version](https://badge.fury.io/rb/kitchen-puppet.svg)](http://badge.fury.io/rb/kitchen-puppet) | [![Gem Version](https://badge.fury.io/rb/kitchen-salt.svg)](http://badge.fury.io/rb/kitchen-salt) | [![Gem Version](https://badge.fury.io/rb/kitchen-dokken.svg)](http://badge.fury.io/rb/kitchen-dokken) | [![Gem Version](https://badge.fury.io/rb/kitchen-lxc.svg)](http://badge.fury.io/rb/kitchen-lxc)
37
+
38
+ [kitchen-nodes][nodes] | [kitchen-zcloudjp][zcloudjp] | [kitchen-bluebox][bluebox] | [kitchen-softlayer][softlayer] | [kitchen-linode][linode] | [kitchen-docker][docker]
39
+ ---- | ---- | ---- | ---- | ---- | ----
40
+ [![Status](https://travis-ci.org/mwrock/kitchen-nodes.svg?branch=master)](https://travis-ci.org/mwwrock/kitchen-nodes) | [![Status](https://travis-ci.org/higanworks/kitchen-zcloudjp.svg?branch=master)](https://travis-ci.org/higanworks/kitchen-zcloudjp) | [![Status](https://travis-ci.org/blueboxgroup/kitchen-bluebox.svg?branch=master)](https://travis-ci.org/blueboxgroup/kitchen-bluebox) | [![Status](https://travis-ci.org/neillturner/kitchen-softlayer.svg?branch=master)](https://travis-ci.org/neillturner/kitchen-softlayer) | [![Status](https://travis-ci.org/ssplatt/kitchen-linode.svg?branch=master)](https://travis-ci.org/ssplatt/kitchen-linode) | [![Status](https://travis-ci.org/ssplatt/kitchen-docker.svg?branch=master)](https://travis-ci.org/portertech/kitchen-docker)
41
+ [![Gem Version](https://badge.fury.io/rb/kitchen-nodes.svg)](http://badge.fury.io/rb/kitchen-nodes) | [![Gem Version](https://badge.fury.io/rb/kitchen-zcloudjp.svg)](http://badge.fury.io/rb/kitchen-zcloudjp) | [![Gem Version](https://badge.fury.io/rb/kitchen-bluebox.svg)](http://badge.fury.io/rb/kitchen-bluebox) | [![Gem Version](https://badge.fury.io/rb/kitchen-softlayer.svg)](http://badge.fury.io/rb/kitchen-softlayer) | [![Gem Version](https://badge.fury.io/rb/kitchen-linode.svg)](http://badge.fury.io/rb/kitchen-linode) | [![Gem Version](https://badge.fury.io/rb/kitchen-docker.svg)](http://badge.fury.io/rb/kitchen-docker)
42
+
43
+ [kitchen-qemu][qemu] | [kitchen-cfengine][cfengine] | [kitchen-cloudformation][cloudformation] | [kitchen-wpar][wpar] | [kitchen-powervc][powervc]
44
+ ---- | ---- | ---- | ---- | ---- | ----
45
+ [![Status](https://travis-ci.org/esmil/kitchen-qemu.svg?branch=master)](https://travis-ci.org/esmil/kitchen-qemu)| [![Status](https://travis-ci.org/nmische/kitchen-cfengine.svg?branch=master)](https://travis-ci.org/nmische/kitchen-cfengine) | [![Status](https://travis-ci.org/neillturner/kitchen-cloudformation.svg?branch=master)](https://travis-ci.org/neillturner/kitchen-cloudformation) | [![Status](https://travis-ci.org/adejoux/kitchen-wpar.svg?branch=master)](https://travis-ci.org/adejoux/kitchen-wpar) | [![Status](https://travis-ci.org/chmod666org/kitchen-powervc.svg?branch=master)](https://travis-ci.org/chmod666org/kitchen-powervc)
46
+ [![Gem Version](https://badge.fury.io/rb/kitchen-qemu.svg)](http://badge.fury.io/rb/kitchen-qemu) | [![Gem Version](https://badge.fury.io/rb/kitchen-cfengine.svg)](http://badge.fury.io/rb/kitchen-cfengine) | [![Gem Version](https://badge.fury.io/rb/kitchen-cloudformation.svg)](http://badge.fury.io/rb/kitchen-cloudformation) | [![Gem Version](https://badge.fury.io/rb/kitchen-wpar.svg)](http://badge.fury.io/rb/kitchen-wpar) | [![Gem Version](https://badge.fury.io/rb/kitchen-powervc.svg)](http://badge.fury.io/rb/kitchen-powervc)
47
+
48
+ [kitchen-azurerm][azurerm] |
49
+ ---- |
50
+ [![Status](https://travis-ci.org/pendrica/kitchen-azurerm.svg?branch=master)](https://travis-ci.org/pendrica/kitchen-azurerm) |
51
+ [![Gem Version](https://badge.fury.io/rb/kitchen-azurerm.svg)](http://badge.fury.io/rb/kitchen-azurerm) |
52
+
53
+
54
+ [chefpartners]: https://github.com/chef-partners/
55
+ [ec2]: https://github.com/test-kitchen/kitchen-ec2
56
+ [do]: https://github.com/test-kitchen/kitchen-digitalocean
57
+ [open]: https://github.com/test-kitchen/kitchen-openstack
58
+ [rs]: https://github.com/test-kitchen/kitchen-rackspace
59
+ [google]: https://github.com/test-kitchen/kitchen-google
60
+ [vagrant]: https://github.com/test-kitchen/kitchen-vagrant
61
+ [dsc]: https://github.com/test-kitchen/kitchen-dsc
62
+ [pester]: https://github.com/test-kitchen/kitchen-pester
63
+ [joyent]: https://github.com/test-kitchen/kitchen-joyent
64
+ [opennebula]: https://github.com/test-kitchen/kitchen-opennebula
65
+ [hyperv]: https://github.com/test-kitchen/kitchen-hyperv
66
+ [cloudstack]: https://github.com/test-kitchen/kitchen-cloudstack
67
+ [vra]: https://github.com/chef-partners/kitchen-vra
68
+ [vro]: https://github.com/chef-partners/kitchen-vro
69
+ [vcair]: https://github.com/chef-partners/kitchen-vcair
70
+ [oracle]: https://github.com/chef-partners/kitchen-oraclecloud
71
+ [sadpanda]: https://github.com/chef-partners/kitchen-ssh-cisco
72
+ [sync]: https://github.com/coderanger/kitchen-sync
73
+ [ansible]: https://github.com/neillturner/kitchen-ansible
74
+ [puppet]: https://github.com/neillturner/kitchen-puppet
75
+ [salt]: https://github.com/kitchen-salt/kitchen-salt
76
+ [dokken]: https://github.com/someara/kitchen-dokken
77
+ [lxc]: https://github.com/chrisroberts/kitchen-lxc
78
+ [nodes]: https://github.com/mwrock/kitchen-nodes
79
+ [zcloudjp]: https://github.com/higanworks/kitchen-zcloudjp
80
+ [bluebox]: https://github.com/blueboxgroup/kitchen-bluebox
81
+ [softlayer]: https://github.com/neillturner/kitchen-softlayer
82
+ [linode]: https://github.com/ssplatt/kitchen-linode
83
+ [qemu]: https://github.com/esmil/kitchen-qemu
84
+ [cfengine]: https://github.com/nmische/kitchen-cfengine
85
+ [cloudformation]: https://github.com/neillturner/kitchen-cloudformation
86
+ [wpar]: https://github.com/adejoux/kitchen-wpar
87
+ [powervc]: https://github.com/chmod666org/kitchen-powervc
88
+ [appbundle-updater]: https://github.com/chef/kitchen-appbundle-updater
89
+ [inspec]: https://github.com/chef/kitchen-inspec
90
+ [chef]: https://chef.io
91
+ [azurerm]: http://github.com/pendrica/kitchen-azurerm
92
+ [docker]: https://github.com/portertech/kitchen-docker
data/README.md CHANGED
@@ -100,6 +100,10 @@ read and contribute to improve them!
100
100
 
101
101
  Test Kitchen aims to adhere to [Semantic Versioning 2.0.0][semver].
102
102
 
103
+ ## Community and Ecosystem
104
+
105
+ If you would like to see a few of the plugins or ecosystem helpers, please look at [ECOSYSTEM.md][ecosystem].
106
+
103
107
  ## Development
104
108
 
105
109
  * Source hosted at [GitHub][repo]
@@ -136,3 +140,4 @@ Apache License, Version 2.0 (see [LICENSE][license])
136
140
  [semver]: http://semver.org/
137
141
  [twitter]: https://twitter.com/kitchenci
138
142
  [website]: http://kitchen.ci
143
+ [ecosystem]: https://github.com/test-kitchen/test-kitchen/blob/master/ECOSYSTEM.md
data/bin/kitchen CHANGED
File without changes
@@ -159,26 +159,45 @@ module Kitchen
159
159
  # @param action [String] action to perform
160
160
  # @param instances [Array<Instance>] an array of instances
161
161
  def run_action(action, instances, *args)
162
- concurrency = 1
163
- if options[:concurrency]
164
- concurrency = options[:concurrency] || instances.size
165
- concurrency = instances.size if concurrency > instances.size
166
- end
162
+ concurrency = concurrency_setting(instances)
167
163
 
168
164
  queue = Queue.new
169
165
  instances.each { |i| queue << i }
170
166
  concurrency.times { queue << nil }
171
167
 
172
168
  threads = []
169
+ @action_errors = []
173
170
  concurrency.times do
174
171
  threads << Thread.new do
175
172
  while instance = queue.pop
176
- instance.public_send(action, *args)
177
- instance.cleanup!
173
+ run_action_in_thread(action, instance, *args)
178
174
  end
179
175
  end
180
176
  end
181
177
  threads.map(&:join)
178
+ unless @action_errors.empty?
179
+ raise ActionFailed.new("#{@action_errors.length} actions failed.", @action_errors)
180
+ end
181
+ end
182
+
183
+ # private
184
+ def concurrency_setting(instances)
185
+ concurrency = 1
186
+ if options[:concurrency]
187
+ concurrency = options[:concurrency] || instances.size
188
+ concurrency = instances.size if concurrency > instances.size
189
+ end
190
+ concurrency
191
+ end
192
+
193
+ def run_action_in_thread(action, instance, *args)
194
+ instance.public_send(action, *args)
195
+ rescue Kitchen::ActionFailed => e
196
+ new_error = Kitchen::ActionFailed.new("#{e.message} on #{instance.name}")
197
+ new_error.set_backtrace(e.backtrace)
198
+ @action_errors << new_error
199
+ ensure
200
+ instance.cleanup!
182
201
  end
183
202
  end
184
203
  end
@@ -306,53 +306,68 @@ module Kitchen
306
306
  # @param code [String] the shell code to be wrapped
307
307
  # @return [String] wrapped shell code
308
308
  # @api private
309
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
310
- # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
311
309
  def wrap_shell_code(code)
312
- env = []
313
- if config[:http_proxy] && !config[:http_proxy].empty?
314
- env << shell_env_var("http_proxy", config[:http_proxy])
315
- env << shell_env_var("HTTP_PROXY", config[:http_proxy])
316
- else
317
- export_proxy(env, "http")
318
- end
319
- if config[:https_proxy] && !config[:https_proxy].empty?
320
- env << shell_env_var("https_proxy", config[:https_proxy])
321
- env << shell_env_var("HTTPS_PROXY", config[:https_proxy])
322
- else
323
- export_proxy(env, "https")
324
- end
325
- if config[:ftp_proxy] && !config[:ftp_proxy].empty?
326
- env << shell_env_var("ftp_proxy", config[:ftp_proxy])
327
- env << shell_env_var("FTP_PROXY", config[:ftp_proxy])
328
- else
329
- export_proxy(env, "ftp")
310
+ return env_wrapped code if powershell_shell?
311
+ Util.wrap_command((env_wrapped code))
312
+ end
313
+
314
+ def env_wrapped(code)
315
+ (proxy_settings << code).join("\n")
316
+ end
317
+
318
+ def proxy_setting_keys
319
+ [:http_proxy, :https_proxy, :ftp_proxy]
320
+ end
321
+
322
+ def resolve_proxy_settings_from_config
323
+ proxy_setting_keys.each_with_object([]) do |protocol, set_env|
324
+ if !config.key?(protocol) || config[protocol].nil?
325
+ export_proxy(set_env, protocol)
326
+ elsif proxy_config_setting_present?(protocol)
327
+ set_env << shell_env_var("#{protocol.downcase}", config[protocol])
328
+ set_env << shell_env_var("#{protocol.upcase}", config[protocol])
329
+ end
330
330
  end
331
+ end
332
+
333
+ def proxy_settings
334
+ env = resolve_proxy_settings_from_config
335
+
331
336
  # if http_proxy was set from environment variable or https_proxy was set
332
337
  # from environment variable, or ftp_proxy was set from environment
333
338
  # variable, include no_proxy environment variable, if set.
334
- if (!config[:http_proxy] && (ENV["http_proxy"] || ENV["HTTP_PROXY"])) ||
335
- (!config[:https_proxy] && (ENV["https_proxy"] || ENV["HTTPS_PROXY"])) ||
336
- (!config[:ftp_proxy] && (ENV["ftp_proxy"] || ENV["FTP_PROXY"]))
339
+ if !proxy_from_config? && proxy_from_environment?
337
340
  env << shell_env_var("no_proxy", ENV["no_proxy"]) if ENV["no_proxy"]
338
341
  env << shell_env_var("NO_PROXY", ENV["NO_PROXY"]) if ENV["NO_PROXY"]
339
342
  end
340
- if powershell_shell?
341
- env.join("\n").concat("\n").concat(code)
342
- else
343
- Util.wrap_command(env.join("\n").concat("\n").concat(code))
343
+ env
344
+ end
345
+
346
+ def proxy_from_config?
347
+ proxy_setting_keys.any? do |protocol|
348
+ !config[protocol].nil?
349
+ end
350
+ end
351
+
352
+ def proxy_from_environment?
353
+ proxy_setting_keys.any? do |protocol|
354
+ !ENV["#{protocol.downcase}"].nil? || !ENV["#{protocol.upcase}"].nil?
344
355
  end
345
356
  end
346
357
 
358
+ def proxy_config_setting_present?(protocol)
359
+ config.key?(protocol) && !config[protocol].nil? && !config[protocol].empty?
360
+ end
361
+
347
362
  # Helper method to export
348
363
  #
349
364
  # @param env [Array] the environment to modify
350
365
  # @param code [String] the type of proxy to export, one of 'http', 'https' or 'ftp'
351
366
  # @api private
352
367
  def export_proxy(env, type)
353
- env << shell_env_var("#{type}_proxy", ENV["#{type}_proxy"]) if ENV["#{type}_proxy"]
354
- env << shell_env_var("#{type.upcase}_PROXY", ENV["#{type.upcase}_PROXY"]) if
355
- ENV["#{type.upcase}_PROXY"]
368
+ env << shell_env_var("#{type}", ENV["#{type}"]) if ENV["#{type}"]
369
+ env << shell_env_var("#{type.upcase}", ENV["#{type.upcase}"]) if
370
+ ENV["#{type.upcase}"]
356
371
  end
357
372
 
358
373
  # Class methods which will be mixed in on inclusion of Configurable module.
@@ -19,6 +19,7 @@
19
19
  require "thor/util"
20
20
 
21
21
  require "kitchen/lazy_hash"
22
+ require "benchmark"
22
23
 
23
24
  module Kitchen
24
25
 
@@ -291,7 +292,13 @@ module Kitchen
291
292
  return if locals.nil? || Array(locals).empty?
292
293
 
293
294
  info("Transferring files to #{instance.to_str}")
294
- locals.each { |local| connection.upload_path!(local, remote) }
295
+ debug("TIMING: scp asynch upload (Kitchen::Driver::SSHBase)")
296
+ elapsed = Benchmark.measure do
297
+ waits = locals.map { |local| connection.upload_path(local, remote) }
298
+ waits.each(&:wait)
299
+ end
300
+ delta = Util.duration(elapsed.real)
301
+ debug("TIMING: scp async upload (Kitchen::Driver::SSHBase) took #{delta}")
295
302
  debug("Transfer complete")
296
303
  rescue SSHFailed, Net::SSH::Exception => ex
297
304
  raise ActionFailed, ex.message
@@ -43,15 +43,35 @@ module Kitchen
43
43
  #
44
44
  # @param exception [::StandardError] an exception
45
45
  # @return [Array<String>] a formatted message
46
- def self.formatted_trace(exception)
47
- arr = formatted_exception(exception).dup
48
- last = arr.pop
46
+ def self.formatted_trace(exception, title = "Exception")
47
+ arr = formatted_exception(exception, title).dup
48
+ arr += formatted_backtrace(exception)
49
+
49
50
  if exception.respond_to?(:original) && exception.original
50
- arr += formatted_exception(exception.original, "Nested Exception")
51
- last = arr.pop
51
+ arr += if exception.original.is_a? Array
52
+ exception.original.map do |composite_exception|
53
+ formatted_trace(composite_exception, "Composite Exception").flatten
54
+ end
55
+ else
56
+ [
57
+ formatted_exception(exception.original, "Nested Exception"),
58
+ formatted_backtrace(exception)
59
+ ].flatten
60
+ end
61
+ end
62
+ arr.flatten
63
+ end
64
+
65
+ def self.formatted_backtrace(exception)
66
+ if exception.backtrace.nil?
67
+ []
68
+ else
69
+ [
70
+ "Backtrace".center(22, "-"),
71
+ exception.backtrace,
72
+ "End Backtrace".center(22, "-")
73
+ ]
52
74
  end
53
- arr += ["Backtrace".center(22, "-"), exception.backtrace, last].flatten
54
- arr
55
75
  end
56
76
 
57
77
  # Creates an array of strings, representing a formatted exception that
@@ -298,7 +298,7 @@ module Kitchen
298
298
  def update_dna_for_policyfile
299
299
  if !config[:run_list].nil? && !config[:run_list].empty?
300
300
  warn("You must set your run_list in your policyfile instead of "\
301
- "kitchen config. The run_list your config will be ignored.")
301
+ "kitchen config. The run_list in your config will be ignored.")
302
302
  warn("Ignored run_list: #{config[:run_list].inspect}")
303
303
  end
304
304
  policylock = policyfile.gsub(/\.rb\Z/, ".lock.json")
@@ -46,7 +46,7 @@ module Kitchen
46
46
  class ChefBase < Base
47
47
 
48
48
  default_config :require_chef_omnibus, true
49
- default_config :chef_omnibus_url, "https://www.chef.io/chef/install.sh"
49
+ default_config :chef_omnibus_url, "https://omnitruck.chef.io/install.sh"
50
50
  default_config :chef_omnibus_install_options, nil
51
51
  default_config :run_list, []
52
52
  default_config :attributes, {}
@@ -79,7 +79,7 @@ module Kitchen
79
79
  )
80
80
  code = powershell_shell? ? %{& "#{script}"} : sudo(script)
81
81
 
82
- wrap_shell_code(code)
82
+ prefix_command(wrap_shell_code(code))
83
83
  end
84
84
 
85
85
  private
data/lib/kitchen/ssh.rb CHANGED
@@ -104,6 +104,18 @@ module Kitchen
104
104
  session.scp.upload!(local, remote, options, &progress)
105
105
  end
106
106
 
107
+ def upload(local, remote, options = {}, &progress)
108
+ if progress.nil?
109
+ progress = lambda { |_ch, name, sent, total|
110
+ if sent == total
111
+ logger.debug("Async Uploaded #{name} (#{total} bytes)")
112
+ end
113
+ }
114
+ end
115
+
116
+ session.scp.upload(local, remote, options, &progress)
117
+ end
118
+
107
119
  # Uploads a recursive directory to remote host.
108
120
  #
109
121
  # @param local [String] path to local file or directory
@@ -118,6 +130,11 @@ module Kitchen
118
130
  upload!(local, remote, options, &progress)
119
131
  end
120
132
 
133
+ def upload_path(local, remote, options = {}, &progress)
134
+ options = { :recursive => true }.merge(options)
135
+ upload(local, remote, options, &progress)
136
+ end
137
+
121
138
  # Shuts down the session connection, if it is still active.
122
139
  def shutdown
123
140
  return if @session.nil?
@@ -21,6 +21,7 @@ require "kitchen"
21
21
  require "net/ssh"
22
22
  require "net/scp"
23
23
  require "timeout"
24
+ require "benchmark"
24
25
 
25
26
  module Kitchen
26
27
 
@@ -53,7 +54,8 @@ module Kitchen
53
54
  default_config :ssh_key, nil
54
55
  expand_path_for :ssh_key
55
56
 
56
- default_config :compression, true
57
+ # compression disabled by default for speed
58
+ default_config :compression, false
57
59
  required_config :compression
58
60
 
59
61
  default_config :compression_level do |transport|
@@ -145,13 +147,19 @@ module Kitchen
145
147
 
146
148
  # (see Base::Connection#upload)
147
149
  def upload(locals, remote)
148
- Array(locals).each do |local|
149
- opts = File.directory?(local) ? { :recursive => true } : {}
150
+ logger.debug("TIMING: scp async upload (Kitchen::Transport::Ssh)")
151
+ elapsed = Benchmark.measure do
152
+ waits = Array(locals).map do |local|
153
+ opts = File.directory?(local) ? { :recursive => true } : {}
150
154
 
151
- session.scp.upload!(local, remote, opts) do |_ch, name, sent, total|
152
- logger.debug("Uploaded #{name} (#{total} bytes)") if sent == total
155
+ session.scp.upload(local, remote, opts) do |_ch, name, sent, total|
156
+ logger.debug("Async Uploaded #{name} (#{total} bytes)") if sent == total
157
+ end
153
158
  end
159
+ waits.each(&:wait)
154
160
  end
161
+ delta = Util.duration(elapsed.real)
162
+ logger.debug("TIMING: scp async upload (Kitchen::Transport::Ssh) took #{delta}")
155
163
  rescue Net::SSH::Exception => ex
156
164
  raise SshFailed, "SCP upload failed (#{ex.message})"
157
165
  end
@@ -17,5 +17,5 @@
17
17
  # limitations under the License.
18
18
 
19
19
  module Kitchen
20
- VERSION = "1.8.0"
20
+ VERSION = "1.9.0"
21
21
  end
@@ -747,7 +747,6 @@ describe Kitchen::Configurable do
747
747
  it "uses bourne shell (sh)" do
748
748
  cmd.must_equal(outdent!(<<-CODE.chomp))
749
749
  sh -c '
750
-
751
750
  mkdir foo
752
751
  '
753
752
  CODE
@@ -834,22 +833,24 @@ describe Kitchen::Configurable do
834
833
  end
835
834
 
836
835
  it "does not export http_proxy or HTTP_PROXY when :http_proxy is empty" do
836
+ ENV["http_proxy"] = "http://proxy"
837
+ ENV["HTTP_PROXY"] = "http://proxy"
837
838
  config[:http_proxy] = ""
838
839
 
839
840
  cmd.must_equal(outdent!(<<-CODE.chomp))
840
841
  sh -c '
841
-
842
842
  mkdir foo
843
843
  '
844
844
  CODE
845
845
  end
846
846
 
847
847
  it "does not export https_proxy or HTTPS_PROXY when :https_proxy is empty" do
848
+ ENV["https_proxy"] = "https://proxy"
849
+ ENV["HTTPS_PROXY"] = "https://proxy"
848
850
  config[:https_proxy] = ""
849
851
 
850
852
  cmd.must_equal(outdent!(<<-CODE.chomp))
851
853
  sh -c '
852
-
853
854
  mkdir foo
854
855
  '
855
856
  CODE
@@ -873,7 +874,6 @@ describe Kitchen::Configurable do
873
874
 
874
875
  cmd.must_equal(outdent!(<<-CODE.chomp))
875
876
  sh -c '
876
-
877
877
  mkdir foo
878
878
  '
879
879
  CODE
@@ -936,7 +936,7 @@ describe Kitchen::Configurable do
936
936
  before { platform.stubs(:shell_type).returns("powershell") }
937
937
 
938
938
  it "uses powershell shell" do
939
- cmd.must_equal("\nmkdir foo")
939
+ cmd.must_equal("mkdir foo")
940
940
  end
941
941
 
942
942
  it "exports http_proxy & HTTP_PROXY when :http_proxy is set" do
@@ -1076,7 +1076,8 @@ describe Kitchen::Driver::SSHBase do
1076
1076
  describe "#transfer_path" do
1077
1077
 
1078
1078
  let(:cmd) { driver.use_transfer_path(state, ["nope"], "nadda") }
1079
- let(:connection) { stub(:upload_path! => true) }
1079
+ let(:channel) { stub(:wait => true) }
1080
+ let(:connection) { stub(:upload_path! => true, :upload_path => channel) }
1080
1081
 
1081
1082
  before do
1082
1083
  state[:hostname] = "fizzy"
@@ -1099,14 +1100,14 @@ describe Kitchen::Driver::SSHBase do
1099
1100
 
1100
1101
  it "raises an ActionFailed on transfer when SSHFailed is raised" do
1101
1102
  Kitchen::SSH.stubs(:new).returns(connection)
1102
- connection.stubs(:upload_path!).raises(Kitchen::SSHFailed.new("dang"))
1103
+ connection.stubs(:upload_path).raises(Kitchen::SSHFailed.new("dang"))
1103
1104
 
1104
1105
  proc { cmd }.must_raise Kitchen::ActionFailed
1105
1106
  end
1106
1107
 
1107
1108
  it "raises an ActionFailed on exec when Net::SSH:Exception is raised" do
1108
1109
  Kitchen::SSH.stubs(:new).returns(connection)
1109
- connection.stubs(:upload_path!).raises(Net::SSH::Exception.new("dang"))
1110
+ connection.stubs(:upload_path).raises(Net::SSH::Exception.new("dang"))
1110
1111
 
1111
1112
  proc { cmd }.must_raise Kitchen::ActionFailed
1112
1113
  end
@@ -49,8 +49,6 @@ describe Kitchen::Error do
49
49
  "------Exception-------",
50
50
  "Class: Kitchen::StandardError",
51
51
  "Message: shoot",
52
- "------Backtrace-------",
53
- nil,
54
52
  "----------------------"
55
53
  ])
56
54
  end
@@ -59,7 +57,7 @@ describe Kitchen::Error do
59
57
  begin
60
58
  raise Kitchen::StandardError, "shoot"
61
59
  rescue => e
62
- Kitchen::Error.formatted_trace(e)[4...-1].must_equal e.backtrace
60
+ Kitchen::Error.formatted_trace(e)[5...-1].must_equal e.backtrace
63
61
  end
64
62
  end
65
63
 
@@ -73,15 +71,35 @@ describe Kitchen::Error do
73
71
  "------Exception-------",
74
72
  "Class: Kitchen::StandardError",
75
73
  "Message: shoot",
74
+ "----------------------",
76
75
  "---Nested Exception---",
77
76
  "Class: IOError",
78
77
  "Message: no disk, yo",
79
- "------Backtrace-------",
80
- nil,
81
78
  "----------------------"
82
79
  ])
83
80
  end
84
81
  end
82
+
83
+ it "returns an array when an error has more than one error in original" do
84
+ error_array = []
85
+ error_array << Kitchen::StandardError.new("one")
86
+ error_array << Kitchen::StandardError.new("two")
87
+ composite_error = Kitchen::StandardError.new("array", error_array)
88
+
89
+ Kitchen::Error.formatted_trace(composite_error).must_equal([
90
+ "------Exception-------",
91
+ "Class: Kitchen::StandardError",
92
+ "Message: array",
93
+ "----------------------",
94
+ "-Composite Exception--",
95
+ "Class: Kitchen::StandardError",
96
+ "Message: one", "----------------------",
97
+ "-Composite Exception--",
98
+ "Class: Kitchen::StandardError",
99
+ "Message: two",
100
+ "----------------------"
101
+ ])
102
+ end
85
103
  end
86
104
  end
87
105
 
@@ -58,7 +58,7 @@ describe Kitchen::Provisioner::ChefBase do
58
58
 
59
59
  it ":chef_omnibus_url has a default" do
60
60
  provisioner[:chef_omnibus_url].
61
- must_equal "https://www.chef.io/chef/install.sh"
61
+ must_equal "https://omnitruck.chef.io/install.sh"
62
62
  end
63
63
 
64
64
  it ":chef_metadata_url defaults to nil" do
@@ -72,7 +72,7 @@ describe Kitchen::Provisioner::ChefBase do
72
72
 
73
73
  it ":chef_omnibus_url has a default" do
74
74
  provisioner[:chef_omnibus_url].
75
- must_equal "https://www.chef.io/chef/install.sh"
75
+ must_equal "https://omnitruck.chef.io/install.sh"
76
76
  end
77
77
 
78
78
  end
@@ -149,7 +149,7 @@ describe Kitchen::Provisioner::ChefBase do
149
149
  let(:cmd) { provisioner.install_command }
150
150
 
151
151
  let(:install_opts) {
152
- { :omnibus_url => "https://www.chef.io/chef/install.sh",
152
+ { :omnibus_url => "https://omnitruck.chef.io/install.sh",
153
153
  :project => nil, :install_flags => nil, :sudo_command => "sudo -E",
154
154
  :http_proxy => nil, :https_proxy => nil }
155
155
  }
@@ -315,6 +315,14 @@ describe Kitchen::Provisioner::Shell do
315
315
  cmd.must_match regexify("/r/bootstrap.sh", :partial_line)
316
316
  cmd.wont_match regexify("sudo -E /r/bootstrap.sh", :partial_line)
317
317
  end
318
+
319
+ it "uses command_prefix for script when configured" do
320
+ config[:command_prefix] = "TEST=yes"
321
+ config[:root_path] = "/r"
322
+ config[:sudo] = false
323
+
324
+ cmd.must_match(/^TEST=yes/)
325
+ end
318
326
  end
319
327
 
320
328
  describe "for powershell shells on windows os types" do
@@ -148,7 +148,7 @@ describe Kitchen::Transport::Ssh do
148
148
  end
149
149
 
150
150
  it "sets :compression to true by default" do
151
- transport[:compression].must_equal true
151
+ transport[:compression].must_equal false
152
152
  end
153
153
 
154
154
  it "sets :compression to false if set to none" do
@@ -164,13 +164,13 @@ describe Kitchen::Transport::Ssh do
164
164
  end
165
165
 
166
166
  it "sets :compression_level to 6 by default" do
167
- transport[:compression_level].must_equal 6
167
+ transport[:compression_level].must_equal 0
168
168
  end
169
169
 
170
- it "sets :compression_level to 0 if :compression is set to none" do
171
- config[:compression] = "none"
170
+ it "sets :compression_level to 6 if :compression is set to true" do
171
+ config[:compression] = true
172
172
 
173
- transport[:compression_level].must_equal 0
173
+ transport[:compression_level].must_equal 6
174
174
  end
175
175
 
176
176
  it "sets :keepalive to true by default" do
@@ -1048,9 +1048,11 @@ describe Kitchen::Transport::Ssh::Connection do
1048
1048
  logged_output.string.must_match debug_line(
1049
1049
  "[SSH] opening connection to me@foo<{:port=>22}>"
1050
1050
  )
1051
- logged_output.string.must_match debug_line(
1052
- "Uploaded #{src.path} (1234 bytes)"
1053
- )
1051
+ logged_output.string.lines.count { |l|
1052
+ l =~ debug_line(
1053
+ "Async Uploaded #{src.path} (1234 bytes)"
1054
+ )
1055
+ }.must_equal 1
1054
1056
  end
1055
1057
  end
1056
1058
 
@@ -1119,15 +1121,21 @@ describe Kitchen::Transport::Ssh::Connection do
1119
1121
  logged_output.string.must_match debug_line(
1120
1122
  "[SSH] opening connection to me@foo<{:port=>22}>"
1121
1123
  )
1122
- logged_output.string.must_match debug_line(
1123
- "Uploaded #{@dir}/alpha (15 bytes)"
1124
- )
1125
- logged_output.string.must_match debug_line(
1126
- "Uploaded #{@dir}/subdir/beta (14 bytes)"
1127
- )
1128
- logged_output.string.must_match debug_line(
1129
- "Uploaded #{@dir}/zulu (14 bytes)"
1130
- )
1124
+ logged_output.string.lines.count { |l|
1125
+ l =~ debug_line(
1126
+ "Async Uploaded #{@dir}/alpha (15 bytes)"
1127
+ )
1128
+ }.must_equal 1
1129
+ logged_output.string.lines.count { |l|
1130
+ l =~ debug_line(
1131
+ "Async Uploaded #{@dir}/subdir/beta (14 bytes)"
1132
+ )
1133
+ }.must_equal 1
1134
+ logged_output.string.lines.count { |l|
1135
+ l =~ debug_line(
1136
+ "Async Uploaded #{@dir}/zulu (14 bytes)"
1137
+ )
1138
+ }.must_equal 1
1131
1139
  end
1132
1140
  end
1133
1141
 
File without changes
data/test-kitchen.gemspec CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |gem|
33
33
  gem.add_development_dependency "pry"
34
34
  gem.add_development_dependency "pry-byebug"
35
35
  gem.add_development_dependency "pry-stack_explorer"
36
+ gem.add_development_dependency "rb-readline"
36
37
  gem.add_development_dependency "winrm", "~> 1.6"
37
38
  gem.add_development_dependency "winrm-elevated", "~> 0.4.0"
38
39
  gem.add_development_dependency "winrm-fs", "~> 0.4.1"
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.8.0
4
+ version: 1.9.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: 2016-05-06 00:00:00.000000000 Z
11
+ date: 2016-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -154,6 +154,20 @@ dependencies:
154
154
  - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
+ - !ruby/object:Gem::Dependency
158
+ name: rb-readline
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ type: :development
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
157
171
  - !ruby/object:Gem::Dependency
158
172
  name: winrm
159
173
  requirement: !ruby/object:Gem::Requirement
@@ -413,6 +427,7 @@ files:
413
427
  - Berksfile
414
428
  - CHANGELOG.md
415
429
  - CONTRIBUTING.md
430
+ - ECOSYSTEM.md
416
431
  - Gemfile
417
432
  - Gemfile.proxy_tests
418
433
  - Guardfile
@@ -602,7 +617,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
602
617
  version: '0'
603
618
  requirements: []
604
619
  rubyforge_project:
605
- rubygems_version: 2.6.3
620
+ rubygems_version: 2.6.4
606
621
  signing_key:
607
622
  specification_version: 4
608
623
  summary: Test Kitchen is an integration tool for developing and testing infrastructure