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

Test-Kitchen sync files to remote servers

我一直在本地使用 test-kitchen 和 Vagrant 进行 运行 serverspec 测试,没有遇到任何重大问题。我现在正在使用 test-kitchen 设置我的 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

答案是设置 data_path provisioner 设置。我之前研究过这个,但在测试厨房文档中没有任何地方提到这些文件同步的位置,所以我假设我的设置不正确。

我的 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.