3 describe 'postgresql::server::config', :type => :class do
4 let (:pre_condition) do
5 "include postgresql::server"
8 describe 'on RedHat 7' do
11 :osfamily => 'RedHat',
12 :operatingsystem => 'CentOS',
13 :operatingsystemrelease => '7.0',
14 :concat_basedir => tmpfilename('server'),
17 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
21 it 'should have the correct systemd-override file' do
22 is_expected.to contain_file('systemd-override').with ({
24 :path => '/etc/systemd/system/postgresql.service',
28 is_expected.to contain_file('systemd-override') \
29 .with_content(/.include \/usr\/lib\/systemd\/system\/postgresql.service/)
32 describe 'with manage_package_repo => true and a version' do
33 let (:pre_condition) do
35 class { 'postgresql::globals':
36 manage_package_repo => true,
39 class { 'postgresql::server': }
43 it 'should have the correct systemd-override file' do
44 is_expected.to contain_file('systemd-override').with ({
46 :path => '/etc/systemd/system/postgresql-9.4.service',
50 is_expected.to contain_file('systemd-override') \
51 .with_content(/.include \/usr\/lib\/systemd\/system\/postgresql-9.4.service/)
56 describe 'on Fedora 21' do
59 :osfamily => 'RedHat',
60 :operatingsystem => 'Fedora',
61 :operatingsystemrelease => '21',
62 :concat_basedir => tmpfilename('server'),
65 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
69 it 'should have the correct systemd-override file' do
70 is_expected.to contain_file('systemd-override').with ({
72 :path => '/etc/systemd/system/postgresql.service',
76 is_expected.to contain_file('systemd-override') \
77 .with_content(/.include \/lib\/systemd\/system\/postgresql.service/)
80 describe 'with manage_package_repo => true and a version' do
81 let (:pre_condition) do
83 class { 'postgresql::globals':
84 manage_package_repo => true,
87 class { 'postgresql::server': }
91 it 'should have the correct systemd-override file' do
92 is_expected.to contain_file('systemd-override').with ({
94 :path => '/etc/systemd/system/postgresql-9.4.service',
98 is_expected.to contain_file('systemd-override') \
99 .with_content(/.include \/lib\/systemd\/system\/postgresql-9.4.service/)
104 describe 'on Gentoo' do
105 let (:pre_condition) do
107 class { 'postgresql::globals':
110 class { 'postgresql::server': }
115 :osfamily => 'Gentoo',
116 :operatingsystem => 'Gentoo',
117 :operatingsystemrelease => 'unused',
118 :concat_basedir => tmpfilename('server'),
121 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
125 it 'should have the correct systemd-override file' do
126 is_expected.to contain_file('systemd-override').with ({
127 :ensure => 'present',
128 :path => '/etc/systemd/system/postgresql-9.5.service',
132 is_expected.to contain_file('systemd-override') \
133 .with_content(/.include \/usr\/lib64\/systemd\/system\/postgresql-9.5.service/)
137 describe 'with managed pg_hba_conf and ipv4acls' do
138 let (:pre_condition) do
140 class { 'postgresql::globals':
143 class { 'postgresql::server':
144 manage_pg_hba_conf => true,
146 'hostnossl all all 0.0.0.0/0 reject',
147 'hostssl all all 0.0.0.0/0 md5'
154 :osfamily => 'RedHat',
155 :operatingsystem => 'CentOS',
156 :operatingsystemrelease => '7.0',
157 :concat_basedir => tmpfilename('server'),
160 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
164 it 'should have hba rule default' do
165 is_expected.to contain_postgresql__server__pg_hba_rule('local access as postgres user')
167 it 'should have hba rule ipv4acls' do
168 is_expected.to contain_postgresql__server__pg_hba_rule('postgresql class generated rule ipv4acls 0')