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

64 lines
1.8 KiB
Ruby
Raw Normal View History

2017-04-19 20:51:06 +00:00
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
2017-04-24 18:46:04 +00:00
describe file('/etc/tmpfiles.d') do
it { should be_directory }
end
2017-04-24 17:25:16 +00:00
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
2017-04-24 17:42:31 +00:00
describe file('/var/run/rsnapshot') do
it { should be_directory }
end
2017-04-19 20:51:06 +00:00
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 }
2017-04-24 17:57:24 +00:00
its(:content) { is_expected.to match 'backup\troot@example.com:/var/\t./' }
2017-04-19 20:51:06 +00:00
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
end
end