1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-09-20 01:10:35 +00:00
puppet-rsnapshot/spec/acceptance/default_spec.rb
Norbert Varzariu efa6ef8808 add some tests
2017-04-24 19:42:31 +02:00

65 lines
1.9 KiB
Ruby

require 'spec_helper_acceptance'
describe 'rsnapshot' do
context 'with defaults' do
it 'run idempotently' do
pp = <<-EOS
class { 'rsnapshot':
hosts => {
'localhost' => {},
'example.com' => {
backup_defaults => false,
backup => {
'/var/' => './'
}
}
}
}
EOS
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
end
context 'packages installed' do
describe package('rsnapshot') do
it { is_expected.to be_installed }
end
end
context 'files provisioned' do
describe file('/etc/tmpfiles.d/rsnapshot.conf') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'D /var/run/rsnapshot 0755 root root -' }
end
describe file('/var/run/rsnapshot') do
it { should be_directory }
end
describe file('/etc/rsnapshot/localhost.rsnapshot.conf') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'backup' }
end
describe file('/etc/rsnapshot/example.com.rsnapshot.conf') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'backup' }
end
describe file('/etc/rsnapshot.conf') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'localhost' }
its(:content) { is_expected.to match 'example.com' }
end
describe file('/etc/rsnapshot/localhost.rsnapshot.conf') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'backup' }
end
describe file('/etc/cron.d/example_com') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'example.com' }
end
describe cron do
its(:table) { should match /.*\/etc\/rsnapshot\/localhost.rsnapshot.conf daily.*/ }
its(:table) { should match /.*\/etc\/rsnapshot\/example\.com\.rsnapshot\.conf daily.*/ }
end
end
end