|
15 | 15 | facts |
16 | 16 | end |
17 | 17 |
|
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'] |
19 | 25 | when 'Archlinux' |
20 | 26 | context 'with all defaults' do |
21 | 27 | it { is_expected.not_to compile } |
22 | 28 | end |
23 | | - when 'RedHat' |
| 29 | + else |
24 | 30 | let :pre_condition do |
25 | 31 | "include 'postgresql::server' |
26 | 32 | include 'mysql::server'" |
|
47 | 53 | } |
48 | 54 | end |
49 | 55 |
|
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) } |
51 | 57 | 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 |
54 | 66 | end |
55 | 67 |
|
56 | | - describe 'with enabled selinux' do |
| 68 | + describe 'with enabled selinux', if: facts[:os]['family'] == 'RedHat' do |
57 | 69 | let :facts do |
58 | 70 | super().merge(selinux: true) |
59 | 71 | end |
|
106 | 118 | end |
107 | 119 |
|
108 | 120 | 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) } |
110 | 122 | it { is_expected.to contain_class('zabbix::database::postgresql').with_database_name('zabbix_proxy') } |
111 | 123 | it { is_expected.to contain_class('zabbix::database::postgresql').with_database_user('zabbix-proxy') } |
112 | 124 | it { is_expected.to contain_class('zabbix::database::postgresql').with_database_password('zabbix-proxy') } |
|
126 | 138 | end |
127 | 139 |
|
128 | 140 | 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) } |
130 | 142 | it { is_expected.to contain_class('zabbix::database::mysql').with_database_name('zabbix_proxy') } |
131 | 143 | it { is_expected.to contain_class('zabbix::database::mysql').with_database_user('zabbix-proxy') } |
132 | 144 | it { is_expected.to contain_class('zabbix::database::mysql').with_database_password('zabbix-proxy') } |
|
0 commit comments