Skip to content

Commit

Permalink
Merge branch 'voxpupuli:master' into api_providers
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeferme authored Oct 19, 2022
2 parents 3548c8c + a122643 commit 0e8cada
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 129 deletions.
86 changes: 6 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,86 +7,12 @@ name: CI
on: pull_request

concurrency:
group: ${{ github.head_ref }}
group: ${{ github.ref_name }}
cancel-in-progress: true

jobs:
setup_matrix:
name: 'Setup Test Matrix'
runs-on: ubuntu-latest
timeout-minutes: 40
outputs:
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }}
env:
BUNDLE_WITHOUT: development:system_tests:release
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run static validations
run: bundle exec rake validate lint check
- name: Run rake rubocop
run: bundle exec rake rubocop
- name: Setup Test Matrix
id: get-outputs
run: bundle exec metadata2gha --use-fqdn --pidfile-workaround CentOS,Ubuntu

unit:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}}
env:
BUNDLE_WITHOUT: development:system_tests:release
PUPPET_VERSION: "~> ${{ matrix.puppet }}.0"
name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }})
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake parallel_spec

acceptance:
needs: setup_matrix
runs-on: ubuntu-latest
env:
LANG: en_US
LC_ALL: en_US.UTF-8
BUNDLE_WITHOUT: development:test:release
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run tests
run: bundle exec rake beaker
env:
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }}

tests:
needs:
- unit
- acceptance
runs-on: ubuntu-latest
name: Test suite
steps:
- run: echo Test suite completed
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
with:
pidfile_workaround: 'CentOS,Ubuntu'
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '5.2.0'
modulesync_config_version: '5.3.0'
3 changes: 1 addition & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
inherit_from: .rubocop_todo.yml

# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

