Skip to content

Commit fe04428

Browse files
committed
test zabbix::server on all supported versions, not only default
1 parent f22bc00 commit fe04428

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

spec/acceptance/server_spec.rb

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,55 @@ class { 'postgresql::globals':
4545
it { is_expected.to be_enabled }
4646
end
4747
end
48+
49+
supported_versions.each do |zabbix_version|
50+
# >= 5.2 server packages are not available for RHEL 7
51+
next if zabbix_version >= '5.2' && default[:platform] == 'el-7-x86_64'
52+
53+
context "deploys a zabbix #{zabbix_version} server" do
54+
# Using puppet_apply as a helper
55+
it 'works idempotently with no errors' do
56+
# this is a minimal working example if you've a postgres server
57+
# running on another node. multinode testing with beaker is pain,
58+
# so we will deploy multiple services into one box
59+
# pp = <<-EOS
60+
# class { 'zabbix::server':
61+
# manage_database => false,
62+
# }
63+
# EOS
64+
65+
# this will actually deploy apache + postgres + zabbix-server + zabbix-web
66+
pp = <<-EOS
67+
class { 'postgresql::globals':
68+
encoding => 'UTF-8',
69+
locale => 'en_US.UTF-8',
70+
manage_package_repo => $facts['os']['release']['major'] != '8',
71+
manage_dnf_module => $facts['os']['release']['major'] == '8',
72+
version => '12',
73+
}
74+
-> class { 'postgresql::server': }
75+
-> class { 'zabbix::database': }
76+
-> class { 'zabbix::server':
77+
zabbix_version => "#{zabbix_version}"
78+
}
79+
EOS
80+
81+
prepare_host
82+
83+
# Run it twice and test for idempotency
84+
apply_manifest(pp, catch_failures: true)
85+
apply_manifest(pp, catch_changes: true)
86+
end
87+
88+
# do some basic checks
89+
describe package('zabbix-server-pgsql') do
90+
it { is_expected.to be_installed }
91+
end
92+
93+
describe service('zabbix-server') do
94+
it { is_expected.to be_running }
95+
it { is_expected.to be_enabled }
96+
end
97+
end
98+
end
4899
end

0 commit comments

Comments
 (0)