test-kitchen update instead of create every time
Asked Answered
E

3

8

In test-kitchen, is there a way to update the instance created instead of destroying and recreating the instance every time? Say if I change in kitchen.yml and want to see that change, running the whole destroy/create can take a while.

Elated answered 27/6, 2014 at 16:33 Comment(2)
found some useful info here and hereElated
'kitchen list' to list your Instances, 'kitchen converge <instance name>' where <instance name> is the name of the instance found in 'kitchen list'.Embargo
M
8

Depending on the provider you are using - yes.

First, there are a few lifecycle steps:

  1. kitchen create - this will create the instance. It's the equivalent of vagrant up --no-provision.
  2. kitchen converge - this will converge (provision) the instance. It's the equivalent of vagrant provision.
  3. kitchen verify - this will run any post-integration tests (like ServerSpec or bats). There is no equivalent in vagrant.
  4. kitchen test - wraps the above three commands in a single sequence.

Test Kitchen does not have a notion of vagrant reload, which is what you seem to describe by your example. However, you can accomplish a reload by doing something like:

cd .kitchen/suite_name && vagrant reload

from the command line.

Marlette answered 27/6, 2014 at 17:22 Comment(0)
A
0

If you are using Vagrant, try the command vagrant global-status to get the machine id, then use it to reload. Something like this:

$ vagrant global-status
42c66e1c  default virtualbox poweroff /path/to/your/machine/kitchen-vagrant/webserver-ubuntu-1404 
1c135a2e  default virtualbox running  /path/to/other/machine/.kitchen/kitchen-vagrant/kitchen-machines-webserver-ubuntu-1404
$ vagrant reload 1c135ae --provision
Archle answered 8/8, 2015 at 15:10 Comment(0)
G
0

As pointed by sethvargo you can use kitchen create even if your instance is already converged and the Vagrantfile would be recreated with changes made to your .kitchen.yml file.
Then you can:

cd .kitchen/suite_name && vagrant reload

and your vagrant instance would reflect those changes.

But be aware that in some cases when you reload your instance the ssh port number may change. In this case you can use vagrant port to see the changes and fix your .kitchen/name-of-your-instance.yml file with those changes so you can kitchen login without problems.

Galipot answered 12/1, 2017 at 1:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.