Skip to content

Commit ec60db4

Browse files
committed
adds acceptance tests for postgresql::server::recovery resource
1 parent a994648 commit ec60db4

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

Diff for: spec/acceptance/server/recovery_spec.rb

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'postgresql::server::recovery', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
4+
after(:all) do
5+
pp = <<-EOS.unindent
6+
file { '/tmp/recovery.conf':
7+
ensure => absent,
8+
}
9+
EOS
10+
11+
apply_manifest(pp, :catch_failures => true)
12+
end
13+
14+
describe 'should manage recovery' do
15+
it 'adds conf file' do
16+
pp = <<-EOS.unindent
17+
class { 'postgresql::globals':
18+
recovery_conf_path => '/tmp/recovery.conf',
19+
manage_recovery_conf => true,
20+
}
21+
22+
class { 'postgresql::server': }
23+
24+
# Create a recovery.conf file
25+
postgresql::server::recovery { "recovery.conf":
26+
restore_command => 'restore_command',
27+
recovery_target_timeline => 'recovery_target_timeline',
28+
}
29+
EOS
30+
31+
apply_manifest(pp, :catch_failures => true)
32+
apply_manifest(pp, :catch_changes => true)
33+
end
34+
35+
describe file('/tmp/recovery.conf') do
36+
it { is_expected.to be_file }
37+
it { is_expected.to contain /restore_command = 'restore_command'/ }
38+
it { is_expected.to contain /recovery_target_timeline = 'recovery_target_timeline'/ }
39+
end
40+
end
41+
42+
describe 'should not manage recovery' do
43+
it 'does not add conf file' do
44+
pp = <<-EOS.unindent
45+
class { 'postgresql::globals':
46+
manage_recovery_conf => false,
47+
}
48+
49+
class { 'postgresql::server': }
50+
EOS
51+
52+
apply_manifest(pp, :catch_failures => true)
53+
apply_manifest(pp, :catch_changes => true)
54+
end
55+
56+
describe file('/tmp/recovery.conf') do
57+
it { is_expected.not_to be_file }
58+
end
59+
end
60+
end
61+

0 commit comments

Comments
 (0)