Initial commit of package acceptance testing

This commit is contained in:
Richard Pijnenburg 2014-04-15 14:53:45 +02:00
parent f3dbddc808
commit b11748e053
7 changed files with 182 additions and 0 deletions

View file

@ -0,0 +1,54 @@
require '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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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']
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