From 870035b385cba0713d601ca6fe4701b8c5f37ca2 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Mon, 21 Mar 2016 14:34:43 +0000 Subject: [PATCH] Fixes for evaluating systemd and init --- .../helpers/serverspec/config_spec.rb | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/test/integration/helpers/serverspec/config_spec.rb b/test/integration/helpers/serverspec/config_spec.rb index cf13ba3..979e5d5 100644 --- a/test/integration/helpers/serverspec/config_spec.rb +++ b/test/integration/helpers/serverspec/config_spec.rb @@ -61,10 +61,6 @@ shared_examples 'config::init' do |es_version| it { should be_owned_by 'elasticsearch' } end - describe file('/etc/init.d/node1_elasticsearch') do - it { should be_file } - end - #test we started on the correct port was used describe command('curl -s "localhost:9201"') do #TODO: This is returning an empty string @@ -87,7 +83,6 @@ shared_examples 'config::init' do |es_version| end end - describe file('/etc/init.d/elasticsearch') do it { should_not exist } end @@ -108,11 +103,23 @@ shared_examples 'config::init' do |es_version| it { should_not exist } end - #Not copied on Debian 8 - #describe file('/usr/lib/systemd/system/node1_elasticsearch.service') do - # it { should be_file } - # it { should contain 'LimitMEMLOCK=infinity' } - #end + #Init vs Systemd tests + #Ubuntu 15 and up + #Debian 8 and up + #Centos 7 and up + + if ((os[:family] == 'centos' && os[:release].to_f >= 7.0) || + (os[:family] == 'ubuntu' && os[:release].to_f >= 15.0) || + (os[:family] == 'debian' && os[:release].to_f >= 8.0)) + describe file('/usr/lib/systemd/system/node1_elasticsearch.service') do + it { should be_file } + it { should contain 'LimitMEMLOCK=infinity' } + end + else + describe file('/etc/init.d/node1_elasticsearch') do + it { should be_file } + end + end end