Continuous
Infrastructure
Testing
WHOAMI
class daniël {
class {'::work':
company => 'Inuits',
location => 'Rotterdam',
role => 'Open Source Consultant',
contact => 'daniel@inuits.eu',
}
class {'::social':
twitter => '@dpnl87',
github => 'dpnl87',
blog => 'danielpaulus.com',
}
}
THE PROBLEM
Ever worked on external
managed infrastructure?
“The application stopped
working all of a sudden”
“We didn't
change anything!”
How can we validate external
managed systems?
SERVERSPEC
Test servers actual state
through SSH access
require 'spec_helper'
describe '<name of the resource>' do
# your tests ...
end
describe user 'daniel' do
it { should exist }
it { should belong_to_group 'sudo' }
it { should have_home '/home/daniel' }
end
describe package 'ntp' do
it { should be_installed }
end
describe package 'chef' do
it { should be_installed.by('gem') }
end
describe service 'ssh' do
it { should be_enabled }
end
describe process 'sshd' do
it { should be_running }
end
describe file '/etc/ssh/sshd_config' do
its(:content) {
should match
/^PermitEmptyPasswordsW+no$/
}
end
describe file '~/.ssh/' do
it { should be_directory }
it { should be_mode 700 }
end
describe file '~/.ssh/authorized_keys' do
it { should be_file }
it { should be_mode 600 }
it { should contain('daniel@inuits') }
it { should be_owned_by 'daniel' }
end
-> % rake spec
.........
Finished in 2.55 seconds
9 examples, 0 failures
AUTOMATE THE TESTS
Show your <3 to Jenkins
DEMO

Continuous infrastructure testing