99 it { is_expected . to contain_class ( 'postgresql::params' ) }
1010 it { is_expected . to contain_class ( 'postgresql::server' ) }
1111 it { is_expected . to contain_file ( '/var/lib/postgresql/13/main' ) }
12+
1213 it {
1314 is_expected . to contain_exec ( 'postgresql_reload' ) . with ( 'command' => 'systemctl reload postgresql' )
1415 }
16+
1517 it 'validates connection' do
1618 is_expected . to contain_postgresql_conn_validator ( 'validate_service_is_running' )
1719 end
@@ -57,9 +59,11 @@ class { 'postgresql::globals':
5759 it { is_expected . to contain_class ( 'postgresql::params' ) }
5860 it { is_expected . to contain_class ( 'postgresql::server' ) }
5961 it { is_expected . to contain_class ( 'postgresql::server::passwd' ) }
62+
6063 it 'validates connection' do
6164 is_expected . to contain_postgresql_conn_validator ( 'validate_service_is_running' )
6265 end
66+
6367 it 'sets postgres password' do
6468 is_expected . to contain_exec ( 'set_postgres_postgrespw' ) . with ( 'command' => '/usr/bin/psql -c "ALTER ROLE \"postgres\" PASSWORD ${NEWPASSWD_ESCAPED}"' ,
6569 'user' => 'postgres' ,
@@ -79,9 +83,11 @@ class { 'postgresql::globals':
7983 it { is_expected . to contain_class ( 'postgresql::params' ) }
8084 it { is_expected . to contain_class ( 'postgresql::server' ) }
8185 it { is_expected . to contain_class ( 'postgresql::server::passwd' ) }
86+
8287 it 'validates connection' do
8388 is_expected . to contain_postgresql_conn_validator ( 'validate_service_is_running' )
8489 end
90+
8591 it 'sets postgres password' do
8692 is_expected . to contain_exec ( 'set_postgres_postgrespw' ) . with ( 'command' => [ '/usr/bin/psql -c "ALTER ROLE \"postgres\" PASSWORD ${NEWPASSWD_ESCAPED}"' ] ,
8793 'user' => 'postgres' ,
@@ -95,6 +101,7 @@ class { 'postgresql::globals':
95101
96102 it { is_expected . to contain_class ( 'postgresql::params' ) }
97103 it { is_expected . to contain_class ( 'postgresql::server' ) }
104+
98105 it 'shouldnt validate connection' do
99106 is_expected . not_to contain_postgresql_conn_validator ( 'validate_service_is_running' )
100107 end
@@ -105,9 +112,11 @@ class { 'postgresql::globals':
105112
106113 it { is_expected . to contain_class ( 'postgresql::params' ) }
107114 it { is_expected . to contain_class ( 'postgresql::server' ) }
115+
108116 it {
109117 is_expected . not_to contain_Postgresql_conf ( 'data_directory' ) . that_notifies ( 'Class[postgresql::server::service]' )
110118 }
119+
111120 it 'validates connection' do
112121 is_expected . to contain_postgresql_conn_validator ( 'validate_service_is_running' )
113122 end
@@ -118,9 +127,11 @@ class { 'postgresql::globals':
118127
119128 it { is_expected . to contain_class ( 'postgresql::params' ) }
120129 it { is_expected . to contain_class ( 'postgresql::server' ) }
130+
121131 it {
122132 is_expected . to contain_Postgresql_conf ( 'data_directory' ) . that_notifies ( 'Class[postgresql::server::service]' )
123133 }
134+
124135 it 'validates connection' do
125136 is_expected . to contain_postgresql_conn_validator ( 'validate_service_is_running' )
126137 end
@@ -131,9 +142,11 @@ class { 'postgresql::globals':
131142
132143 it { is_expected . to contain_class ( 'postgresql::params' ) }
133144 it { is_expected . to contain_class ( 'postgresql::server' ) }
145+
134146 it {
135147 is_expected . to contain_exec ( 'postgresql_reload' ) . with ( 'command' => '/bin/true' )
136148 }
149+
137150 it 'validates connection' do
138151 is_expected . to contain_postgresql_conn_validator ( 'validate_service_is_running' )
139152 end
@@ -149,6 +162,7 @@ class { 'postgresql::globals':
149162 let ( :params ) { { service_manage : false } }
150163
151164 it { is_expected . not_to contain_service ( 'postgresqld' ) }
165+
152166 it 'shouldnt validate connection' do
153167 is_expected . not_to contain_postgresql_conn_validator ( 'validate_service_is_running' )
154168 end
@@ -247,6 +261,7 @@ class { 'postgresql::globals':
247261 end
248262
249263 it { is_expected . to compile . with_all_deps }
264+
250265 it do
251266 is_expected . to contain_postgresql__server__pg_hba_rule ( 'from_remote_host' )
252267 . with_type ( 'host' )
@@ -283,25 +298,30 @@ class { 'postgresql::globals':
283298
284299 it { is_expected . to contain_class ( 'postgresql::server' ) }
285300 it { is_expected . to contain_class ( 'postgresql::backup::pg_dump' ) }
301+
286302 it {
287303 is_expected . to contain_postgresql__server__role ( 'backupuser' )
288304 . with_superuser ( true )
289305 }
306+
290307 it {
291308 is_expected . to contain_postgresql__server__pg_hba_rule ( 'local access as backup user' )
292309 . with_type ( 'local' )
293310 . with_database ( 'all' )
294311 . with_user ( 'backupuser' )
295312 . with_auth_method ( 'md5' )
296313 }
314+
297315 it {
298316 is_expected . to contain_file ( '/root/.pgpass' )
299317 . with_content ( %r{.*:backupuser:.*} )
300318 }
319+
301320 it {
302321 is_expected . to contain_file ( '/usr/local/sbin/pg_dump.sh' )
303322 . with_content ( %r{.*pg_dumpall \$ _pg_args --file=\$ \{ FILE\} \$ @.*} )
304323 }
324+
305325 it {
306326 is_expected . to contain_cron ( 'pg_dump backup job' )
307327 . with (
0 commit comments