8

在测试厨房中,有没有办法更新创建的实例,而不是每次都销毁和重新创建实例?假设我在 kitchen.yml 中进行了更改并希望看到该更改,运行整个销毁/创建可能需要一段时间。

4

3 回答 3

7

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.

于 2014-06-27T17:22:10.800 回答
0

如果您正在使用 Vagrant,请尝试使用该命令vagrant global-status获取机器 ID,然后使用它重新加载。像这样的东西:

$ 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
于 2015-08-08T15:10:29.173 回答
0

正如 sethvargo 所指出的,kitchen create即使您的实例已经融合,并且 Vagrantfile 将通过对 .kitchen.yml 文件的更改重新创建,您也可以使用。
那么你也能:

cd .kitchen/suite_name && vagrant reload

并且您的 vagrant 实例将反映这些更改。

但请注意,在某些情况下,当您重新加载实例时,ssh 端口号可能会更改。在这种情况下,您可以使用vagrant port这些更改来查看更改并修复 .kitchen/name-of-your-instance.yml 文件,这样您就可以kitchen login毫无问题地进行操作。

于 2017-01-12T01:22:30.220 回答