Skip to content

Instantly share code, notes, and snippets.

@angelo-moreira
Forked from maxim/.kitchen.yml
Created December 13, 2016 19:17
Show Gist options
  • Save angelo-moreira/1d030ef3adeec96ef823e1d0df0a9345 to your computer and use it in GitHub Desktop.
Save angelo-moreira/1d030ef3adeec96ef823e1d0df0a9345 to your computer and use it in GitHub Desktop.
A hack to easily launch and test multiple nodes with test kitchen 1.0
# We need each node defined as a separate platform in order to give them different ip addresses on the private network
---
driver_plugin: vagrant
driver_config:
require_chef_omnibus: true
box: opscode-ubuntu-12.04
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
platforms:
- name: app-server
run_list:
- recipe[my-app::app-server]
driver_config:
customize:
memory: 1024
network:
- ['private_network', {ip: '192.168.33.33'}]
- name: db-server
run_list:
- recipe[my-app::db-server]
driver_config:
network:
- ['private_network', {ip: '192.168.33.53'}]
suites:
- name: my-app
run_list: []
encrypted_data_bag_secret_key_path: '<%= "#{Dir.home}/.chef/data_bag_key" %>'
attributes:
# your attributes
#!/usr/bin/env bash
# We place everything under test_src instead of test, and ignore test in github
# Instead of running kitchen verify app we run ./verify app to copy only matching
# tests into test dir before running them.
die() {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "1 argument required, $# provided"
echo 'Preparing matching tests...'
rm -rf test
mkdir -p test/integration/my-app/bats
cp test_src/_base.bats test/integration/my-app/bats
find test_src -iname "*$1*.bats" -exec cp "{}" test/integration/my-app/bats \;
kitchen verify $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment