Question on Test Kitchen usage - can you halt and restart the vm?

Hi,

I have some questions on using Test Kitchen (http://kitchen.ci/), I’m not
sure if this is the right place to post but wasn’t sure where else to ask.

Is it possible to do the equivalant of a ‘vagrant halt’ or a 'vagrant up’
using Test Kitchen?

I switched to using TestKitchen after having problems running Vagrant with
Berkshelf a Windows 7 PC. Whenever I ‘vagrant up’ I get an error ‘Failed to
load the “vagrant-berkshelf” plugin’ even though the Gem is installed. I
found that Vagrant-berkshelf is being deprecated (according to
https://sethvargo.com/the-future-of-vagrant-berkshelf/)
so I tried Test Kitchen instead and it’s working great with Berkshelf,
however if I reboot my machine I have to run:

kitchen destroy
kitchen create
kitchen converge

Is there any way to halt the vm and just bring it back up again without
having to re-provision it?

If there isn’t and I need to use vagrant directly for this, I assume my
only choice is to get berkshelf to download the dependencies e.g. berks
install --path …/vendor-cookbooks’ and create a Vagrant file to run
chef-solo using this path on the cookbooks_path?

Thanks,
Richard.

Richard:

Test Kitchen will always destroy & re-create the VM if you run kitchen test suite, with suite corresponding to a combo of suite & platform. You can see what’s available as a suite by running kitchen list. By default, TK will destroy a VM after a successful test run. It will not, however, after a kitchen create, if memory serves. You can alter this behavior with the --destroy, or -d flag. Run kitchen test -h for details.


Jeff Byrnes
Operations Engineer
EverTrue
@berkleebassist

On March 26, 2014 at 6:35:37 AM, Richard Murray (rich.j.murray@gmail.com) wrote:

Hi,

I have some questions on using Test Kitchen (http://kitchen.ci/), I’m not sure if this is the right place to post but wasn’t sure where else to ask.

Is it possible to do the equivalant of a ‘vagrant halt’ or a ‘vagrant up’ using Test Kitchen?

I switched to using TestKitchen after having problems running Vagrant with Berkshelf a Windows 7 PC. Whenever I ‘vagrant up’ I get an error ‘Failed to load the “vagrant-berkshelf” plugin’ even though the Gem is installed. I found that Vagrant-berkshelf is being deprecated (according to https://sethvargo.com/the-future-of-vagrant-berkshelf/)
so I tried Test Kitchen instead and it’s working great with Berkshelf, however if I reboot my machine I have to run:

kitchen destroy
kitchen create
kitchen converge

Is there any way to halt the vm and just bring it back up again without having to re-provision it?

If there isn’t and I need to use vagrant directly for this, I assume my only choice is to get berkshelf to download the dependencies e.g. berks install --path …/vendor-cookbooks’ and create a Vagrant file to run chef-solo using this path on the cookbooks_path?

Thanks,
Richard.

Hi there,

Richard Murray rich.j.murray@gmail.com writes:

Is it possible to do the equivalant of a 'vagrant halt' or a 'vagrant up'
using Test Kitchen?

One thing you can do is cd into the directory where kitchen-vagrant
writes the Vagrantfile and run vargant commands. So you can do something
like:

cd .kitchen/kitchen-vagrant/default-ubuntu-1204
vagrant rsync

You can also set the VAGRANT_CWD environment variable but that will be
less useful if you have more than one box going in your kitchen setup.

kitchen destroy
kitchen create
kitchen converge

Is there any way to halt the vm and just bring it back up again without
having to re-provision it?

Usually, kitchen converge is enough for me (don't need the explicit
create). Also for me, on an OS X laptop, I can suspend the laptop and my
vm is ok.

But as described above, I've done vagrant suspend/resume and had that
work.

  • seth

--
Seth Falcon | Development Lead | CHEF | http://www.getchef.com/ | @sfalcon

Hi, thanks for the info Jeff and Seth.

I hadn't thought of of running the commands against the generated vagrant
file, I'll give that a try.

Cheers,
Richard.

On 26 March 2014 18:25, Seth Falcon seth@getchef.com wrote:

Hi there,

Richard Murray rich.j.murray@gmail.com writes:

Is it possible to do the equivalant of a 'vagrant halt' or a 'vagrant up'
using Test Kitchen?

One thing you can do is cd into the directory where kitchen-vagrant
writes the Vagrantfile and run vargant commands. So you can do something
like:

cd .kitchen/kitchen-vagrant/default-ubuntu-1204
vagrant rsync

You can also set the VAGRANT_CWD environment variable but that will be
less useful if you have more than one box going in your kitchen setup.

kitchen destroy
kitchen create
kitchen converge

Is there any way to halt the vm and just bring it back up again without
having to re-provision it?

Usually, kitchen converge is enough for me (don't need the explicit
create). Also for me, on an OS X laptop, I can suspend the laptop and my
vm is ok.

But as described above, I've done vagrant suspend/resume and had that
work.

  • seth

--
Seth Falcon | Development Lead | CHEF | http://www.getchef.com/ | @sfalcon

Richard,

You might be interested in this thread: Add a way to execute arbitrary driver commands · Issue #350 · test-kitchen/test-kitchen · GitHub

Thanks,
Seth

On Mar 27, 2014, at 6:08 AM, Richard Murray rich.j.murray@gmail.com wrote:

Hi, thanks for the info Jeff and Seth.

I hadn't thought of of running the commands against the generated vagrant file, I'll give that a try.

Cheers,
Richard.

On 26 March 2014 18:25, Seth Falcon seth@getchef.com wrote:
Hi there,

Richard Murray rich.j.murray@gmail.com writes:

Is it possible to do the equivalant of a 'vagrant halt' or a 'vagrant up'
using Test Kitchen?

One thing you can do is cd into the directory where kitchen-vagrant
writes the Vagrantfile and run vargant commands. So you can do something
like:

cd .kitchen/kitchen-vagrant/default-ubuntu-1204
vagrant rsync

You can also set the VAGRANT_CWD environment variable but that will be
less useful if you have more than one box going in your kitchen setup.

kitchen destroy
kitchen create
kitchen converge

Is there any way to halt the vm and just bring it back up again without
having to re-provision it?

Usually, kitchen converge is enough for me (don't need the explicit
create). Also for me, on an OS X laptop, I can suspend the laptop and my
vm is ok.

But as described above, I've done vagrant suspend/resume and had that
work.

  • seth

--
Seth Falcon | Development Lead | CHEF | http://www.getchef.com/ | @sfalcon