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.
Depending on the provider you are using - yes.
First, there are a few lifecycle steps:
kitchen create
- this will create the instance. It's the equivalent ofvagrant up --no-provision
.kitchen converge
- this will converge (provision) the instance. It's the equivalent ofvagrant provision
.kitchen verify
- this will run any post-integration tests (like ServerSpec or bats). There is no equivalent in vagrant.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.
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
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.
© 2022 - 2024 — McMap. All rights reserved.