Skip to content

Commit

Permalink
update testing for templates
Browse files Browse the repository at this point in the history
  • Loading branch information
dearing committed Jul 31, 2015
1 parent 7cd3ae4 commit e45ef5d
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 9 deletions.
3 changes: 3 additions & 0 deletions templates/default/elasticsearch/elasticsearch.yml.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file was generated by Chef
# Do NOT modify this file by hand.

##################### Elasticsearch Configuration Example #####################

# This file contains an overview of various configuration settings,
Expand Down
3 changes: 3 additions & 0 deletions templates/default/elasticsearch/logging.yml.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file was generated by Chef
# Do NOT modify this file by hand.

# you can override this using by setting a system property, for example -Des.logger.level=DEBUG
es.logger.level: INFO
rootLogger: ${es.logger.level}, console, file
Expand Down
3 changes: 3 additions & 0 deletions templates/default/kibana/kibana.yml.erb
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file was generated by Chef
# Do NOT modify this file by hand.

# Kibana is served by a back end server. This controls which port to use.
port: <%= @options['port'] %>

Expand Down
3 changes: 3 additions & 0 deletions templates/default/logstash-forwarder/logstash-forwarder.conf.erb
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file was generated by Chef
# Do NOT modify this file by hand.

{
"network": {
"servers": [ "localhost:5043" ],
Expand Down
2 changes: 1 addition & 1 deletion templates/default/logstash/logging.yml.erb
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was generated by Chef
# Do NOT modify this file by hand.
# you can override this using by setting a system property, for example -Des.logger.level=DEBUG

es.logger.level: INFO
rootLogger: ${es.logger.level}, console, file
logger:
Expand Down
3 changes: 3 additions & 0 deletions templates/default/logstash/logstash.conf.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file was generated by Chef
# Do NOT modify this file by hand.

input {
lumberjack {
port => "<%= @options['port'] %>"
Expand Down
21 changes: 15 additions & 6 deletions test/integration/helpers/serverspec/elasticsearch.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# sshd_service = os[:family] == 'redhat' ? 'sshd' : 'ssh'

shared_examples 'elasticsearch' do

describe command('sv status elasticsearch') do
its(:stdout) { should match 'run: elasticsearch' }
end
Expand All @@ -10,13 +9,23 @@
# describe command('curl http://localhost:9200/') do
# its(:stdout) { should match '"status" : 200,' }
# end
# describe command('curl http://localhost:9200/_cat/health') do
# its(:stdout) { should match 'elasticsearch' } # node name
# end

describe command('curl http://localhost:9200/_cat/health?v') do
its(:stdout) { should match 'elasticsearch' }
describe file('/etc/service/elasticsearch/env/ES_USER') do
it { should be_file }
its(:content) { should match 'elasticsearch' }
end

describe file('/etc/service/elasticsearch/env/ES_USER') do
it { should be_file }
its(:content) { should match 'elasticsearch' }
describe file('/opt/elasticsearch/elasticsearch-1.7.0/config/elasticsearch.yml') do
it { should be_file }
its(:content) { should match '# This file was generated by Chef' }
end

describe file('/opt/elasticsearch/elasticsearch-1.7.0/config/logging.yml') do
it { should be_file }
its(:content) { should match '# This file was generated by Chef' }
end

end
4 changes: 4 additions & 0 deletions test/integration/helpers/serverspec/kibana.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
describe command('sv status kibana') do
its(:stdout) { should match 'run: kibana' }
end
describe file('/opt/kibana/kibana-4.1.1/config/kibana.yml') do
it { should be_file }
its(:content) { should match '# This file was generated by Chef' }
end
end
15 changes: 13 additions & 2 deletions test/integration/helpers/serverspec/logstash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@
describe command('sv status logstash') do
its(:stdout) { should match 'run: logstash' }
end

describe file('/etc/service/logstash/env/LS_USER') do
it { should be_file }
its(:content) { should match 'logstash' }
it { should be_file }
its(:content) { should match 'logstash' }
end

describe file('/opt/logstash/logstash-1.5.3/config/logging.yml') do
it { should be_file }
its(:content) { should match '# This file was generated by Chef' }
end

describe file('/opt/logstash/logstash-1.5.3/config/logstash.conf') do
it { should be_file }
its(:content) { should match '# This file was generated by Chef' }
end
end
5 changes: 5 additions & 0 deletions test/integration/helpers/serverspec/logstash_forwarder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@
describe command('sv status logstash-forwarder') do
its(:stdout) { should match 'run: logstash-forwarder' }
end

describe file('/opt/logstash-forwarder/logstash-forwarder-0.4.0/logstash-forwarder.conf') do
it { should be_file }
its(:content) { should match '# This file was generated by Chef' }
end
end

0 comments on commit e45ef5d

Please sign in to comment.