Skip to content

Commit 870035b

Browse files
author
Dale McDiarmid
committed
Fixes for evaluating systemd and init
1 parent cea57cd commit 870035b

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

test/integration/helpers/serverspec/config_spec.rb

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@
6161
it { should be_owned_by 'elasticsearch' }
6262
end
6363

64-
describe file('/etc/init.d/node1_elasticsearch') do
65-
it { should be_file }
66-
end
67-
6864
#test we started on the correct port was used
6965
describe command('curl -s "localhost:9201"') do
7066
#TODO: This is returning an empty string
@@ -87,7 +83,6 @@
8783
end
8884
end
8985

90-
9186
describe file('/etc/init.d/elasticsearch') do
9287
it { should_not exist }
9388
end
@@ -108,11 +103,23 @@
108103
it { should_not exist }
109104
end
110105

111-
#Not copied on Debian 8
112-
#describe file('/usr/lib/systemd/system/node1_elasticsearch.service') do
113-
# it { should be_file }
114-
# it { should contain 'LimitMEMLOCK=infinity' }
115-
#end
116106

107+
#Init vs Systemd tests
108+
#Ubuntu 15 and up
109+
#Debian 8 and up
110+
#Centos 7 and up
111+
112+
if ((os[:family] == 'centos' && os[:release].to_f >= 7.0) ||
113+
(os[:family] == 'ubuntu' && os[:release].to_f >= 15.0) ||
114+
(os[:family] == 'debian' && os[:release].to_f >= 8.0))
115+
describe file('/usr/lib/systemd/system/node1_elasticsearch.service') do
116+
it { should be_file }
117+
it { should contain 'LimitMEMLOCK=infinity' }
118+
end
119+
else
120+
describe file('/etc/init.d/node1_elasticsearch') do
121+
it { should be_file }
122+
end
123+
end
117124
end
118125

0 commit comments

Comments
 (0)