Skip to content

Commit

Permalink
ci(cleanup): dropped obsolete opensuse-leap-15 workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
alxwr committed Jul 13, 2019
1 parent 637387e commit 1e1719d
Showing 1 changed file with 26 additions and 33 deletions.
59 changes: 26 additions & 33 deletions test/integration/default/controls/services_spec.rb
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

0 comments on commit 1e1719d

Please sign in to comment.