Test-Kitchen将文件同步到远程服务器

时间:2016-06-01 21:31:11

标签: test-kitchen

我一直在本地使用测试厨房和Vagrant运行serverspec测试并且没有任何重大问题。我现在正在使用测试厨房设置我的CI流程,并使用kitchen-google Gem来配置服务器并运行我的serverspec测试套件。

我在我的GCE项目中正确地创建了测试厨房,但是我的测试失败了,因为一些必要的文件没有同步到远程服务器。理想情况下,我想将多个文件夹同步到远程计算机的主目录。有点像:

"./scripts", "/home/test/"
"./scripts2, "/home/test/"

我的.kitchen.gce.yml文件如下,如何指示我要将哪些文件同步到远程计算机?

---
driver:
  name: gce
  project: test-project
  email: email@test-project.iam.gserviceaccount.com
  machine_type: f1-micro
  service_account_name: email@test-project.iam.gserviceaccount.com
  tags:
    - test-kitchen
  service_account_scopes:
    - https://www.googleapis.com/auth/compute # Full control access to Google Compute Engine methods.
  zone: us-central1-a

provisioner:
  name: chef_zero
  require_chef_omnibus: <%= ENV['CHEF_VERSION'] || '12.10.24' %>

transport:
  name: sftp
  username: test
  ssh_key:
    - ~/.ssh/test-key

platforms:
  - name: centos-6
    driver:
      image_name: centos-6-v20160526
  - name: ubuntu-1404
    driver:
      image_name: ubuntu-1404-trusty-v20160516

verifier:
  busser:
    sudo: true

suites:
  - name: default

1 个答案:

答案 0 :(得分:0)

答案是设置data_path配置器设置。我之前已经对此进行了调查,但在测试厨房文档中没有提到这些文件同步的地方,所以我认为我的设置不正确。

我的kitchen.yml文件现在看起来像:

provisioner:
  data_path: "." # Syncs files in path to /tmp/kitchen/data
  name: chef_zero
  require_chef_omnibus: <%= ENV['CHEF_VERSION'] || '12.10.24' %>

以上将当前目录中的所有文件同步到/tmp/kitchen/data

相关问题