Skip to content

Commit

Permalink
Merge pull request #23 from dearing/dev
Browse files Browse the repository at this point in the history
testing update
  • Loading branch information
dearing committed Aug 4, 2015
2 parents e0531e1 + d5d6205 commit c6383b4
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 39 deletions.
20 changes: 8 additions & 12 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,15 @@
# publish_all: true

platforms:
#- name: centos-5
- name: centos-5
- name: centos-6
#- name: centos-7
#- name: fedora
#- name: ubuntu-12
# run_list:
# - recipe[apt]
#- name: ubuntu-14
# run_list:
# - recipe[apt]
#- name: debian
# run_list:
# - recipe[apt]
- name: ubuntu-12
- name: ubuntu-14
- name: ubuntu-15

transport:
name: ssh
compression: none

provisioner:
name: chef_zero
Expand Down
7 changes: 0 additions & 7 deletions Gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion libraries/provider_logstash_forwarder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class LogstashForwarder < Chef::Provider::LWRPBase
variables options: {
'crt_location' => new_resource.crt_location,
'files' => new_resource.files,
'key_location' => new_resource.key_location,
# 'key_location' => new_resource.key_location,
'logstash_servers' => new_resource.logstash_servers,
'timeout' => new_resource.timeout
}.merge(new_resource.conf_options)
Expand Down
4 changes: 2 additions & 2 deletions libraries/resource_logstash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class Logstash < Chef::Resource::LWRPBase

attribute :path, kind_of: String, default: '/opt/logstash'

attribute :crt_location, kind_of: String, default: '/etc/logstash/logstash.crt'
attribute :key_location, kind_of: String, default: '/etc/logstash/logstash.key'
attribute :crt_location, kind_of: String, required: true, default: '/etc/logstash/logstash.crt'
attribute :key_location, kind_of: String, required: true, default: '/etc/logstash/logstash.key'

attribute :port, kind_of: Integer, default: 5043
attribute :conf_options, kind_of: Hash, default: {}
Expand Down
2 changes: 1 addition & 1 deletion libraries/resource_logstash_forwarder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LogstashForwarder < Chef::Resource::LWRPBase

# configuration
attribute :crt_location, kind_of: String, required: true, default: nil
attribute :key_location, kind_of: String, required: true, default: nil
attribute :key_location, kind_of: String, required: false, default: nil
attribute :port, kind_of: Integer, default: 5043
attribute :timeout, kind_of: Integer, default: 15
attribute :logstash_servers, kind_of: Array, default: ['localhost:5043']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"network": {
"servers": <%= @options['logstash_servers'].to_json %>,
"ssl key": "<%= @options['key_location'] %>",
# "ssl key": "<%= @options['key_location'] %>",
"ssl ca": "<%= @options['crt_location'] %>",
"timeout": <%= @options['timeout'] %>
},
Expand Down
2 changes: 2 additions & 0 deletions test/cookbooks/ellktest/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@

depends 'ellk'
depends 'runit'
depends 'yum'
depends 'apt'
33 changes: 28 additions & 5 deletions test/cookbooks/ellktest/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
# test a single node with all four projects
%w( tar nano htop java-1.8.0-openjdk-headless ).each do |pkg|
packages = %w( tar nano htop )

case node[:platform_family]
when 'debian'
include_recipe 'apt'
packages << 'openjdk-7-jre-headless'
when 'rhel'
include_recipe 'yum'
if node[:platform_version].to_i == 5
packages << 'java-1.7.0-openjdk'
else
packages << 'java-1.8.0-openjdk-headless'
end
end

packages.each do |pkg|
package pkg
end

include_recipe 'runit::default'
include_recipe 'runit'
link '/usr/local/bin/sv' do
to '/usr/bin/sv'
end

# create certs (subject = localhost)
secrets = Chef::DataBagItem.load('secrets', 'logstash')
Expand All @@ -16,12 +33,16 @@
content logstash_crt
end

## ELASTICSEARCH
elasticsearch 'default' do
datadir '/tmp/es_datadir'
version '1.7.1'
checksum '86a0c20eea6ef55b14345bff5adf896e6332437b19180c4582a346394abde019'
url 'https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.1.tar.gz'
end

## LOGSTASH
bonus_env = { 'HELLO' => 'WORLD', 'LS_USER' => 'kibana' } # for testing sake
# demonstrate sneaking in extra configuration when sourceing outside the ellk cookbook
bonus_conf = { 'test_value' => 'merged hash from a recipe!' }
logstash 'default' do
crt_location '/tmp/logstash.crt'
Expand All @@ -31,13 +52,15 @@
conf_options bonus_conf
end

## LOGSTASH-FORWARDER
logstash_forwarder 'default' do
crt_location '/tmp/logstash.crt'
key_location '/tmp/logstash.key'
# key_location '/tmp/logstash.key'
logstash_servers ['localhost:5043']
files [{ 'paths' => ['/var/log/messages', '/var/log/*log', '/var/log/kibana/current'], 'fields' => { 'type' => 'syslog' } }]
end

## KIBANA
kibana 'default' do
port 8080
end
6 changes: 2 additions & 4 deletions test/integration/helpers/serverspec/elasticsearch.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# sshd_service = os[:family] == 'redhat' ? 'sshd' : 'ssh'

shared_examples 'elasticsearch' do
describe command('sv status elasticsearch') do
its(:stdout) { should match 'run: elasticsearch' }
Expand All @@ -18,12 +16,12 @@
its(:content) { should match 'elasticsearch' }
end

describe file('/opt/elasticsearch/elasticsearch-1.7.0/config/elasticsearch.yml') do
describe file('/opt/elasticsearch/elasticsearch-1.7.1/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
describe file('/opt/elasticsearch/elasticsearch-1.7.1/config/logging.yml') do
it { should be_file }
its(:content) { should match '# This file was generated by Chef' }
end
Expand Down
2 changes: 0 additions & 2 deletions test/integration/helpers/serverspec/kibana.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# sshd_service = os[:family] == 'redhat' ? 'sshd' : 'ssh'

shared_examples 'kibana' do
describe command('sv status kibana') do
its(:stdout) { should match 'run: kibana' }
Expand Down
2 changes: 0 additions & 2 deletions test/integration/helpers/serverspec/logstash.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# sshd_service = os[:family] == 'redhat' ? 'sshd' : 'ssh'

shared_examples 'logstash' do
describe command('sv status logstash') do
its(:stdout) { should match 'run: logstash' }
Expand Down
2 changes: 0 additions & 2 deletions test/integration/helpers/serverspec/logstash_forwarder.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# sshd_service = os[:family] == 'redhat' ? 'sshd' : 'ssh'

shared_examples 'logstash_forwarder' do
describe command('sv status logstash-forwarder') do
its(:stdout) { should match 'run: logstash-forwarder' }
Expand Down

0 comments on commit c6383b4

Please sign in to comment.