X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fpostgresql%2Fspec%2Facceptance%2Fserver%2Frecovery_spec.rb;fp=3rdparty%2Fmodules%2Fpostgresql%2Fspec%2Facceptance%2Fserver%2Frecovery_spec.rb;h=b27a5c5afb4fa939f0e8fbfb4d0f87a6b26eeb12;hb=a69999e580f8b3abd12446c2d6ad59e517651813;hp=0000000000000000000000000000000000000000;hpb=e7b6b352165009c385c52fcfe5a1055690dbfa4b;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/postgresql/spec/acceptance/server/recovery_spec.rb b/3rdparty/modules/postgresql/spec/acceptance/server/recovery_spec.rb new file mode 100644 index 000000000..b27a5c5af --- /dev/null +++ b/3rdparty/modules/postgresql/spec/acceptance/server/recovery_spec.rb @@ -0,0 +1,61 @@ +require 'spec_helper_acceptance' + +describe 'postgresql::server::recovery', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do + describe 'should manage recovery' do + after(:all) do + pp = <<-EOS.unindent + file { '/tmp/recovery.conf': + ensure => absent, + } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + it 'adds conf file' do + pp = <<-EOS.unindent + class { 'postgresql::globals': + recovery_conf_path => '/tmp/recovery.conf', + manage_recovery_conf => true, + } + + class { 'postgresql::server': } + + # Create a recovery.conf file + postgresql::server::recovery { "recovery.conf": + restore_command => 'restore_command', + recovery_target_timeline => 'recovery_target_timeline', + } + EOS + + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + describe file('/tmp/recovery.conf') do + it { is_expected.to be_file } + it { is_expected.to contain /restore_command = 'restore_command'/ } + it { is_expected.to contain /recovery_target_timeline = 'recovery_target_timeline'/ } + end + end + + describe 'should not manage recovery' do + it 'does not add conf file' do + pp = <<-EOS.unindent + class { 'postgresql::globals': + manage_recovery_conf => false, + } + + class { 'postgresql::server': } + EOS + + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + describe file('/tmp/recovery.conf') do + it { is_expected.not_to be_file } + end + end +end +