From 0cfff31f07431975bcb117d4c83162efb6535c7a Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Wed, 4 Oct 2023 17:53:41 +0200 Subject: [PATCH] test zabbix::server on all supported versions, not only default --- spec/acceptance/server_spec.rb | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/spec/acceptance/server_spec.rb b/spec/acceptance/server_spec.rb index 59594a225..84ed61676 100644 --- a/spec/acceptance/server_spec.rb +++ b/spec/acceptance/server_spec.rb @@ -45,4 +45,57 @@ class { 'postgresql::globals': it { is_expected.to be_enabled } end end + + supported_versions.each do |zabbix_version| + # >= 5.2 server packages are not available for RHEL 7 + next if zabbix_version >= '5.2' && default[:platform] == 'el-7-x86_64' + + context "deploys a zabbix #{zabbix_version} server" do + # Using puppet_apply as a helper + it 'works idempotently with no errors' do + # this is a minimal working example if you've a postgres server + # running on another node. multinode testing with beaker is pain, + # so we will deploy multiple services into one box + # pp = <<-EOS + # class { 'zabbix::server': + # manage_database => false, + # } + # EOS + + # this will actually deploy apache + postgres + zabbix-server + zabbix-web + pp = <<-EOS + class { 'postgresql::globals': + encoding => 'UTF-8', + locale => 'en_US.UTF-8', + manage_package_repo => $facts['os']['release']['major'] != '8', + manage_dnf_module => $facts['os']['release']['major'] == '8', + version => '12', + } + -> class { 'postgresql::server': } + -> class { 'zabbix::database': + zabbix_version => "#{zabbix_version}" + } + -> class { 'zabbix::server': + zabbix_version => "#{zabbix_version}" + } + EOS + + prepare_host + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + # do some basic checks + describe package('zabbix-server-pgsql') do + it { is_expected.to be_installed } + end + + describe service('zabbix-server') do + it { is_expected.to be_running } + it { is_expected.to be_enabled } + end + end + end end