Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add acceptance for zabbix::proxy class #933

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }

Check failure on line 26 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - CentOS 7 - Zabbix 6.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 26 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - CentOS 7 - Zabbix 6.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 26 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - OracleLinux 7 - Zabbix 6.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 26 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - OracleLinux 7 - Zabbix 6.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 26 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - CentOS 7 - Zabbix 5.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 26 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - CentOS 7 - Zabbix 5.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 26 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - AlmaLinux 8 - Zabbix 6.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 26 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - OracleLinux 7 - Zabbix 5.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 26 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - OracleLinux 7 - Zabbix 5.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running
it { is_expected.to be_enabled }

Check failure on line 27 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - CentOS 7 - Zabbix 6.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 27 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - CentOS 7 - Zabbix 6.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 27 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - OracleLinux 7 - Zabbix 6.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 27 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - OracleLinux 7 - Zabbix 6.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 27 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - CentOS 7 - Zabbix 5.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 27 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - CentOS 7 - Zabbix 5.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 27 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - OracleLinux 7 - Zabbix 5.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 27 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - OracleLinux 7 - Zabbix 5.0

zabbix::proxy class default parameters Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" 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 }

Check failure on line 50 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - CentOS 7 - Zabbix 6.0

zabbix::proxy class deploys a zabbix 6.0 proxy Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 50 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - CentOS 7 - Zabbix 6.0

zabbix::proxy class deploys a zabbix 6.0 proxy Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 50 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - OracleLinux 7 - Zabbix 6.0

zabbix::proxy class deploys a zabbix 6.0 proxy Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 50 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - OracleLinux 7 - Zabbix 6.0

zabbix::proxy class deploys a zabbix 6.0 proxy Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 50 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - CentOS 7 - Zabbix 5.0

zabbix::proxy class deploys a zabbix 5.0 proxy Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 50 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - CentOS 7 - Zabbix 5.0

zabbix::proxy class deploys a zabbix 5.0 proxy Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 50 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - Rocky 8 - Zabbix 6.0

zabbix::proxy class deploys a zabbix 6.0 proxy Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 50 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - Rocky 8 - Zabbix 5.0

zabbix::proxy class deploys a zabbix 5.0 proxy Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 50 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - OracleLinux 7 - Zabbix 5.0

zabbix::proxy class deploys a zabbix 5.0 proxy Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running

Check failure on line 50 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - OracleLinux 7 - Zabbix 5.0

zabbix::proxy class deploys a zabbix 5.0 proxy Service "zabbix-proxy" is expected to be running Failure/Error: it { is_expected.to be_running } expected Service "zabbix-proxy" to be running
it { is_expected.to be_enabled }

Check failure on line 51 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - CentOS 7 - Zabbix 6.0

zabbix::proxy class deploys a zabbix 6.0 proxy Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 51 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - CentOS 7 - Zabbix 6.0

zabbix::proxy class deploys a zabbix 6.0 proxy Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 51 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - OracleLinux 7 - Zabbix 6.0

zabbix::proxy class deploys a zabbix 6.0 proxy Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 51 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - OracleLinux 7 - Zabbix 6.0

zabbix::proxy class deploys a zabbix 6.0 proxy Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 51 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - CentOS 7 - Zabbix 5.0

zabbix::proxy class deploys a zabbix 5.0 proxy Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 51 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - CentOS 7 - Zabbix 5.0

zabbix::proxy class deploys a zabbix 5.0 proxy Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 51 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 8 - OracleLinux 7 - Zabbix 5.0

zabbix::proxy class deploys a zabbix 5.0 proxy Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" to be enabled

Check failure on line 51 in spec/acceptance/proxy_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Puppet 7 - OracleLinux 7 - Zabbix 5.0

zabbix::proxy class deploys a zabbix 5.0 proxy Service "zabbix-proxy" is expected to be enabled Failure/Error: it { is_expected.to be_enabled } expected Service "zabbix-proxy" 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
Loading