Add supported_versions helper
MODIFY
.sync.yml
.sync.yml
@@ -6,6 +6,7 @@ Gemfile:
- gem: 'zabbixapi'
spec/spec_helper.rb:
mock_with: ':mocha'
+ spec_overrides: "require 'support/acceptance/supported_versions'"
spec/spec_helper_acceptance.rb:
unmanaged: false
.github/workflows/ci.yml:

MODIFY
spec/acceptance/agent_spec.rb
spec/acceptance/agent_spec.rb
require 'spec_helper_acceptance'
-['4.0', '5.0', '5.2'].each do |version|
+supported_versions.each do |version|
describe "zabbix::agent class with zabbix_version #{version}" do
it 'works idempotently with no errors' do
pp = <<-EOS

MODIFY
spec/acceptance/server_spec.rb
spec/acceptance/server_spec.rb
require 'spec_helper_acceptance'
-
describe 'zabbix::server class' do
context 'default parameters' do
# Using puppet_apply as a helper

MODIFY
spec/acceptance/zabbix_application_spec.rb
spec/acceptance/zabbix_application_spec.rb
require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
+
describe 'zabbix_application type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9)-amd64} do
- %w[4.0 5.0 5.2].each do |zabbix_version|
+ 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'
# Application API was removed in Zabbix 5.4

MODIFY
spec/acceptance/zabbix_host_spec.rb
spec/acceptance/zabbix_host_spec.rb
@@ -3,7 +3,7 @@ require 'serverspec_type_zabbixapi'
# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_host type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9)-amd64} do
- %w[4.0 5.0 5.2].each do |zabbix_version|
+ 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 "create zabbix_host resources with zabbix version #{zabbix_version}" do

MODIFY
spec/acceptance/zabbix_hostgroup_spec.rb
spec/acceptance/zabbix_hostgroup_spec.rb
require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
+
describe 'zabbix_hostgroup type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9)-amd64} do
- %w[4.0 5.0 5.2].each do |zabbix_version|
+ 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 "create zabbix_hostgroup resources with zabbix version #{zabbix_version}" do

MODIFY
spec/acceptance/zabbix_proxy_spec.rb
spec/acceptance/zabbix_proxy_spec.rb
@@ -3,7 +3,7 @@ require 'serverspec_type_zabbixapi'
# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_proxy type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9)-amd64} do
- %w[4.0 5.0 5.2].each do |zabbix_version|
+ 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 "create zabbix_proxy resources with zabbix version #{zabbix_version}" do

MODIFY
spec/acceptance/zabbix_template_host_spec.rb
spec/acceptance/zabbix_template_host_spec.rb
require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
+
describe 'zabbix_template_host type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9)-amd64} do
- %w[4.0 5.0 5.2].each do |zabbix_version|
+ 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 "create zabbix_template_host resources with zabbix version #{zabbix_version}" do

MODIFY
spec/acceptance/zabbix_template_spec.rb
spec/acceptance/zabbix_template_spec.rb
require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
+
describe 'zabbix_template type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9)-amd64} do
- %w[4.0 5.0 5.2].each do |zabbix_version|
+ 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 "create zabbix_template resources with zabbix version #{zabbix_version}" do

MODIFY
spec/classes/database_mysql_spec.rb
spec/classes/database_mysql_spec.rb
@@ -24,7 +24,7 @@ describe 'zabbix::database::mysql' do
# path to sql files on zabbix 3.X on Debian and RedHat
path = '/usr/share/doc/zabbix-*-mysql*'
- %w[4.0 5.0 5.2].each do |zabbix_version|
+ supported_versions.each do |zabbix_version|
context "when zabbix_type is server and zabbix version is #{zabbix_version}" do
describe 'and database_port is defined' do
let :params do

MODIFY
spec/classes/web_spec.rb
spec/classes/web_spec.rb
@@ -13,7 +13,7 @@ describe 'zabbix::web' do
end
on_supported_os.each do |os, facts|
- %w[4.0 5.0].each do |zabbix_version|
+ supported_versions.each do |zabbix_version|
next if facts[:os]['name'] == 'windows'
next if facts[:os]['name'] == 'Archlinux'
next if facts[:os]['name'] == 'Gentoo'

MODIFY
spec/spec_helper.rb
spec/spec_helper.rb
@@ -20,3 +20,5 @@ if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
end
end
end
+
+require 'support/acceptance/supported_versions'

ADD
spec/support/acceptance/supported_versions.rb
+def supported_versions
+ %w[4.0 5.0 5.2 5.4]
+end

Add supported_versions helper

Signed-off-by: Christos Papageorgiou <root.expert.xda@gmail.com>