Skip to content

Commit

Permalink
Merge pull request elastic#1268 from electrical/acceptance_testing
Browse files Browse the repository at this point in the history
Acceptance testing
  • Loading branch information
Richard Pijnenburg committed Apr 15, 2014
2 parents f3dbddc + a044d1d commit a0aedea
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 0 deletions.
54 changes: 54 additions & 0 deletions acceptance_spec/acceptance/install_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
require_relative '../spec_helper_acceptance'

describe "Logstash class:" do

case fact('osfamily')
when 'RedHat'
package_name = 'logstash'
service_name = 'logstash'
url = 'https://s3-us-west-2.amazonaws.com/build.elasticsearch.org/origin/master/nightly/JDK7/logstash-latest.rpm'
pid_file = '/var/run/logstash.pid'
when 'Debian'
package_name = 'logstash'
service_name = 'logstash'
url = 'https://s3-us-west-2.amazonaws.com/build.elasticsearch.org/origin/master/nightly/JDK7/logstash-latest.deb'
pid_file = '/var/run/logstash.pid'
end

context "Install Nightly build package" do

it 'should run successfully' do
pp = "class { 'logstash': package_url => '#{url}', java_install => true }
logstash::configfile { 'basic_config': content => 'input { tcp { port => 2000 } } output { stdout { } } ' }
"

# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero

end

describe package(package_name) do
it { should be_installed }
end

describe service(service_name) do
it { should be_enabled }
it { should be_running }
end

describe file(pid_file) do
it { should be_file }
its(:content) { should match /[0-9]+/ }
end

describe port(2000) do
it {
sleep 5
should be_listening
}
end

end

end
15 changes: 15 additions & 0 deletions acceptance_spec/acceptance/nodesets/centos-6-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HOSTS:
centos-6-x64:
roles:
- master
- database
- dashboard
platform: el-6-x86_64
image: jordansissel/system:centos-6.4
hypervisor: docker
docker_cmd: '["/sbin/init"]'
extra_commands:
- 'yum install -y wget ntpdate rubygems ruby-augeas ruby-devel augeas-devel'
- 'touch /etc/sysconfig/network'
CONFIG:
type: foss
15 changes: 15 additions & 0 deletions acceptance_spec/acceptance/nodesets/debian-6-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HOSTS:
debian-6:
roles:
- master
- database
- dashboard
platform: debian-6-amd64
image: jordansissel/system:debian-6.0.8
hypervisor: docker
docker_cmd: '["/sbin/init"]'
extra_commands:
- 'apt-get install -yq lsb-release wget net-tools ruby rubygems ruby1.8-dev libaugeas-dev libaugeas-ruby ntpdate locales-all'
- 'REALLY_GEM_UPDATE_SYSTEM=1 gem update --system --no-ri --no-rdoc'
CONFIG:
type: foss
15 changes: 15 additions & 0 deletions acceptance_spec/acceptance/nodesets/debian-7-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HOSTS:
debian-7:
roles:
- master
- database
- dashboard
platform: debian-7-amd64
image: jordansissel/system:debian-7.3
hypervisor: docker
docker_cmd: '["/sbin/init"]'
extra_commands:
- 'apt-get install -yq lsb-release wget net-tools ruby rubygems ruby1.8-dev libaugeas-dev libaugeas-ruby ntpdate locales-all'
- 'REALLY_GEM_UPDATE_SYSTEM=1 gem update --system --no-ri --no-rdoc'
CONFIG:
type: foss
14 changes: 14 additions & 0 deletions acceptance_spec/acceptance/nodesets/ubuntu-server-1204-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
HOSTS:
ubuntu-12-04:
roles:
- master
- database
- dashboard
platform: ubuntu-12.04-amd64
image: jordansissel/system:ubuntu-12.04
hypervisor: docker
docker_cmd: '["/sbin/init"]'
extra_commands:
- 'apt-get install -yq ruby1.8-dev libaugeas-dev libaugeas-ruby ruby rubygems lsb-release wget net-tools curl'
CONFIG:
type: foss
14 changes: 14 additions & 0 deletions acceptance_spec/acceptance/nodesets/ubuntu-server-1304-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
HOSTS:
ubuntu-13-04:
roles:
- master
- database
- dashboard
platform: ubuntu-13.04-amd64
image: jordansissel/system:ubuntu-13.04
hypervisor: docker
docker_cmd: '["/sbin/init"]'
extra_commands:
- 'apt-get install -yq ruby1.8-dev libaugeas-dev libaugeas-ruby ruby rubygems lsb-release wget net-tools curl'
CONFIG:
type: foss
55 changes: 55 additions & 0 deletions acceptance_spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
require 'beaker-rspec'
require 'pry'
require 'securerandom'

files_dir = ENV['files_dir'] || '/home/jenkins/puppet'

hosts.each do |host|
# Install Puppet
if host.is_pe?
install_pe
else
puppetversion = ENV['VM_PUPPET_VERSION'] || '3.4.0'
install_package host, 'rubygems'
on host, "gem install puppet --no-ri --no-rdoc --version '~> #{puppetversion}'"
on host, "mkdir -p #{host['distmoduledir']}"

if fact('osfamily') == 'Suse'
install_package host, 'ruby-devel augeas-devel libxml2-devel'
on host, 'gem install ruby-augeas --no-ri --no-rdoc'
end

end

end

RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

# Readable test descriptions
c.formatter = :documentation

# Configure all nodes in nodeset
c.before :suite do
# Install module and dependencies

hosts.each do |host|

on host, puppet('module','install','elasticsearch-logstash'), { :acceptable_exit_codes => [0,1] }

if !host.is_pe?
scp_to(host, "#{files_dir}/puppetlabs-stdlib-3.2.0.tar.gz", '/tmp/puppetlabs-stdlib-3.2.0.tar.gz')
on host, puppet('module','install','/tmp/puppetlabs-stdlib-3.2.0.tar.gz'), { :acceptable_exit_codes => [0,1] }
end
if fact('osfamily') == 'Debian'
scp_to(host, "#{files_dir}/puppetlabs-apt-1.4.2.tar.gz", '/tmp/puppetlabs-apt-1.4.2.tar.gz')
on host, puppet('module','install','/tmp/puppetlabs-apt-1.4.2.tar.gz'), { :acceptable_exit_codes => [0,1] }
end
if fact('osfamily') == 'Suse'
on host, puppet('module','install','darin-zypprepo'), { :acceptable_exit_codes => [0,1] }
end

end
end
end
1 change: 1 addition & 0 deletions pkg/logstash.sysv
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ case "$1" in
echo "$name is already running"
else
start
code=$?
fi
exit $code
;;
Expand Down
15 changes: 15 additions & 0 deletions tools/Gemfile.beaker
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
source 'https://rubygems.org'

gem 'beaker', :git => 'https://github.com/electrical/beaker.git', :branch => 'docker_test'
gem 'beaker-rspec'
gem 'pry'
gem 'docker-api'
gem 'rubysl-securerandom'
gem 'rspec_junit_formatter'

case RUBY_VERSION
when '1.8.7'
gem 'rake', '~> 10.1.0'
else
gem 'rake'
end

0 comments on commit a0aedea

Please sign in to comment.