Skip to content

Commit

Permalink
Tests: use vagrant-cachier plugin if available to speed up downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnix committed May 29, 2015
1 parent d76759c commit 2b780bc
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions fabtools/tests/functional_tests/conftest.py
Expand Up @@ -59,11 +59,25 @@ def _allow_fabric_to_access_the_real_stdin():
mock_sys.stdin = sys.__stdin__


_VAGRANTFILE_TEMPLATE = """\
Vagrant.configure(2) do |config|
config.vm.box = "%s"
# Speed up downloads using a shared cache across boxes
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
end
"""


def _init_vagrant_machine(base_box):
with lcd(HERE):
with settings(hide('stdout')):
local('rm -f Vagrantfile')
local('vagrant init %s' % quote(base_box))
path = os.path.join(HERE, 'Vagrantfile')
contents = _VAGRANTFILE_TEMPLATE % base_box
with open(path, 'w') as vagrantfile:
vagrantfile.write(contents)


def _start_vagrant_machine(provider):
Expand Down

0 comments on commit 2b780bc

Please sign in to comment.