Skip to content

Commit cb55e07

Browse files
authored
Merge pull request #896 from voxpupuli/test-proxy-everywhere
execute zabbix::proxy tests everywhere
2 parents 1f78fee + bbb8d15 commit cb55e07

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

spec/classes/proxy_spec.rb

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@
1515
facts
1616
end
1717

18-
case facts[:os]['name']
18+
zabbix_version = if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
19+
'5.0'
20+
else
21+
'6.0'
22+
end
23+
24+
case facts[:os]['family']
1925
when 'Archlinux'
2026
context 'with all defaults' do
2127
it { is_expected.not_to compile }
2228
end
23-
when 'RedHat'
29+
else
2430
let :pre_condition do
2531
"include 'postgresql::server'
2632
include 'mysql::server'"
@@ -47,13 +53,19 @@
4753
}
4854
end
4955

50-
it { is_expected.to contain_class('zabbix::repo').with_zabbix_version('6.0') }
56+
it { is_expected.to contain_class('zabbix::repo').with_zabbix_version(zabbix_version) }
5157
it { is_expected.to contain_package('zabbix-proxy-pgsql').with_require('Class[Zabbix::Repo]') }
52-
it { is_expected.to contain_yumrepo('zabbix-nonsupported') }
53-
it { is_expected.to contain_yumrepo('zabbix') }
58+
59+
case facts[:os]['family']
60+
when 'RedHat'
61+
it { is_expected.to contain_yumrepo('zabbix-nonsupported') }
62+
it { is_expected.to contain_yumrepo('zabbix') }
63+
when 'Debian'
64+
it { is_expected.to contain_apt__source('zabbix') }
65+
end
5466
end
5567

56-
describe 'with enabled selinux' do
68+
describe 'with enabled selinux', if: facts[:os]['family'] == 'RedHat' do
5769
let :facts do
5870
super().merge(selinux: true)
5971
end
@@ -106,7 +118,7 @@
106118
end
107119

108120
it { is_expected.to contain_class('zabbix::database::postgresql').with_zabbix_type('proxy') }
109-
it { is_expected.to contain_class('zabbix::database::postgresql').with_zabbix_version('6.0') }
121+
it { is_expected.to contain_class('zabbix::database::postgresql').with_zabbix_version(zabbix_version) }
110122
it { is_expected.to contain_class('zabbix::database::postgresql').with_database_name('zabbix_proxy') }
111123
it { is_expected.to contain_class('zabbix::database::postgresql').with_database_user('zabbix-proxy') }
112124
it { is_expected.to contain_class('zabbix::database::postgresql').with_database_password('zabbix-proxy') }
@@ -126,7 +138,7 @@
126138
end
127139

128140
it { is_expected.to contain_class('zabbix::database::mysql').with_zabbix_type('proxy') }
129-
it { is_expected.to contain_class('zabbix::database::mysql').with_zabbix_version('6.0') }
141+
it { is_expected.to contain_class('zabbix::database::mysql').with_zabbix_version(zabbix_version) }
130142
it { is_expected.to contain_class('zabbix::database::mysql').with_database_name('zabbix_proxy') }
131143
it { is_expected.to contain_class('zabbix::database::mysql').with_database_user('zabbix-proxy') }
132144
it { is_expected.to contain_class('zabbix::database::mysql').with_database_password('zabbix-proxy') }

0 commit comments

Comments
 (0)