http://www.agiletestingdays.com/session/infrastructure-under-the-magnifying-glass/
Example Project: DilloJs https://github.com/butjar/dillojs
- There are tools like kitchen and rspec to automate the tests for your infrastructure code (on integration level)
- Unit Tests for deployment scripts make sense as well! (As soon as there are conditions & branches)
- Chef Tools for Unit Test
- Foodcritic
- rubocop
- chefspec
- Integration Test Tools
- Kitchen CI http://kitchen.ci/
- Starts a vagrant box, runs provisioning and executes tests
- Busser: test execution framework
- Bats: https://github.com/sstephenson/bats
- ansible plugin https://github.com/neillturner/kitchen-ansible
- ServerSpec
- Run ServerSpec without Kitchen:
- have a look Rakefile in example project
- Kitchen CI http://kitchen.ci/
Bats example:
@test "mongo bla" {
output=$("cmd")
status=$?
test[]
}
Serverspec example
require 'serverspec'
set :backend, :exec # run locally
describe 'ngnix' do
describe service 'ngnix' do
it { expect(subject).to be_running }
it { expect(subject).to be_enabled }
end
describe port 80 do
it { expect(subject).to be_listening }
end
describe file '…' do
let(:content) {subject.content}
it { expect(subject).to exist }
it { expect(subject).to be_file }
it { expect(content).to include('...') }
end
end
describe 'node' do
describe command 'node -v' do
it { expect(subject.stdout).to match(/.../)}
end
end
Ideas:
- run kitchen & ansible in bamboo
- provisioning & admin