vagrant
foodcritic
rubocop
berkshelf
should_not
chefspec
test-kitchen
kitchen-vagrant
guard
guard-foodcritic
guard-rubocop
guard-rspec
guard-kitchen
More info at Guard Readme.
You must have VirtualBox and Vagrant installed.
You can install gem dependencies with bundler:
$ gem install bundler
$ bundle install
$ bundle exec rake style
$ bundle exec rake unit
$ bundle exec rake integration
Or:
$ bundle exec kitchen list
$ bundle exec kitchen test
[...]
kitchen-vagrant
kitchen-digitalocean
kitchen-ec2
You can run the tests in the cloud instead of using vagrant. First, you must set the following environment variables:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_KEYPAIR_NAME
: EC2 SSH public key name. This is the name used in Amazon EC2 Console's Key Pars section.EC2_SSH_KEY_PATH
: EC2 SSH private key local full path. Only when you are not using an SSH Agent.DIGITALOCEAN_ACCESS_TOKEN
DIGITALOCEAN_SSH_KEY_IDS
: DigitalOcean SSH numeric key IDs.DIGITALOCEAN_SSH_KEY_PATH
: DigitalOcean SSH private key local full path. Only when you are not using an SSH Agent.
Then, you must configure test-kitchen to use .kitchen.cloud.yml
configuration file:
$ export KITCHEN_LOCAL_YAML=".kitchen.cloud.yml"
$ bundle exec kitchen list
[...]
You need to set the following environment variables:
AMAZON_SES_EMAIL_FROM
: SES valid from address, only used in tests.AMAZON_SES_SMTP_USERNAME
: See Obtaining Your Amazon SES SMTP Credentials documentation.AMAZON_SES_SMTP_PASSWORD
AMAZON_SES_REGION
: Amazon SES region (optional).
Then, you must configure test-kitchen to use .kitchen.ses.yml configuration file:
$ export AMAZON_SES_EMAIL_FROM="no-reply@sesdomain.com"
$ export AMAZON_SES_SMTP_USERNAME="..."
$ export AMAZON_SES_SMTP_PASSWORD="..."
$ export AMAZON_SES_REGION="..."
$ export KITCHEN_LOCAL_YAML=".kitchen.ses.yml"
$ bundle exec kitchen list
[...]
- ChefDK: https://downloads.chef.io/chef-dk/
- Berkhelf and Omnibus vagrant plugins:
$ vagrant plugin install vagrant-berkshelf vagrant-omnibus
- The path correctly set for ChefDK:
$ export PATH="/opt/chefdk/bin:${PATH}"
$ vagrant up
To run Chef again on the same machine:
$ vagrant provision
To destroy the machine:
$ vagrant destroy