afiune/test-kitchen — pull request #2 by mwrock (2014-07-31 01:04:29+00:00)
Title: move winrm upload to a driver overridable function to allow drivers to dramatically optimize copying chef artifacts to the guest

The act of copying the chef files to the node can be incredibly slow. I'm consistently seeing converges take over 10 minutes to copy the files before the convergence begins. Here are the community cookbooks my cookbook depends on:

depends 'windows'
depends 'newrelic'
depends 'ms_dotnet4'

Not alot but taking in their dependencies and so on and adds up to quite a bit.

Unfortunately, I dont think there is much that can be done about this inside of Test-Kitchen without downloading tools like winscp. There is no getting around that winrm is a lousy file transfer conduit. However, in probably almost all cases, an individual driver can leverage the features of its hypervisor to get dramatically better throughput.

For example, I have modified my VSphere driver to zip the directories, use the vsphere API to upload the zip files and then unzip them via winrm on the node. This takes just seconds compared to the 12 minutes waiting on winrm. I'd imagine the VirtualBox driver could leverage shared folders to realize similar gains.

This PR moves the Upload! method into the public windows driver methods. The default implementation is to use winrm but driver authors can override as necessary. I had to move a few private functions in winrm to be public so that the Upload! method could access them.