Fix beaker on xenial

Since the beaker jobs are being run on xenial, we need a special nodeset
for it, otherwise beaker gives an error:

 beaker-hostgenerator was not able to use this value as input.
 Exiting with an Error.

We also want to install puppet from the Ubuntu repos rather than from
puppetlabs, since puppetlabs doesn't support puppet 3 for Xenial. For
centos we can keep the install process the same.

Additionally, this patch updates params.pp to distinguish between JRE
packages based on the Ubuntu release so that these module will work on
Xenial. We still keep support for trusty.

Finally, remove spec assertions that are not useful, including
verifications that packages are installed and config files existing. It
is enough to assume that if the puppet ran without errors that it was
able to also successfully find and install packages and lay down config
files. We remove these tests instead of updating the package check for
the new JRE package.

Change-Id: Ifd2244ae9dd212b2475f9cd6adb994bc058a4769
Depends-On: I053d437ceb7895fe2b1e2c46bf9cf19f73bdb20c
This commit is contained in:
Colleen Murphy 2017-05-02 16:27:50 +02:00 committed by Colleen Murphy
parent d4fcbbff1c
commit f79ea7c853
5 changed files with 39 additions and 60 deletions

View File

@ -24,7 +24,7 @@ class elasticsearch (
# Ensure: java runtime and curl
# Curl is handy for talking to the ES API on localhost. Allows for
# querying cluster state and deleting indexes and so on.
ensure_packages(['openjdk-7-jre-headless', 'curl', $::elasticsearch::params::gem_package])
ensure_packages([$::elasticsearch::params::jre_package, 'curl', $::elasticsearch::params::gem_package])
include '::archive'
@ -57,7 +57,7 @@ class elasticsearch (
source => "/tmp/elasticsearch-${version}.deb",
provider => 'dpkg',
require => [
Package['openjdk-7-jre-headless'],
Package[$::elasticsearch::params::jre_package],
File['/etc/elasticsearch/elasticsearch.yml'],
File['/etc/elasticsearch/default-mapping.json'],
File['/etc/elasticsearch/logging.yml'],

View File

@ -5,16 +5,28 @@ class elasticsearch::params (
case $::osfamily {
'Debian': {
if $::lsbdistcodename == 'precise' {
# package names
$gem_package = 'rubygems'
} else {
# package names
$gem_package = 'ruby'
case $::lsbdistcodename {
'precise': {
$gem_package = 'rubygems'
$jre_package = 'openjdk-7-jre-headless'
}
'trusty': {
$gem_package = 'ruby'
$jre_package = 'openjdk-7-jre-headless'
}
'xenial': {
$gem_package = 'ruby'
$jre_package = 'openjdk-8-jre-headless'
}
default: {
$gem_package = 'ruby'
$jre_package = 'openjdk-7-jre-headless'
}
}
}
default: {
$gem_package = 'ruby'
$jre_package = 'openjdk-7-jre-headless'
}
}

View File

@ -20,55 +20,4 @@ describe 'puppet-elasticsearch module', :if => ['debian', 'ubuntu'].include?(os[
apply_manifest(default_puppet_module, catch_changes: true)
end
describe 'required packages' do
describe package('curl') do
it { should be_installed }
end
describe package('openjdk-7-jre-headless') do
it { should be_installed }
end
describe package('elasticsearch') do
it { should be_installed }
end
end
describe 'required files' do
describe file('/etc/elasticsearch/elasticsearch.yml') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its(:content) { should include 'cluster.name: acceptance-test' }
end
describe file('/etc/elasticsearch/templates') do
it { should be_directory }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
end
describe file('/etc/elasticsearch/default-mapping.json') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its(:content) { should include '"_source": { "compress": true },' }
end
describe file('/etc/default/elasticsearch') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its(:content) { should include 'ES_HEAP_SIZE=16g' }
end
describe file('/tmp/acceptance') do
it { should be_directory }
it { should be_owned_by 'elasticsearch' }
end
end
describe cron do
it { should have_entry('7 6 * * * find /var/log/elasticsearch -type f -mtime +14 -delete').with_user('root') }
end
end

View File

@ -0,0 +1,10 @@
HOSTS:
ubuntu-16.04-amd64:
roles:
- master
platform: ubuntu-16.04-amd64
hypervisor: none
ip: 127.0.0.1
CONFIG:
type: foss
set_env: false

View File

@ -2,7 +2,15 @@ require 'beaker-rspec'
hosts.each do |host|
install_puppet
# puppet 3 isn't available from apt.puppetlabs.com so install it from the Xenial repos
on host, "which apt-get && apt-get install puppet -y", { :acceptable_exit_codes => [0,1] }
# otherwise use the beaker helpers to install the yum.puppetlabs.com repo and puppet
r = on host, "which yum", { :acceptable_exit_codes => [0,1] }
if r.exit_code == 0
install_puppet
end
add_platform_foss_defaults(host, 'unix')
on host, "mkdir -p #{host['distmoduledir']}"
end