systemd tests

This commit is contained in:
Dale McDiarmid 2015-11-27 19:58:54 +00:00
parent 0c7c338d6d
commit 7455b7fe3e
4 changed files with 30 additions and 15 deletions

View file

@ -61,17 +61,23 @@ context "basic tests" do
end
#test we started on the correct port was used
describe command('curl "localhost:9201" | grep status') do
describe command('curl -s "localhost:9201" | grep status') do
#TODO: This is returning an empty string
#its(:stdout) { should match /\"status\" : 200/ }
its(:exit_status) { should eq 0 }
end
#test to make sure mlock was applied
describe command('curl "localhost:9201/_nodes/process?pretty" | grep mlockall') do
its(:stdout) { should match /\"mlockall\" : true/ }
describe command('curl -s "localhost:9201/_nodes/process?pretty" | grep mlockall') do
its(:stdout) { should match /true/ }
its(:exit_status) { should eq 0 }
end
describe file('/usr/lib/systemd/system/node1_elasticsearch.service') do
it { should be_file }
it { should contain 'LimitMEMLOCK=infinity' }
it { should contain 'EnvironmentFile=-/etc/sysconfig/node1_elasticsearch' }
end
end

View file

@ -18,16 +18,9 @@ context "basic tests" do
it { should be_installed }
end
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
it { should be_file }
end
describe file('/etc/elasticsearch/master/elasticsearch.yml') do
it { should be_file }
end
#test configuration parameters have been set - test all appropriately set in config file
describe file('/etc/elasticsearch/node1/elasticsearch.yml') do
it { should be_file }
it { should contain 'http.port: 9201' }
it { should contain 'transport.tcp.port: 9301' }
it { should contain 'node.data: true' }
@ -44,6 +37,7 @@ context "basic tests" do
#test configuration parameters have been set for master - test all appropriately set in config file
describe file('/etc/elasticsearch/master/elasticsearch.yml') do
it { should be_file }
it { should contain 'http.port: 9200' }
it { should contain 'transport.tcp.port: 9300' }
it { should contain 'node.data: false' }
@ -150,15 +144,30 @@ context "basic tests" do
end
#test to make sure mlock was applied
describe command('curl "localhost:9200/_nodes/localhost-master/process?pretty" | grep mlockall') do
describe command('curl -s "localhost:9200/_nodes/localhost-master/process?pretty=true" | grep mlockall') do
its(:stdout) { should match /true/ }
its(:exit_status) { should eq 0 }
end
#test to make sure mlock was not applied
describe command('curl "localhost:9201/_nodes/localhost-node1/process?pretty" | grep mlockall') do
describe command('curl -s "localhost:9201/_nodes/localhost-node1/process?pretty=true" | grep mlockall') do
its(:stdout) { should match /false/ }
its(:exit_status) { should eq 0 }
end
#Test server spec file has been created and modified
describe file('/usr/lib/systemd/system/master_elasticsearch.service') do
it { should be_file }
it { should contain 'LimitMEMLOCK=infinity' }
it { should contain 'EnvironmentFile=-/etc/sysconfig/master_elasticsearch' }
end
describe file('/usr/lib/systemd/system/node1_elasticsearch.service') do
it { should be_file }
it { should_not contain 'LimitMEMLOCK=infinity' }
it { should contain 'EnvironmentFile=-/etc/sysconfig/node1_elasticsearch' }
end
end

View file

@ -46,7 +46,7 @@ context "basic tests" do
describe 'Template Installed' do
it 'should be reported as being installed', :retry => 3, :retry_wait => 10 do
command = command('curl localhost:9200/_template/basic')
command = command('curl -s "localhost:9200/_template/basic"')
expect(command.stdout).to match(/basic/)
expect(command.exit_status).to eq(0)
end

View file

@ -41,7 +41,7 @@ context "basic tests" do
describe 'plugin' do
it 'should be reported as existing', :retry => 3, :retry_wait => 10 do
command = command('curl localhost:9200/_nodes/?plugin | grep kopf')
command = command('curl -s localhost:9200/_nodes/?plugin | grep kopf')
expect(command.stdout).to match(/kopf/)
expect(command.exit_status).to eq(0)
end