Skip to content

Commit

Permalink
Add acceptance for zabbix::proxy class
Browse files Browse the repository at this point in the history
Set vagrant_libvirt as beaker hypervisor
  • Loading branch information
Valantin authored and Roberto Valentini committed May 6, 2024
1 parent 68b391e commit c7dcd44
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ jobs:
with:
pidfile_workaround: 'false'
beaker_facter: 'zabbix_version:Zabbix:5.0,6.0'
beaker_hypervisor: 'vagrant_libvirt'
55 changes: 55 additions & 0 deletions spec/acceptance/proxy_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'
describe 'zabbix::proxy class', unless: default[:platform] =~ %r{archlinux} do
before(:all) do
prepare_host
end

context 'default parameters' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'zabbix::proxy':
zabbix_server_host => '192.168.1.1',
}
PUPPET
end
end

# do some basic checks
describe package('zabbix-proxy-pgsql') do
it { is_expected.to be_installed }
end

describe service('zabbix-proxy') do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end
end

supported_proxy_versions(default[:platform]).each do |zabbix_version|
context "deploys a zabbix #{zabbix_version} proxy" do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'zabbix::proxy':
zabbix_server_host => '192.168.1.1',
zabbix_version => "#{zabbix_version}",
}
PUPPET
end
end

# do some basic checks
describe package('zabbix-proxy-pgsql') do
it { is_expected.to be_installed }
end

describe service('zabbix-proxy') do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end
end
end
end
8 changes: 4 additions & 4 deletions spec/support/acceptance/prepare_host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ def prepare_host

apply_manifest <<~PUPPET
$services = $facts['os']['family'] ? {
'RedHat' => ['zabbix-server', 'httpd', 'zabbix-agentd', 'zabbix-agent', 'zabbix-agent2'],
'Debian' => ['zabbix-server', 'apache2', 'zabbix-agentd', 'zabbix-agent', 'zabbix-agent2'],
'RedHat' => ['zabbix-server', 'httpd', 'zabbix-agentd', 'zabbix-agent', 'zabbix-agent2', 'zabbix-proxy'],
'Debian' => ['zabbix-server', 'apache2', 'zabbix-agentd', 'zabbix-agent', 'zabbix-agent2', 'zabbix-proxy'],
default => ['zabbix-agentd', 'zabbix-agent', 'zabbix-agent2'],
}
service { $services:
ensure => stopped
}
$packages = $facts['os']['family'] ? {
'RedHat' => ['zabbix-server-pgsql', 'zabbix-server-pgsql-scl', 'zabbix-web', 'zabbix-web-pgsql', 'zabbix-web-pgsql-scl', 'zabbix-frontend-php', 'zabbix-sql-scripts', 'zabbix-agent', 'zabbix-agent2'],
'Debian' => ['zabbix-server-pgsql', 'zabbix-web-pgsql', 'zabbix-frontend-php', 'zabbix-sql-scripts', 'zabbix-agent', 'zabbix-agent2'],
'RedHat' => ['zabbix-server-pgsql', 'zabbix-server-pgsql-scl', 'zabbix-web', 'zabbix-web-pgsql', 'zabbix-web-pgsql-scl', 'zabbix-frontend-php', 'zabbix-sql-scripts', 'zabbix-agent', 'zabbix-agent2', 'zabbix-proxy-pgsql'],
'Debian' => ['zabbix-server-pgsql', 'zabbix-web-pgsql', 'zabbix-frontend-php', 'zabbix-sql-scripts', 'zabbix-agent', 'zabbix-agent2', 'zabbix-proxy-pgsql'],
default => ['zabbix-agent', 'zabbix-agent2'],
}
Expand Down
7 changes: 7 additions & 0 deletions spec/support/acceptance/supported_versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ def supported_server_versions(platform)
(version < '6.0' && platform.start_with?('el-9', 'ubuntu-22', 'debian-12'))
end
end

def supported_proxy_versions(platform)
supported_versions.reject do |version|
platform.start_with?('archlinux', 'el7', 'el8') ||
(version < '6.0' && platform.start_with?('el-9', 'debian-12'))
end
end

0 comments on commit c7dcd44

Please sign in to comment.