Skip to content

Commit 5db0077

Browse files
authored
Merge pull request #968 from Valantin/fix/spec
Remove spec filter and run spec on all supported OS
2 parents 24dabc3 + 56c384a commit 5db0077

17 files changed

+417
-469
lines changed

.sync.yml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ spec/spec_helper.rb:
88
mock_with: ':mocha'
99
spec_overrides:
1010
- "require 'support/acceptance/supported_versions'"
11-
- "require 'spec_helper_methods'"
1211
.puppet-lint.rc:
1312
enabled_lint_checks:
1413
- parameter_documentation

manifests/repo.pp

+1-11
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,9 @@
1818
String[1] $zabbix_version = $zabbix::params::zabbix_version,
1919
) inherits zabbix::params {
2020
if $manage_repo {
21-
case $facts['os']['name'] {
22-
'PSBM': {
23-
$majorrelease = '6'
24-
}
25-
'Amazon': {
26-
$majorrelease = '6'
27-
}
28-
default: {
29-
$majorrelease = $facts['os']['release']['major']
30-
}
31-
}
3221
case $facts['os']['family'] {
3322
'RedHat': {
23+
$majorrelease = $facts['os']['release']['major']
3424
if (versioncmp(fact('os.release.major'), '7') >= 0 and $zabbix_version == '7.0') {
3525
$gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005'
3626
$gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005'

metadata.json

-34
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@
6464
"9"
6565
]
6666
},
67-
{
68-
"operatingsystem": "Amazon",
69-
"operatingsystemrelease": [
70-
"7",
71-
"8"
72-
]
73-
},
7467
{
7568
"operatingsystem": "OracleLinux",
7669
"operatingsystemrelease": [
@@ -79,18 +72,10 @@
7972
"9"
8073
]
8174
},
82-
{
83-
"operatingsystem": "Scientific",
84-
"operatingsystemrelease": [
85-
"7",
86-
"8"
87-
]
88-
},
8975
{
9076
"operatingsystem": "CentOS",
9177
"operatingsystemrelease": [
9278
"7",
93-
"8",
9479
"9"
9580
]
9681
},
@@ -108,19 +93,6 @@
10893
"9"
10994
]
11095
},
111-
{
112-
"operatingsystem": "CloudLinux",
113-
"operatingsystemrelease": [
114-
"7",
115-
"8"
116-
]
117-
},
118-
{
119-
"operatingsystem": "XenServer",
120-
"operatingsystemrelease": [
121-
"6"
122-
]
123-
},
12496
{
12597
"operatingsystem": "Ubuntu",
12698
"operatingsystemrelease": [
@@ -135,12 +107,6 @@
135107
"12"
136108
]
137109
},
138-
{
139-
"operatingsystem": "VirtuozzoLinux",
140-
"operatingsystemrelease": [
141-
"7"
142-
]
143-
},
144110
{
145111
"operatingsystem": "Archlinux"
146112
},

spec/classes/agent_spec.rb

+29-8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
}
1515
end
1616

