chef-infra - 厨房测试如何使用本地vm.box

标签 chef-infra test-kitchen

每次运行

kitchen test

它会下载一个新的虚拟机盒。有没有办法让它重新使用本地下载的盒子?

这是我的 .kitchen.yml 文件。

---
driver_plugin: vagrant
driver_config:
  require_chef_omnibus: true

platforms:
  - name: ubuntu-12.04

suites:
  - name: default
    run_list:
      - recipe[my-rails-server::default]
    attributes:

终端输出:

Downloading Chef  for ubuntu...       
downloading https://www.opscode.com/chef/metadata?v=&prerelease=false&p=ubuntu&pv=12.04&m=x86_64       
to file /tmp/install.sh.1121/metadata.txt       
trying wget...       
url https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.10.0-1.ubuntu.12.04_amd64.deb       
md5 21524287ed5631eb1c092ba7b589e968       
sha256  7a0a898b3682462620de80230c7a73730dde7131ca069e1d926f6faf07e4fa2f       
downloaded metadata file looks valid...       
downloading https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_11.10.0-1.ubuntu.12.04_amd64.deb       
to file /tmp/install.sh.1121/chef_11.10.0-1.ubuntu.12.04_amd64.deb       
trying wget...       
Checksum compare with sha256sum succeeded.       
Installing Chef        

最佳答案

Test Kitchen 根据 .kitchen.yml 配置创建自己的 Vagrantfile。

因此,您必须在 .kitchen.yml 中指定您的盒子(该盒子应该已可用于 Vagrant,请检查 vagrant box list)。在您的示例中,它将是:

platforms:
- name: ubuntu-12.04
  driver:
    box: centos-6.5-x86_64-minimal

厨房将使用 Vagrant 可用的盒子,无需下载。

您还可以指定其他 Vagrant 选项,例如

- name: centos-vagrant
  driver:
    provider: parallels
    box: centos-6.5-x86_64-minimal
    customize:
      memsize: 1024
      cpus: 2

您可以查看更多示例,例如。在我的 Vagrant Recipe 中 lemp-server或或操作码的 yum .

关于chef-infra - 厨房测试如何使用本地vm.box,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21697438/

相关文章:

chef-infra - 在 Chef Recipe 中,如何根据角色分配 erb 模板

cron - Chef - 重复 Recipe 执行

git - Vagrant 测试 Chef Recipe - 但如何处理私有(private) git

chef-infra - ChefSpec 和测试厨房

vagrant - 改变厨房 Vagrant 从哪里下载 Chef

automated-tests - 是否可以在不使用任何驱动程序的情况下对服务器运行厨房测试?

linux - 测试厨房卡在 "creating virtual machine"

chef-infra - 覆盖 Chef bash 返回代码

docker - 厨房-Docker 和 Systemd

php - 为 OpsWorks php 应用程序服务器堆栈设置 upload_max_filesize