Skip to content

Commit 1e1719d

Browse files
committed
ci(cleanup): dropped obsolete opensuse-leap-15 workaround
1 parent 637387e commit 1e1719d

1 file changed

Lines changed: 26 additions & 33 deletions

File tree

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,36 @@
1-
# Temporary `if` due to `opensuse-leap-15` bug re: `service`
2-
if os[:name] == 'suse'
3-
puts "[Skip `service`-based tests due to `opensuse-leap-15` detection bug (see https://github.com/inspec/train/issues/377)]"
4-
else
5-
6-
control 'OpenVPN service' do
7-
impact 0.5
8-
title 'should be running and enabled'
9-
10-
# single service
11-
if os[:name] == 'centos' and os[:release].start_with?('6')
12-
describe service("openvpn") do
13-
it { should be_enabled }
14-
it { should be_running }
15-
end
1+
control 'OpenVPN service' do
2+
impact 0.5
3+
title 'should be running and enabled'
4+
5+
# single service
6+
if os[:name] == 'centos' and os[:release].start_with?('6')
7+
describe service("openvpn") do
8+
it { should be_enabled }
9+
it { should be_running }
10+
end
1611

17-
# multiple services
18-
else
19-
%w(server client).each do |role|
12+
# multiple services
13+
else
14+
%w(server client).each do |role|
2015

21-
prefix = case os[:name]
22-
when 'fedora' then "openvpn-#{role}"
23-
else 'openvpn'
24-
end
16+
prefix = case os[:name]
17+
when 'fedora' then "openvpn-#{role}"
18+
else 'openvpn'
19+
end
2520

26-
describe service("#{prefix}@my#{role}1.service") do
27-
it { should be_enabled }
28-
it { should be_running }
29-
end
21+
describe service("#{prefix}@my#{role}1.service") do
22+
it { should be_enabled }
23+
it { should be_running }
3024
end
3125
end
26+
end
3227

33-
%w(server client).each do |role|
34-
logfile = "/var/log/openvpn/my#{role}1.log"
28+
%w(server client).each do |role|
29+
logfile = "/var/log/openvpn/my#{role}1.log"
3530

36-
describe command("sh -c 'for i in $(seq 1 60); do if grep \"Initialization Sequence Completed\" #{logfile}; then exit 0; fi; echo -n '.'; sleep 1; done; cat #{logfile}; exit 1'") do
37-
its('exit_status') { should be 0 }
38-
its('stdout') { should include "Initialization Sequence Completed" }
39-
end
31+
describe command("sh -c 'for i in $(seq 1 60); do if grep \"Initialization Sequence Completed\" #{logfile}; then exit 0; fi; echo -n '.'; sleep 1; done; cat #{logfile}; exit 1'") do
32+
its('exit_status') { should be 0 }
33+
its('stdout') { should include "Initialization Sequence Completed" }
4034
end
4135
end
42-
4336
end

0 commit comments

Comments
 (0)