17-
on_supported_os(baseline_os_hash).each do |os, facts|
17+
on_supported_os.each do |os, facts|
1818
context "on #{os}" do
1919
config_path = case facts[:os]['name']
2020
when 'windows'
2121
'C:/ProgramData/zabbix/zabbix_agentd.conf'
22+
when 'FreeBSD'
23+
'/usr/local/etc/zabbix6/zabbix_agentd.conf'
2224
else
2325
'/etc/zabbix/zabbix_agentd.conf'
2426
end
@@ -32,6 +34,8 @@
3234
include_dir = case facts[:os]['name']
3335
when 'windows'
3436
'C:/ProgramData/zabbix/zabbix_agentd.d'
37+
when 'FreeBSD'
38+
'/usr/local/etc/zabbix6/zabbix_agentd.d'
3539
else
3640
'/etc/zabbix/zabbix_agentd.d'
3741
end
@@ -50,6 +54,9 @@
5054
when 'windows'
5155
package_name = 'zabbix-agent'
5256
service_name = 'Zabbix Agent'
57+
when 'FreeBSD'
58+
package_name = 'zabbix6-agent'
59+
service_name = 'zabbix_agentd'
5360
else
5461
package_name = 'zabbix-agent'
5562
service_name = 'zabbix-agent'
@@ -60,7 +67,7 @@
6067
context 'with all defaults' do
6168
it { is_expected.to contain_selinux__module('zabbix-agent') } if facts[:os]['family'] == 'RedHat'
6269
it { is_expected.to contain_yumrepo('zabbix-frontend') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
63-
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
70+
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' && %w[OracleLinux CentOS].include?(facts[:os]['name'])
6471
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
6572
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
6673
it { is_expected.to contain_file(include_dir).with_ensure('directory') }
@@ -75,11 +82,20 @@
7582
)
7683
end
7784
else
78-
it do
79-
is_expected.to contain_package(package_name).
80-
with_ensure('present').
81-
with_tag('zabbix').
82-
that_requires('Class[zabbix::repo]')
85+
86+
if facts[:os]['family'] == 'Gentoo'
87+
it do
88+
is_expected.to contain_package(package_name).
89+
with_ensure('present').
90+
with_tag('zabbix')
91+
end
92+
else
93+
it do
94+
is_expected.to contain_package(package_name).
95+
with_ensure('present').
96+
with_tag('zabbix').
97+
that_requires('Class[zabbix::repo]')
98+
end
8399
end
84100

85101
it do
@@ -103,7 +119,7 @@
103119
end
104120

105121
case facts[:os]['family']
106-
when 'Archlinux'
122+
when %w[Archlinux Gentoo FreeBSD].include?(facts[:os]['family'])
107123
it { is_expected.not_to compile.with_all_deps }
108124
when 'Debian'
109125
# rubocop:disable RSpec/RepeatedExample
@@ -218,6 +234,9 @@
218234
end
219235

220236
context 'when declaring manage_startup_script is true' do
237+
next if facts[:os]['family'] == 'FreeBSD'
238+
next if facts[:os]['family'] == 'Gentoo'
239+
221240
let :params do
222241
{
223242
manage_startup_script: true
@@ -478,6 +497,8 @@
478497
end
479498

480499
context 'when zabbix_package_agent is zabbix-agent2' do
500+
next if facts[:os]['family'] == 'Gentoo'
501+
481502
let :params do
482503
{
483504
zabbix_package_agent: 'zabbix-agent2', startagents: 1,

spec/classes/database_mysql_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'rspec.puppet.com'
88
end
99

10-
on_supported_os(baseline_os_hash).each do |os, facts|
10+
on_supported_os.each do |os, facts|
1111
next if facts[:os]['name'] == 'windows'
1212

1313
context "on #{os}" do

spec/classes/database_postgresql_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'rspec.puppet.com'
88
end
99

10-
on_supported_os(baseline_os_hash).each do |os, facts|
10+
on_supported_os.each do |os, facts|
1111
next if facts[:os]['name'] == 'windows'
1212

1313
context "on #{os}" do

spec/classes/database_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'rspec.puppet.com'
88
end
99

10-
on_supported_os(baseline_os_hash).each do |os, facts|
10+
on_supported_os.each do |os, facts|
1111
next if facts[:os]['name'] == 'windows'
1212

1313
context "on #{os}" do

spec/classes/javagateway_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'rspec.puppet.com'
88
end
99

10-
on_supported_os(baseline_os_hash).each do |os, facts|
10+
on_supported_os.each do |os, facts|
1111
next if facts[:os]['name'] == 'windows'
1212

1313
context "on #{os}" do
@@ -28,7 +28,7 @@
2828
it { is_expected.to contain_service('zabbix-java-gateway').with_require(['Package[zabbix-java-gateway]', 'File[/etc/zabbix/zabbix_java_gateway.conf]']) }
2929

3030
it { is_expected.to contain_yumrepo('zabbix-frontend') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
31-
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
31+
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' && %w[OracleLinux CentOS].include?(facts[:os]['name'])
3232
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
3333
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
3434
end

0 commit comments

Comments
 (0)