Skip to content

Commit fbb5a45

Browse files
test: fix postgresql sensitive /root/.pgpass content
1 parent f34d865 commit fbb5a45

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

spec/classes/database_postgresql_spec.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
end
6363

6464
it { is_expected.to compile.with_all_deps }
65-
it { is_expected.to contain_exec('update_pgpass').with_command('echo node01.example.com:5432:zabbix-server:zabbix-server:zabbix-server >> /root/.pgpass') }
65+
it { is_expected.to contain_exec('update_pgpass').with_command(sensitive('echo node01.example.com:5432:zabbix-server:zabbix-server:zabbix-server >> /root/.pgpass')) }
6666
it { is_expected.to contain_exec('zabbix_server_create.sql').with_command("cd #{path} && if [ -f #{sql_server}.gz ]; then gunzip -f #{sql_server}.gz ; fi && psql -h 'node01.example.com' -U 'zabbix-server' -p 5432 -d 'zabbix-server' -f #{sql_server} && touch /etc/zabbix/.schema.done") }
6767
it { is_expected.to contain_exec('zabbix_server_images.sql').with_command('touch /etc/zabbix/.images.done') }
6868
it { is_expected.to contain_exec('zabbix_server_data.sql').with_command('touch /etc/zabbix/.data.done') }
@@ -83,7 +83,7 @@
8383
end
8484

8585
it { is_expected.to compile.with_all_deps }
86-
it { is_expected.to contain_exec('update_pgpass').with_command('echo node01.example.com:5432:zabbix-server:zabbix-server:zabbix-server >> /root/.pgpass') }
86+
it { is_expected.to contain_exec('update_pgpass').with_command(sensitive('echo node01.example.com:5432:zabbix-server:zabbix-server:zabbix-server >> /root/.pgpass')) }
8787
it { is_expected.to contain_exec('zabbix_server_create.sql').with_command("cd #{path} && if [ -f #{sql_server}.gz ]; then gunzip -f #{sql_server}.gz ; fi && psql -h 'node01.example.com' -U 'zabbix-server' -p 5432 -d 'zabbix-server' -f #{sql_server} && touch /etc/zabbix/.schema.done") }
8888
it { is_expected.to contain_exec('zabbix_server_images.sql').with_command('touch /etc/zabbix/.images.done') }
8989
it { is_expected.to contain_exec('zabbix_server_data.sql').with_command('touch /etc/zabbix/.data.done') }
@@ -105,7 +105,7 @@
105105
end
106106

107107
it { is_expected.to compile.with_all_deps }
108-
it { is_expected.to contain_exec('update_pgpass').with_command('echo node01.example.com:6432:zabbix-server:zabbix-server:zabbix-server >> /root/.pgpass') }
108+
it { is_expected.to contain_exec('update_pgpass').with_command(sensitive('echo node01.example.com:6432:zabbix-server:zabbix-server:zabbix-server >> /root/.pgpass')) }
109109
it { is_expected.to contain_exec('zabbix_server_create.sql').with_command("cd #{path} && if [ -f #{sql_server}.gz ]; then gunzip -f #{sql_server}.gz ; fi && psql -h 'node01.example.com' -U 'zabbix-server' -p 6432 -d 'zabbix-server' -f #{sql_server} && touch /etc/zabbix/.schema.done") }
110110
it { is_expected.to contain_exec('zabbix_server_images.sql').with_command('touch /etc/zabbix/.images.done') }
111111
it { is_expected.to contain_exec('zabbix_server_data.sql').with_command('touch /etc/zabbix/.data.done') }
@@ -127,7 +127,7 @@
127127
end
128128

129129
it { is_expected.to compile.with_all_deps }
130-
it { is_expected.to contain_exec('update_pgpass').with_command('echo node01.example.com:5432:zabbix-proxy:zabbix-proxy:zabbix-proxy >> /root/.pgpass') }
130+
it { is_expected.to contain_exec('update_pgpass').with_command(sensitive('echo node01.example.com:5432:zabbix-proxy:zabbix-proxy:zabbix-proxy >> /root/.pgpass')) }
131131

132132
if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') < 0
133133
it { is_expected.to contain_exec('zabbix_proxy_create.sql').with_command("cd #{path} && if [ -f schema.sql.gz ]; then gunzip -f schema.sql.gz ; fi && psql -h 'node01.example.com' -U 'zabbix-proxy' -p 5432 -d 'zabbix-proxy' -f schema.sql && touch /etc/zabbix/.schema.done") }
@@ -150,7 +150,8 @@
150150
end
151151

152152
it { is_expected.to compile.with_all_deps }
153-
it { is_expected.to contain_exec('update_pgpass').with_command('echo node01.example.com:5432:zabbix-proxy:zabbix-proxy:zabbix-proxy >> /root/.pgpass') }
153+
#it { is_expected.to contain_exec('update_pgpass').with_command('echo node01.example.com:5432:zabbix-proxy:zabbix-proxy:zabbix-proxy >> /root/.pgpass') }
154+
it { is_expected.to contain_exec('update_pgpass').with_command(sensitive('echo node01.example.com:5432:zabbix-proxy:zabbix-proxy:zabbix-proxy >> /root/.pgpass')) }
154155

155156
if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') < 0
156157
it { is_expected.to contain_exec('zabbix_proxy_create.sql').with_command("cd #{path} && if [ -f schema.sql.gz ]; then gunzip -f schema.sql.gz ; fi && psql -h 'node01.example.com' -U 'zabbix-proxy' -p 5432 -d 'zabbix-proxy' -f schema.sql && touch /etc/zabbix/.schema.done") }

0 commit comments

Comments
 (0)