inherit_from: .rubocop_todo.yml
inherit_gem:
voxpupuli-test: rubocop.yml
2 changes: 0 additions & 2 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ spec/spec_helper.rb:
spec_overrides:
- "require 'support/acceptance/supported_versions'"
- "require 'spec_helper_methods'"
spec/spec_helper_acceptance.rb:
unmanaged: false
.github/workflows/ci.yml:
pidfile_workaround: CentOS,Ubuntu
.puppet-lint.rc:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :test do
gem 'voxpupuli-test', '~> 5.0', :require => false
gem 'voxpupuli-test', '~> 5.4', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 1.0', :require => false
Expand Down
18 changes: 18 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,8 @@ The following parameters are available in the `zabbix::proxy` class:
* [`database_password`](#database_password)
* [`database_socket`](#database_socket)
* [`database_port`](#database_port)
* [`database_charset`](#database_collate)
* [`database_collate`](#database_collate)
* [`database_tlsconnect`](#database_tlsconnect)
* [`database_tlscafile`](#database_tlscafile)
* [`database_tlscertfile`](#database_tlscertfile)
Expand Down Expand Up @@ -2874,6 +2876,22 @@ Database port when not using local socket. Ignored for sqlite.

Default value: `$zabbix::params::proxy_database_port`

##### <a name="database_charset"></a>`database_charset`

Data type: `Any`

The default charset of the database.

Default value: `$zabbix::params::server_database_charset`

##### <a name="database_collate"></a>`database_collate`

Data type: `Any`

The default collation of the database.

Default value: `$zabbix::params::server_database_collate`

##### <a name="database_tlsconnect"></a>`database_tlsconnect`

Data type: `Optional[Enum['required', 'verify_ca', 'verify_full']]`
Expand Down
6 changes: 6 additions & 0 deletions manifests/proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
# @param database_password Database password. ignored for sqlite.
# @param database_socket Path to mysql socket.
# @param database_port Database port when not using local socket. Ignored for sqlite.
# @param database_charset The default charset of the database.
# @param database_collate The default collation of the database.
# @param database_tlsconnect
# Available options:
# * required - connect using TLS
Expand Down Expand Up @@ -220,6 +222,8 @@
$database_password = $zabbix::params::proxy_database_password,
$database_socket = $zabbix::params::proxy_database_socket,
$database_port = $zabbix::params::proxy_database_port,
$database_charset = $zabbix::params::server_database_charset,
$database_collate = $zabbix::params::server_database_collate,
Optional[Enum['required', 'verify_ca', 'verify_full']] $database_tlsconnect = $zabbix::params::proxy_database_tlsconnect,
Optional[Stdlib::Absolutepath] $database_tlscafile = $zabbix::params::proxy_database_tlscafile,
Optional[Stdlib::Absolutepath] $database_tlscertfile = $zabbix::params::proxy_database_tlscertfile,
Expand Down Expand Up @@ -487,6 +491,8 @@
database_user => $database_user,
database_password => $database_password,
database_host => $database_host,
database_charset => $database_charset,
database_collate => $database_collate,
zabbix_proxy => $zabbix_proxy,
zabbix_proxy_ip => $zabbix_proxy_ip,
before => $before_database,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 6.1.0 < 8.0.0"
"version_requirement": ">= 7.0.0 < 8.0.0"
}
],
"operatingsystem_support": [
Expand Down
12 changes: 2 additions & 10 deletions spec/classes/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@

on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os}" do
systemd_fact = case facts[:osfamily]
when 'Archlinux', 'Fedora', 'Gentoo'
{ systemd: true }
else
{ systemd: false }
end
config_path = case facts[:operatingsystem]
when 'Fedora'
'/etc/zabbix_agentd.conf'
Expand All @@ -45,9 +39,7 @@
end
zabbix_version = '5.0'

let :facts do
facts.merge(systemd_fact)
end
let(:facts) { facts }

case facts[:osfamily]
when 'Gentoo'
Expand Down Expand Up @@ -221,7 +213,7 @@
context 'it creates a startup script' do
if facts[:kernel] == 'Linux'
case facts[:osfamily]
when 'Archlinux', 'Fedora', 'Gentoo'
when 'Archlinux', 'Debian', 'Gentoo', 'RedHat'
it { is_expected.to contain_file("/etc/init.d/#{service_name}").with_ensure('absent') }
it { is_expected.to contain_file("/etc/systemd/system/#{service_name}.service").with_ensure('file') }
when 'windows'
Expand Down
12 changes: 2 additions & 10 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@
next if facts[:os]['name'] == 'windows'

context "on #{os}" do
systemd_fact = case facts[:osfamily]
when 'Archlinux', 'Fedora', 'Gentoo'
{ systemd: true }
else
{ systemd: false }
end
let :facts do
facts.merge(systemd_fact)
end
let(:facts) { facts }

zabbix_version = '5.0'

Expand Down Expand Up @@ -155,7 +147,7 @@

context 'it creates a startup script' do
case facts[:osfamily]
when 'Archlinux', 'Fedora', 'Gentoo'
when 'Archlinux', 'Debian', 'Gentoo', 'RedHat'
it { is_expected.to contain_file('/etc/init.d/zabbix-server').with_ensure('absent') }
it { is_expected.to contain_file('/etc/systemd/system/zabbix-server.service').with_ensure('file') }
else
Expand Down
10 changes: 1 addition & 9 deletions spec/defines/userparameters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@
next if facts[:os]['name'] == 'windows'

context "on #{os}" do
let :facts do
systemd_fact = case facts[:os]['family']
when 'Archlinux', 'Fedora', 'Gentoo'
{ systemd: true }
else
{ systemd: false }
end
facts.merge(systemd_fact)
end
let(:facts) { facts }
let(:title) { 'mysqld' }
let(:pre_condition) { 'class { "zabbix::agent": include_dir => "/etc/zabbix/zabbix_agentd.d" }' }

Expand Down
6 changes: 0 additions & 6 deletions spec/setup_acceptance_node.pp

This file was deleted.

2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

require 'voxpupuli/test/spec_helper'

add_mocked_facts!

if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml')))
facts&.each do |name, value|
Expand Down
10 changes: 6 additions & 4 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# frozen_string_literal: true

# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

require 'voxpupuli/acceptance/spec_helper_acceptance'

configure_beaker
configure_beaker do |host|
# In Puppet 7 the locale ends up being C.UTF-8 if it isn't passed.
# This locale doesn't exist in EL7 and won't be supported either.
# At least PostgreSQL runs into this.
ENV['LANG'] = 'en_US.UTF-8' if host['hypervisor'] == 'docker' && host['platform'] == 'el-7-x86_64'
end

Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }
7 changes: 4 additions & 3 deletions spec/spec_helper_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ def baseline_os_hash
{
'operatingsystem' => 'Archlinux',
},
{
'operatingsystem' => 'Gentoo',
},
# TODO: Support and tests for Gentoo need to be fixed
# {
# 'operatingsystem' => 'Gentoo',
# },
{
'operatingsystem' => 'windows',
'operatingsystemrelease' => ['2012', '2012 R2', '2016']
Expand Down

0 comments on commit 0e8cada

Please sign in to comment.