diff --git a/spec/acceptance/proxy_spec.rb b/spec/acceptance/proxy_spec.rb new file mode 100644 index 00000000..ce35cfd6 --- /dev/null +++ b/spec/acceptance/proxy_spec.rb @@ -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 diff --git a/spec/support/acceptance/prepare_host.rb b/spec/support/acceptance/prepare_host.rb index 6718c3d1..c9430b30 100644 --- a/spec/support/acceptance/prepare_host.rb +++ b/spec/support/acceptance/prepare_host.rb @@ -5,8 +5,8 @@ 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: @@ -14,8 +14,8 @@ def prepare_host } $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'], } diff --git a/spec/support/acceptance/supported_versions.rb b/spec/support/acceptance/supported_versions.rb index e38eed6b..da5c1e2f 100644 --- a/spec/support/acceptance/supported_versions.rb +++ b/spec/support/acceptance/supported_versions.rb @@ -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') || + (version < '6.0' && platform.start_with?('el-9', 'debian-12')) + end +end