diff --git a/acceptance_spec/acceptance/install_spec.rb b/acceptance_spec/acceptance/install_spec.rb new file mode 100644 index 000000000..c516f30ac --- /dev/null +++ b/acceptance_spec/acceptance/install_spec.rb @@ -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 diff --git a/acceptance_spec/acceptance/nodesets/centos-6-x64.yml b/acceptance_spec/acceptance/nodesets/centos-6-x64.yml new file mode 100644 index 000000000..1bd1307ce --- /dev/null +++ b/acceptance_spec/acceptance/nodesets/centos-6-x64.yml @@ -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 diff --git a/acceptance_spec/acceptance/nodesets/debian-6-x64.yml b/acceptance_spec/acceptance/nodesets/debian-6-x64.yml new file mode 100644 index 000000000..da891411c --- /dev/null +++ b/acceptance_spec/acceptance/nodesets/debian-6-x64.yml @@ -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 diff --git a/acceptance_spec/acceptance/nodesets/debian-7-x64.yml b/acceptance_spec/acceptance/nodesets/debian-7-x64.yml new file mode 100644 index 000000000..dd9681bcb --- /dev/null +++ b/acceptance_spec/acceptance/nodesets/debian-7-x64.yml @@ -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 diff --git a/acceptance_spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/acceptance_spec/acceptance/nodesets/ubuntu-server-1204-x64.yml new file mode 100644 index 000000000..92bab9cda --- /dev/null +++ b/acceptance_spec/acceptance/nodesets/ubuntu-server-1204-x64.yml @@ -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 diff --git a/acceptance_spec/acceptance/nodesets/ubuntu-server-1304-x64.yml b/acceptance_spec/acceptance/nodesets/ubuntu-server-1304-x64.yml new file mode 100644 index 000000000..6c4165632 --- /dev/null +++ b/acceptance_spec/acceptance/nodesets/ubuntu-server-1304-x64.yml @@ -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 diff --git a/acceptance_spec/spec_helper_acceptance.rb b/acceptance_spec/spec_helper_acceptance.rb new file mode 100644 index 000000000..898699ff6 --- /dev/null +++ b/acceptance_spec/spec_helper_acceptance.rb @@ -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