-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(cleanup): dropped obsolete opensuse-leap-15 workaround
- Loading branch information
Showing
1 changed file
with
26 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,36 @@ | ||
# Temporary `if` due to `opensuse-leap-15` bug re: `service` | ||
if os[:name] == 'suse' | ||
puts "[Skip `service`-based tests due to `opensuse-leap-15` detection bug (see https://github.com/inspec/train/issues/377)]" | ||
else | ||
|
||
control 'OpenVPN service' do | ||
impact 0.5 | ||
title 'should be running and enabled' | ||
|
||
# single service | ||
if os[:name] == 'centos' and os[:release].start_with?('6') | ||
describe service("openvpn") do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
control 'OpenVPN service' do | ||
impact 0.5 | ||
title 'should be running and enabled' | ||
|
||
# single service | ||
if os[:name] == 'centos' and os[:release].start_with?('6') | ||
describe service("openvpn") do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
# multiple services | ||
else | ||
%w(server client).each do |role| | ||
# multiple services | ||
else | ||
%w(server client).each do |role| | ||
|
||
prefix = case os[:name] | ||
when 'fedora' then "openvpn-#{role}" | ||
else 'openvpn' | ||
end | ||
prefix = case os[:name] | ||
when 'fedora' then "openvpn-#{role}" | ||
else 'openvpn' | ||
end | ||
|
||
describe service("#{prefix}@my#{role}1.service") do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
describe service("#{prefix}@my#{role}1.service") do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
end | ||
end | ||
|
||
%w(server client).each do |role| | ||
logfile = "/var/log/openvpn/my#{role}1.log" | ||
%w(server client).each do |role| | ||
logfile = "/var/log/openvpn/my#{role}1.log" | ||
|
||
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 | ||
its('exit_status') { should be 0 } | ||
its('stdout') { should include "Initialization Sequence Completed" } | ||
end | ||
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 | ||
its('exit_status') { should be 0 } | ||
its('stdout') { should include "Initialization Sequence Completed" } | ||
end | ||
end | ||
|
||
end |