Skip to content

Commit 9b02f7e

Browse files
authored
Merge pull request #2340 from ekohl/setup-acceptance-node
Extract acceptance node setup to a separate file
2 parents ef28205 + 0ee9819 commit 9b02f7e

File tree

2 files changed

+38
-40
lines changed

2 files changed

+38
-40
lines changed

spec/setup_acceptance_node.pp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# needed by tests
2+
package { 'curl':
3+
ensure => 'latest',
4+
}
5+
6+
case $facts['os']['family'] {
7+
'SLES', 'SUSE': {
8+
# needed for netstat, for serverspec checks
9+
package { 'net-tools-deprecated':
10+
ensure => 'latest',
11+
}
12+
}
13+
'RedHat': {
14+
# Make sure selinux is disabled so the tests work.
15+
if $facts['os']['selinux']['enabled'] {
16+
exec { 'setenforce 0':
17+
path => $facts['path'],
18+
}
19+
}
20+
21+
if versioncmp($facts['os']['release']['major'], '8') >= 0 {
22+
package { 'iproute':
23+
ensure => installed,
24+
}
25+
}
26+
include epel
27+
}
28+
'Debian': {
29+
if $facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'], '11') >= 0 {
30+
# Ensure ipv6 is enabled on our Debian 11 Docker boxes
31+
exec { 'sysctl -w net.ipv6.conf.all.disable_ipv6=0':
32+
path => $facts['path'],
33+
}
34+
}
35+
}
36+
}

spec/spec_helper_acceptance_local.rb

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -34,48 +34,10 @@ def print_parsing_errors
3434
end
3535
c.before :suite do
3636
if %r{redhat|oracle}.match?(os[:family])
37-
# Make sure selinux is disabled so the tests work.
38-
LitmusHelper.instance.run_shell('setenforce 0', expect_failures: true)
39-
40-
# Version 4.0.0 drops EL6 support
41-
if os[:release].to_i <= 6
42-
LitmusHelper.instance.run_shell('puppet module install --version 3.1.0 puppet/epel')
43-
else
44-
LitmusHelper.instance.run_shell('puppet module install puppet/epel')
45-
end
37+
LitmusHelper.instance.run_shell('puppet module install puppet/epel')
4638
end
4739

48-
pp = <<-PUPPETCODE
49-
# needed by tests
50-
package { 'curl':
51-
ensure => 'latest',
52-
}
53-
# needed for netstat, for serverspec checks
54-
if $::osfamily == 'SLES' or $::osfamily == 'SUSE' {
55-
package { 'net-tools-deprecated':
56-
ensure => 'latest',
57-
}
58-
}
59-
if $::osfamily == 'RedHat' {
60-
# EPEL < 7 is EOL and removed from the official mirror network
61-
if $::operatingsystemmajrelease == '5' or $::operatingsystemmajrelease == '6'{
62-
class { 'epel':
63-
epel_baseurl => "http://osmirror.delivery.puppetlabs.net/epel${::operatingsystemmajrelease}-\\$basearch/RPMS.all",
64-
epel_mirrorlist => "http://osmirror.delivery.puppetlabs.net/epel${::operatingsystemmajrelease}-\\$basearch/RPMS.all",
65-
}
66-
} else {
67-
class { 'epel': }
68-
}
69-
}
70-
PUPPETCODE
71-
LitmusHelper.instance.apply_manifest(pp)
72-
73-
# Ensure ipv6 is enabled on our Debian 11 Docker boxes
74-
LitmusHelper.instance.run_shell('sysctl -w net.ipv6.conf.all.disable_ipv6=0') if %r{debian}.match?(os[:family]) && os[:release].to_f == 11
75-
76-
# Install iproute on AlmaLinux
77-
# Package is used to check if ports are listening
78-
LitmusHelper.instance.run_shell('sudo dnf install iproute -y') if %r{redhat}.match?(os[:family]) && os[:release].to_f >= 8
40+
LitmusHelper.instance.apply_manifest(File.read(File.join(__dir__, 'setup_acceptance_node.pp')))
7941
end
8042

8143
c.after :suite do

0 commit comments

Comments
 (0)