Skip to content

Commit 2686e33

Browse files
test: custom database port for psql
test: fix custom database port
1 parent 357fa06 commit 2686e33

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

spec/classes/database_postgresql_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,28 @@
9191
it { is_expected.to contain_class('zabbix::params') }
9292
end
9393

94+
describe "when zabbix_type is server and version is #{zabbix_version} and custom port is defined" do
95+
let :params do
96+
{
97+
database_name: 'zabbix-server',
98+
database_user: 'zabbix-server',
99+
database_password: 'zabbix-server',
100+
database_host: 'node01.example.com',
101+
database_port: 6432,
102+
zabbix_type: 'server',
103+
zabbix_version: zabbix_version
104+
}
105+
end
106+
107+
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') }
109+
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") }
110+
it { is_expected.to contain_exec('zabbix_server_images.sql').with_command('touch /etc/zabbix/.images.done') }
111+
it { is_expected.to contain_exec('zabbix_server_data.sql').with_command('touch /etc/zabbix/.data.done') }
112+
it { is_expected.to contain_file('/root/.pgpass') }
113+
it { is_expected.to contain_class('zabbix::params') }
114+
end
115+
94116
describe "when zabbix_type is proxy and version is #{zabbix_version}" do
95117
let :params do
96118
{

0 commit comments

Comments
 (0)