Skip to content

Commit

Permalink
execute zabbix::proxy tests everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Oct 5, 2023
1 parent af49dd8 commit bbb8d15
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions spec/classes/proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@
facts
end

case facts[:os]['name']
zabbix_version = if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
'5.0'
else
'6.0'
end

case facts[:os]['family']
when 'Archlinux'
context 'with all defaults' do
it { is_expected.not_to compile }
end
when 'RedHat'
else
let :pre_condition do
"include 'postgresql::server'
include 'mysql::server'"
Expand All @@ -47,13 +53,19 @@
}
end

it { is_expected.to contain_class('zabbix::repo').with_zabbix_version('6.0') }
it { is_expected.to contain_class('zabbix::repo').with_zabbix_version(zabbix_version) }
it { is_expected.to contain_package('zabbix-proxy-pgsql').with_require('Class[Zabbix::Repo]') }
it { is_expected.to contain_yumrepo('zabbix-nonsupported') }
it { is_expected.to contain_yumrepo('zabbix') }

case facts[:os]['family']
when 'RedHat'
it { is_expected.to contain_yumrepo('zabbix-nonsupported') }
it { is_expected.to contain_yumrepo('zabbix') }
when 'Debian'
it { is_expected.to contain_apt__source('zabbix') }
end
end

describe 'with enabled selinux' do
describe 'with enabled selinux', if: facts[:os]['family'] == 'RedHat' do
let :facts do
super().merge(selinux: true)
end
Expand Down Expand Up @@ -106,7 +118,7 @@
end

it { is_expected.to contain_class('zabbix::database::postgresql').with_zabbix_type('proxy') }
it { is_expected.to contain_class('zabbix::database::postgresql').with_zabbix_version('6.0') }
it { is_expected.to contain_class('zabbix::database::postgresql').with_zabbix_version(zabbix_version) }
it { is_expected.to contain_class('zabbix::database::postgresql').with_database_name('zabbix_proxy') }
it { is_expected.to contain_class('zabbix::database::postgresql').with_database_user('zabbix-proxy') }
it { is_expected.to contain_class('zabbix::database::postgresql').with_database_password('zabbix-proxy') }
Expand All @@ -126,7 +138,7 @@
end

it { is_expected.to contain_class('zabbix::database::mysql').with_zabbix_type('proxy') }
it { is_expected.to contain_class('zabbix::database::mysql').with_zabbix_version('6.0') }
it { is_expected.to contain_class('zabbix::database::mysql').with_zabbix_version(zabbix_version) }
it { is_expected.to contain_class('zabbix::database::mysql').with_database_name('zabbix_proxy') }
it { is_expected.to contain_class('zabbix::database::mysql').with_database_user('zabbix-proxy') }
it { is_expected.to contain_class('zabbix::database::mysql').with_database_password('zabbix-proxy') }
Expand Down

0 comments on commit bbb8d15

Please sign in to comment.