RSpec tests for your provisioned servers
Add this line to your application's Gemfile:
gem 'serverspec'
And then execute:
$ bundle
Or install it yourself as:
$ gem install serverspec
$ serverspec-init
+ spec/
+ spec/www.example.jp/
+ spec/spec_helper.rb
+ Rakefile
+ spec/www.example.jp/httpd_spec.rb
spec/www.example.jp/httpd_spec.rb is a sample spec file and its content is like this.
require 'spec_helper'
describe 'httpd' do
it { should be_installed }
it { should be_enabled }
it { should be_running }
end
describe 'port 80' do
it { should be_listening }
end
describe '/etc/httpd/conf/httpd.conf' do
it { should be_file }
it { should contain "ServerName www.example.jp" }
end
You can write spec for testing provisioned servers like this.
You should create ~/.ssh/config like this before running tests.
Host *.example.jp
User root
IdentityFile ~/.ssh/id_rsa
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request