diff --git a/.fixtures.yml b/.fixtures.yml index c6ddc2f..ee1a042 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,35 +1,35 @@ fixtures: forge_modules: archive: repo: puppet/archive ref: 0.5.1 augeas_core: repo: puppetlabs/augeas_core ref: 1.0.4 stdlib: repo: puppetlabs/stdlib ref: 4.13.1 java: repo: puppetlabs/java - ref: 2.0.0 + ref: 6.2.0 concat: repo: puppetlabs/concat ref: 2.2.1 datacat: repo: richardc/datacat ref: 0.6.2 apt: repo: puppetlabs/apt - ref: 2.2.2 + ref: 7.4.1 zypprepo: repo: puppet/zypprepo ref: 2.2.2 yumrepo_core: repo: puppetlabs/yumrepo_core ref: 1.0.3 java_ks: puppetlabs/java_ks elastic_stack: repo: elastic/elastic_stack ref: 6.1.0 symlinks: elasticsearch: "#{source_dir}" diff --git a/.travis.yml b/.travis.yml index bd410f3..280d71b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,126 +1,162 @@ sudo: required group: deprecated-2017Q4 services: - docker cache: bundler: true directories: - spec/fixtures/artifacts - spec/fixtures/modules language: ruby script: travis_retry bundle exec rake $TASK jobs: allow_failures: - env: - TASK=beaker:ubuntu-server-1404-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:ubuntu-server-1404-x64:snapshot - env: - TASK=beaker:ubuntu-server-1604-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:ubuntu-server-1604-x64:snapshot - env: - TASK=beaker:centos-6-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:centos-6-x64:snapshot - env: - TASK=beaker:centos-7-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:centos-7-x64:snapshot - env: - TASK=beaker:debian-8-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:debian-8-x64:snapshot - env: - TASK=beaker:debian-9-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:debian-9-x64:snapshot include: - stage: intake env: - TASK=intake - env: - TASK=intake - PUPPET_VERSION='~> 5.0' - stage: acceptance env: + - BEAKER_PUPPET_COLLECTION=puppet6 - TASK=beaker:centos-6-x64:acceptance - env: - - TASK=beaker:centos-6-x64:acceptance[5.6.9] + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:centos-6-x64:acceptance[5.6.16] - env: + - BEAKER_PUPPET_COLLECTION=puppet6 - TASK=beaker:centos-7-x64:acceptance - env: - - TASK=beaker:centos-7-x64:acceptance[5.6.9] + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:centos-7-x64:acceptance[5.6.16] - env: + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:centos-8-x64:acceptance + - env: + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:centos-8-x64:acceptance[5.6.16] + - env: + - BEAKER_PUPPET_COLLECTION=puppet6 - TASK=beaker:amazonlinux-1-x64:acceptance - env: - - TASK=beaker:amazonlinux-1-x64:acceptance[5.6.9] + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:amazonlinux-1-x64:acceptance[5.6.16] - env: + - BEAKER_PUPPET_COLLECTION=puppet6 - TASK=beaker:oracle-6-x64:acceptance - env: - - TASK=beaker:oracle-6-x64:acceptance[5.6.9] + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:oracle-6-x64:acceptance[5.6.16] - env: + - BEAKER_PUPPET_COLLECTION=puppet6 - TASK=beaker:oracle-7-x64:acceptance - env: - - TASK=beaker:oracle-7-x64:acceptance[5.6.9] + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:oracle-7-x64:acceptance[5.6.16] - env: + - BEAKER_PUPPET_COLLECTION=puppet6 - TASK=beaker:debian-8-x64:acceptance - env: - - TASK=beaker:debian-8-x64:acceptance[5.6.9] + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:debian-8-x64:acceptance[5.6.16] - env: + - BEAKER_PUPPET_COLLECTION=puppet6 - TASK=beaker:debian-9-x64:acceptance - env: - - TASK=beaker:debian-9-x64:acceptance[5.6.9] + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:debian-9-x64:acceptance[5.6.16] + - env: + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:debian-10-x64:acceptance - env: + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:debian-10-x64:acceptance[5.6.16] + - env: + - BEAKER_PUPPET_COLLECTION=puppet6 - TASK=beaker:ubuntu-server-1404-x64:acceptance - env: - - TASK=beaker:ubuntu-server-1404-x64:acceptance[5.6.9] + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:ubuntu-server-1404-x64:acceptance[5.6.16] - env: + - BEAKER_PUPPET_COLLECTION=puppet6 - TASK=beaker:ubuntu-server-1604-x64:acceptance - env: - - TASK=beaker:ubuntu-server-1604-x64:acceptance[5.6.9] + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:ubuntu-server-1604-x64:acceptance[5.6.16] + - env: + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:ubuntu-server-1804-x64:acceptance + - env: + - BEAKER_PUPPET_COLLECTION=puppet6 + - TASK=beaker:ubuntu-server-1804-x64:acceptance[5.6.16] - stage: snapshots env: - TASK=beaker:ubuntu-server-1404-x64:snapshot env: - OSS_PACKAGE=true - TASK=beaker:ubuntu-server-1404-x64:snapshot - env: - TASK=beaker:ubuntu-server-1604-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:ubuntu-server-1604-x64:snapshot - env: - TASK=beaker:centos-6-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:centos-6-x64:snapshot - env: - TASK=beaker:centos-7-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:centos-7-x64:snapshot - env: - TASK=beaker:debian-8-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:debian-8-x64:snapshot - env: - TASK=beaker:debian-9-x64:snapshot - env: - OSS_PACKAGE=true - TASK=beaker:debian-9-x64:snapshot notifications: slack: secure: T1FO+ttrJNH+bXmNR6349qcttG68Qr1xmMqVVRnUr7+129GQO5174Z8MFC8ck0qOCZGHO7GCNO5seNFflrjF/5EKbdkmVnqhf9gVa9kN7I4psMzxJX9bp29xJA6m3wA4VqCosDKVFSfilDZujAblWT+KDHZLjP8sEWEnHPvCjf69S2XDQEWUoxZan5V9IJQas4XR+hMdIZTA3ChVrEyqRfeehAZImbAr/LH8zChZaTdHZQY7p2rN3+qVNi3+GISV9fNPpOCynnX/ACbdUaRt3+1etxGGaQMPzGmTejN3VlMw4OZRXImb6HQ2rXE+fNCASXiKiwylxTbriQsS0dFv4skxH03YlYM8pqaBpeIOwzf4n45tTzdAQZJMC5cOb+RvwS7qkAwuaVlVxiiA+MWRG/UcFpWS+iNn4KEKxbpBjYP8X1JIP9DlHLME7DNMM2pePv9X6ZjY6eDhVM1gbKi77dXOo5y2Sp0ru8QkLpIKFVXS01O+x7oDHHv2Osvih0jNMgM66Byso3KJYJ6EJ0D2/3Q9ZNpVM4CMuIY5pBQfXf691zqkBHI6JUnU6VMw97cH0k6Gq0ypZoW5trXdnRC5aEg4jKKid84zKmAeTpj/iMuagyb/a5msJstIVboynRtfDHR0J8WWhfSU2wzqKAb6L66iyRe62Fe8OGzLhk2+KNU= env: global: - secure: WFFcjwBIRBG2zyk4c8Ugq0tgI1YaH/+s5eV9h3i2kR1ggobT+nrNqn3hCOkmPtwGYPBNjVj6yp+7qy//MRe8AS2eo1XuMD/P4MYcDGmZiMnqPhz1UsLltGTYlh3y6jl9DJvNujFBQMnAu/ey2g/iWrcHdtl2qninvN3wOrXi2Bs= - secure: bvBaKoV5wBj2eQb4Zx8E2NaBDsMOyuHczRByVLNX5YqeuRWL9kcsUYzAUshFpd2GFa4tzfnSLKCp0+h3T4Uei5e8CjV5dx0VFmijXoZif0OJplRaJ+S3dJSluTV04NoE4u6l5Pg6kkFTMnAaApKVB4je2nSlgvrm/tuavhd9i0M= - secure: akshyW92CqV3Wt+rzQ3ScxIG55ILEaiwQ011rNF1kCXTds5HrHOGy++4VEidaTpems8OQH2+hCLK5r/7FXXgRQEV/TRYRGhp/y9mwqdioyDQ1D0yA3f42NWGNDGg2yOTTbhqQFJg394LDMiLmnevoiajEVIH+Ksr5bV/cIJc4Tc= diff --git a/Gemfile b/Gemfile index 4adb566..61eef4a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,54 +1,58 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do gem 'puppet', (ENV['PUPPET_VERSION'] || '~> 6.0'), :require => false gem 'metadata-json-lint' gem 'specinfra', '~> 2.60' gem 'xmlrpc' gem 'ci_reporter_rspec' gem 'facter' gem 'pry' gem 'puppet-lint' gem 'puppet-strings' gem 'puppet-syntax' gem 'puppetlabs_spec_helper', '>= 2.7.0' gem 'rake' gem 'rspec', '~> 3.0' gem 'rspec-puppet', '~> 2.6' gem 'rspec-puppet-facts' gem 'rspec-puppet-utils' gem 'rspec-retry' # Required to test against Ruby 1.9 gem 'rubocop', '~> 0.41.2' gem 'rubysl-securerandom' gem 'webmock' # Extra Puppet-lint gems gem 'puppet-lint-appends-check', :git => 'https://github.com/voxpupuli/puppet-lint-appends-check', :ref => '07be8ce22d69353db055820b60bb77fe020238a6', :require => false gem 'puppet-lint-empty_string-check', :require => false gem 'puppet-lint-file_ensure-check', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-param-docs', :require => false gem 'puppet-lint-trailing_comma-check', :require => false gem 'puppet-lint-undef_in_function-check', :require => false gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-version_comparison-check', :require => false end group :development do gem 'puppet-blacksmith' end group :system_tests do gem 'bcrypt' - gem 'beaker', '~> 3.7' + gem 'beaker', '>= 4.2.0' gem 'beaker-rspec', '~> 6.0' + gem 'beaker-docker' + gem 'beaker-puppet' + gem 'beaker-puppet_install_helper' + gem 'simp-beaker-helpers' gem 'docker-api', '~> 1.0' gem 'infrataster' gem 'vault' end diff --git a/spec/acceptance/nodesets/amazonlinux-1-x64.yml b/spec/acceptance/nodesets/amazonlinux-1-x64.yml index 374f83c..21f449a 100644 --- a/spec/acceptance/nodesets/amazonlinux-1-x64.yml +++ b/spec/acceptance/nodesets/amazonlinux-1-x64.yml @@ -1,13 +1,14 @@ HOSTS: amazonlinux-1-x64: roles: + - agent - master platform: el-6-x86_64 image: amazonlinux:1 hypervisor: docker docker_cmd: ["/sbin/init"] docker_container_name: amazonlinux-1-x64 docker_preserve_image: true docker_image_commands: - rm /etc/init/tty.conf - yum install -y java-1.8.0-openjdk-headless rubygems20 tar wget which diff --git a/spec/acceptance/nodesets/amazonlinux-2-x64.yml b/spec/acceptance/nodesets/amazonlinux-2-x64.yml index 0f40344..2aceb47 100644 --- a/spec/acceptance/nodesets/amazonlinux-2-x64.yml +++ b/spec/acceptance/nodesets/amazonlinux-2-x64.yml @@ -1,17 +1,18 @@ HOSTS: amazonlinux-2-x64: roles: + - agent - master platform: el-7-x86_64 image: amazonlinux:2 hypervisor: docker docker_cmd: ["/sbin/init"] docker_preserve_image: true docker_image_commands: - yum install -y java-1.8.0-openjdk-headless net-tools wget which cronie iproute - mkdir -p /etc/selinux/targeted/contexts/ - echo '' > /etc/selinux/targeted/contexts/dbus_contexts - rm /lib/systemd/system/systemd*udev* - rm /lib/systemd/system/getty.target CONFIG: log_level: warn diff --git a/spec/acceptance/nodesets/centos-6-x64.yml b/spec/acceptance/nodesets/centos-6-x64.yml index 9f8acba..40b294b 100644 --- a/spec/acceptance/nodesets/centos-6-x64.yml +++ b/spec/acceptance/nodesets/centos-6-x64.yml @@ -1,18 +1,19 @@ HOSTS: centos-6-x64: roles: - master + - agent - database - dashboard platform: el-6-x86_64 image: centos:6.9 hypervisor: docker docker_cmd: ["/sbin/init"] docker_preserve_image: true docker_image_commands: - yum install -y wget tar which java-1.8.0-openjdk-headless - rm /etc/init/tty.conf - echo -e "elasticsearch hard nproc 4096\nelasticsearch soft nproc 4096" >> /etc/security/limits.conf - echo -e "esuser hard nproc 4096\nesuser soft nproc 4096" >> /etc/security/limits.conf CONFIG: log_level: warn diff --git a/spec/acceptance/nodesets/centos-7-x64.yml b/spec/acceptance/nodesets/centos-7-x64.yml index a61cfe3..dc95ee4 100644 --- a/spec/acceptance/nodesets/centos-7-x64.yml +++ b/spec/acceptance/nodesets/centos-7-x64.yml @@ -1,19 +1,20 @@ HOSTS: centos-7-x64: roles: + - agent - master - database - dashboard platform: el-7-x86_64 image: centos:7 hypervisor: docker docker_cmd: ["/sbin/init"] docker_preserve_image: true docker_image_commands: - yum install -y wget which cronie iproute - mkdir -p /etc/selinux/targeted/contexts/ - echo '' > /etc/selinux/targeted/contexts/dbus_contexts - rm /lib/systemd/system/systemd*udev* - rm /lib/systemd/system/getty.target CONFIG: log_level: warn diff --git a/spec/acceptance/nodesets/centos-8-x64.yml b/spec/acceptance/nodesets/centos-8-x64.yml new file mode 100644 index 0000000..03033d4 --- /dev/null +++ b/spec/acceptance/nodesets/centos-8-x64.yml @@ -0,0 +1,20 @@ +HOSTS: + centos-8-x64: + roles: + - agent + - master + - database + - dashboard + platform: el-8-x86_64 + image: centos:8 + hypervisor: docker + docker_cmd: ["/sbin/init"] + docker_preserve_image: true + docker_image_commands: + - yum install -y wget which cronie iproute + # - mkdir -p /etc/selinux/targeted/contexts/ + # - echo '' > /etc/selinux/targeted/contexts/dbus_contexts + # - rm /lib/systemd/system/systemd*udev* + # - rm /lib/systemd/system/getty.target +CONFIG: + log_level: warn diff --git a/spec/acceptance/nodesets/debian-10-x64.yml b/spec/acceptance/nodesets/debian-10-x64.yml new file mode 100644 index 0000000..20faebd --- /dev/null +++ b/spec/acceptance/nodesets/debian-10-x64.yml @@ -0,0 +1,17 @@ +HOSTS: + debian-10: + roles: + - agent + platform: debian-10-amd64 + image: debian:10 + hypervisor: docker + docker_cmd: ["/bin/systemd"] + docker_preserve_image: true + docker_image_commands: + - apt-get install -yq apt-transport-https wget net-tools gpg ruby-augeas software-properties-common + - wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - + - add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ + - apt update && apt-get install -yq adoptopenjdk-8-hotspot +CONFIG: + log_level: warn + diff --git a/spec/acceptance/nodesets/debian-8-x64.yml b/spec/acceptance/nodesets/debian-8-x64.yml index f010972..766a414 100644 --- a/spec/acceptance/nodesets/debian-8-x64.yml +++ b/spec/acceptance/nodesets/debian-8-x64.yml @@ -1,22 +1,23 @@ HOSTS: debian-8: roles: + - agent - master - database - dashboard platform: debian-8-amd64 image: debian:8.11 hypervisor: docker docker_cmd: ["/bin/systemd"] docker_preserve_image: true docker_image_commands: - echo 'deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main' >> /etc/apt/sources.list - echo 'Acquire::Check-Valid-Until "false";' >> /etc/apt/apt.conf - sed -i '/jessie.updates/d' /etc/apt/sources.list - apt-get update - apt-get install -yq -t jessie-backports openjdk-8-jre-headless - apt-get install -yq wget net-tools apt-transport-https - rm /lib/systemd/system/systemd*udev* - rm /lib/systemd/system/getty.target CONFIG: log_level: warn diff --git a/spec/acceptance/nodesets/oracle-6-x64.yml b/spec/acceptance/nodesets/oracle-6-x64.yml index de7c8d9..f492d67 100644 --- a/spec/acceptance/nodesets/oracle-6-x64.yml +++ b/spec/acceptance/nodesets/oracle-6-x64.yml @@ -1,18 +1,19 @@ HOSTS: centos-6-x64: roles: + - agent - master - database - dashboard platform: el-6-x86_64 image: oraclelinux:6 hypervisor: docker docker_cmd: ["/sbin/init"] docker_preserve_image: true docker_image_commands: - yum install -y tar wget which java-1.8.0-openjdk-headless - rm /etc/init/tty.conf - echo -e "elasticsearch hard nproc 4096\nelasticsearch soft nproc 4096" >> /etc/security/limits.conf - echo -e "esuser hard nproc 4096\nesuser soft nproc 4096" >> /etc/security/limits.conf CONFIG: log_level: warn diff --git a/spec/acceptance/nodesets/oracle-7-x64.yml b/spec/acceptance/nodesets/oracle-7-x64.yml index c868ae7..43c777f 100644 --- a/spec/acceptance/nodesets/oracle-7-x64.yml +++ b/spec/acceptance/nodesets/oracle-7-x64.yml @@ -1,19 +1,20 @@ HOSTS: oracle-7-x64: roles: + - agent - master - database - dashboard platform: el-7-x86_64 image: oraclelinux:7 hypervisor: docker docker_cmd: ["/sbin/init"] docker_preserve_image: true docker_image_commands: - yum install -y wget which cronie - mkdir -p /etc/selinux/targeted/contexts/ - echo '' > /etc/selinux/targeted/contexts/dbus_contexts - rm /lib/systemd/system/systemd*udev* - rm /lib/systemd/system/getty.target CONFIG: log_level: warn diff --git a/spec/acceptance/nodesets/sles-11-x64.yml b/spec/acceptance/nodesets/sles-11-x64.yml index fd4279d..80f8309 100644 --- a/spec/acceptance/nodesets/sles-11-x64.yml +++ b/spec/acceptance/nodesets/sles-11-x64.yml @@ -1,18 +1,19 @@ HOSTS: sles-11-x64: roles: + - agent - master - database - dashboard platform: sles-11-x64 image: dliappis/sles:11sp4 hypervisor: docker docker_cmd: ["/sbin/init"] docker_preserve_image: true docker_image_commands: - gem uninstall puppet hiera - zypper install -y augeas augeas-lenses pkgconfig - mkdir -p /etc/puppetlabs/code /etc/puppet/modules - ln -sf /etc/puppet/modules /etc/puppetlabs/code/modules CONFIG: log_level: warn diff --git a/spec/acceptance/nodesets/sles-12-x64.yml b/spec/acceptance/nodesets/sles-12-x64.yml index fa34b57..a2c5cc0 100644 --- a/spec/acceptance/nodesets/sles-12-x64.yml +++ b/spec/acceptance/nodesets/sles-12-x64.yml @@ -1,19 +1,20 @@ HOSTS: sles-12-x64: roles: + - agent - master - database - dashboard platform: sles-12-x86_64 image: dliappis/sles:12 hypervisor: docker docker_cmd: ["/sbin/init"] docker_preserve_image: true docker_image_commands: - rm /etc/zypp/repos.d/devel_languages_python.repo - gem uninstall -x puppet hiera - zypper clean -a - zypper install --force-resolution -y augeas which - ln -s /usr/lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service CONFIG: log_level: warn diff --git a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml deleted file mode 100644 index 827f0ba..0000000 --- a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml +++ /dev/null @@ -1,18 +0,0 @@ -HOSTS: - ubuntu-12-04: - roles: - - master - - database - - dashboard - platform: ubuntu-12.04-amd64 - image: ubuntu:12.04 - hypervisor: docker - docker_cmd: ["/sbin/init"] - docker_preserve_image: true - docker_image_commands: - - apt-get install -yq libssl-dev net-tools - - ln -sf /sbin/initctl.distrib /sbin/initctl - - locale-gen en_US en_US.UTF-8 - - dpkg-reconfigure locales -CONFIG: - log_level: warn diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml index 4db5ccc..6dea31b 100644 --- a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -1,23 +1,24 @@ HOSTS: ubuntu-14-04: roles: + - agent - master - database - dashboard platform: ubuntu-14.04-amd64 image: ubuntu:14.04.5 hypervisor: docker docker_cmd: ["/sbin/init"] docker_preserve_image: true docker_image_commands: - apt-get update - apt-get install -yq apt-transport-https libssl-dev software-properties-common - add-apt-repository -y ppa:openjdk-r/ppa - apt-get update - apt-get install -y openjdk-8-jre-headless - update-ca-certificates -f - ln -sf /sbin/initctl.distrib /sbin/initctl - locale-gen en_US en_US.UTF-8 - dpkg-reconfigure locales CONFIG: log_level: warn diff --git a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml index 7af781c..6a665dc 100644 --- a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml +++ b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml @@ -1,16 +1,17 @@ HOSTS: ubuntu-16-04: roles: + - agent - master - database - dashboard platform: ubuntu-16.04-amd64 image: ubuntu:16.04 hypervisor: docker docker_cmd: ["/sbin/init"] docker_preserve_image: true docker_image_commands: - apt-get update - - apt-get install -yq libssl-dev puppet apt-transport-https + - apt-get install -yq libssl-dev apt-transport-https CONFIG: log_level: warn diff --git a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1804-x64.yml similarity index 57% copy from spec/acceptance/nodesets/ubuntu-server-1604-x64.yml copy to spec/acceptance/nodesets/ubuntu-server-1804-x64.yml index 7af781c..16b3bcc 100644 --- a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml +++ b/spec/acceptance/nodesets/ubuntu-server-1804-x64.yml @@ -1,16 +1,17 @@ HOSTS: - ubuntu-16-04: + ubuntu-18-04: roles: + - agent - master - database - dashboard - platform: ubuntu-16.04-amd64 - image: ubuntu:16.04 + platform: ubuntu-18.04-amd64 + image: ubuntu:18.04 hypervisor: docker docker_cmd: ["/sbin/init"] docker_preserve_image: true docker_image_commands: - apt-get update - - apt-get install -yq libssl-dev puppet apt-transport-https + - apt-get install -yq libssl-dev apt-transport-https openjdk-8-jdk iproute2 CONFIG: log_level: warn diff --git a/spec/helpers/acceptance/tests/hiera_shared_examples.rb b/spec/helpers/acceptance/tests/hiera_shared_examples.rb index 40b43ea..e56e64c 100644 --- a/spec/helpers/acceptance/tests/hiera_shared_examples.rb +++ b/spec/helpers/acceptance/tests/hiera_shared_examples.rb @@ -1,124 +1,109 @@ require 'tempfile' require 'helpers/acceptance/tests/basic_shared_examples' require 'helpers/acceptance/tests/plugin_shared_examples' -shared_examples 'hiera tests with' do |yamlname, instances, additional_yaml = {}| - before :all do - Tempfile.create([yamlname, '.yaml']) do |temp| - temp << { - 'elasticsearch::instances' => instances - }.merge(additional_yaml).to_yaml - temp.flush +agents = only_host_with_role(hosts, 'agent') - File.basename(temp.path).tap do |config| - scp_to( - default, - temp.path, - File.join(hiera_datadir(default), config) - ) - write_hiera_config([config]) - end - end +shared_examples 'hiera tests with' do |instances, additional_yaml = {}| + hieradata = { + 'elasticsearch::instances' => instances + }.merge(additional_yaml).to_yaml + + before :all do + write_hieradata_to(agents, hieradata) end include_examples( 'basic acceptance tests', instances ) end shared_examples 'hiera acceptance tests' do |plugins| describe 'hiera', :then_purge do - before :all do - shell "mkdir -p #{hiera_datadir(default)}" - end - let(:skip_instance_manifests) { true } let(:manifest_class_parameters) { 'restart_on_change => true' } describe 'with one instance' do include_examples( 'hiera tests with', - 'singleinstance', 'es-hiera-single' => { 'config' => { 'node.name' => 'es-hiera-single', 'http.port' => 9200 } } ) end plugins.each_pair do |plugin, _meta| describe "with plugin #{plugin}" do include_examples( 'hiera tests with', - 'singleplugin', { 'es-hiera-single' => { 'config' => { 'node.name' => 'es-hiera-single', 'http.port' => 9200 } } }, 'elasticsearch::plugins' => { plugin => { 'ensure' => 'present', 'instances' => [ 'es-hiera-single' ] } } ) include_examples( 'plugin API response', { 'es-hiera-single' => { 'config' => { 'node.name' => 'es-hiera-single', 'http.port' => 9200 } } }, 'installs the plugin', 'name' => plugin ) end end describe 'with two instances' do include_examples( 'hiera tests with', - 'multipleinstances', 'es-hiera-multiple-1' => { 'config' => { 'node.name' => 'es-hiera-multiple-1', 'http.bind_host' => '0.0.0.0', 'http.port' => 9201 } }, 'es-hiera-multiple-2' => { 'config' => { 'node.name' => 'es-hiera-multiple-2', 'http.bind_host' => '0.0.0.0', 'http.port' => 9202 } } ) end after :all do - write_hiera_config([]) + write_hieradata_to(agents, {}) apply_manifest <<-EOS class { 'elasticsearch': ensure => 'absent', oss => #{v[:oss]} } Elasticsearch::Instance { ensure => 'absent' } elasticsearch::instance { 'es-hiera-single': } elasticsearch::instance { 'es-hiera-multiple-1': } elasticsearch::instance { 'es-hiera-multiple-2': } EOS end end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 6303656..3fe4fa0 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,283 +1,257 @@ require 'beaker-rspec' +require 'beaker/puppet_install_helper' require 'securerandom' require 'thread' require 'infrataster/rspec' require 'rspec/retry' require 'vault' +require 'simp/beaker_helpers' +include Simp::BeakerHelpers + require_relative 'spec_helper_tls' require_relative 'spec_utilities' require_relative '../lib/puppet_x/elastic/deep_to_i' require_relative '../lib/puppet_x/elastic/deep_to_s' -def f - RSpec.configuration.fact -end +# def f +# RSpec.configuration.fact +# end + +run_puppet_install_helper('agent') unless ENV['BEAKER_provision'] == 'no' RSpec.configure do |c| # General-purpose spec-global variables c.add_setting :v, :default => {} unless ENV['snapshot_version'].nil? v[:snapshot_version] = ENV['snapshot_version'] v[:is_snapshot] = ENV['SNAPSHOT_TEST'] == 'true' end unless ENV['ELASTICSEARCH_VERSION'].nil? and v[:snapshot_version].nil? v[:elasticsearch_full_version] = ENV['ELASTICSEARCH_VERSION'] || v[:snapshot_version] v[:elasticsearch_major_version] = v[:elasticsearch_full_version].split('.').first.to_i v[:elasticsearch_package] = {} v[:template] = if v[:elasticsearch_major_version] < 6 JSON.load(File.new('spec/fixtures/templates/pre_6.0.json')) elsif v[:elasticsearch_major_version] >= 8 JSON.load(File.new('spec/fixtures/templates/post_8.0.json')) else JSON.load(File.new('spec/fixtures/templates/post_6.0.json')) end v[:template] = Puppet_X::Elastic.deep_to_i(Puppet_X::Elastic.deep_to_s(v[:template])) v[:pipeline] = JSON.load(File.new('spec/fixtures/pipelines/example.json')) v[:elasticsearch_plugins] = Dir[ artifact("*#{v[:elasticsearch_full_version]}.zip", ['plugins']) ].map do |plugin| plugin_filename = File.basename(plugin) plugin_name = plugin_filename.match(/^(?.+)-#{v[:elasticsearch_full_version]}.zip/)[:name] [ plugin_name, { :path => plugin, :url => derive_plugin_urls_for(v[:elasticsearch_full_version], [plugin_name]).keys.first } ] end.to_h end v[:oss] = (not ENV['OSS_PACKAGE'].nil?) and ENV['OSS_PACKAGE'] == 'true' v[:cluster_name] = SecureRandom.hex(10) # rspec-retry c.display_try_failure_messages = true c.default_sleep_interval = 10 # General-case retry keyword for unstable tests c.around :each, :with_retries do |example| example.run_with_retry retry: 4 end # More forgiving retry config for really flaky tests c.around :each, :with_generous_retries do |example| example.run_with_retry retry: 10 end # Helper hook for module cleanup c.after :context, :with_cleanup do apply_manifest <<-EOS class { 'elasticsearch': ensure => 'absent', manage_repo => true, oss => #{v[:oss]}, } elasticsearch::instance { 'es-01': ensure => 'absent' } file { '/usr/share/elasticsearch/plugin': ensure => 'absent', force => true, recurse => true, require => Class['elasticsearch'], } EOS end c.before :context, :with_certificates do @keystore_password = SecureRandom.hex @role = [*('a'..'z')].sample(8).join # Setup TLS cert placement @tls = gen_certs(2, '/tmp') create_remote_file hosts, @tls[:ca][:cert][:path], @tls[:ca][:cert][:pem] @tls[:clients].each do |node| node.each do |_type, params| create_remote_file hosts, params[:path], params[:pem] end end end c.before :context, :with_license do Vault.address = ENV['VAULT_ADDR'] Vault.auth.approle ENV['VAULT_APPROLE_ROLE_ID'], ENV['VAULT_APPROLE_SECRET_ID'] licenses = Vault.with_retries(Vault::HTTPConnectionError) do Vault.logical.read(ENV['VAULT_PATH']) end.data raise 'No license found!' unless licenses license = case v[:elasticsearch_major_version] when 2 licenses[:v2] else licenses[:v5] end create_remote_file hosts, '/tmp/license.json', license v[:elasticsearch_license_path] = '/tmp/license.json' end c.after :context, :then_purge do shell 'rm -rf {/usr/share,/etc,/var/lib}/elasticsearch*' end c.before :context, :first_purge do shell 'rm -rf {/usr/share,/etc,/var/lib}/elasticsearch*' end # Provide a hook filter to spit out some ES logs if the example fails. c.after(:example, :logs_on_failure) do |example| if example.exception hosts.each do |host| on host, "find / -name '#{v[:cluster_name]}.log' | xargs cat || true" do |result| puts result.formatted_output end end end end end files_dir = ENV['files_dir'] || './spec/fixtures/artifacts' # General bootstrapping steps for each host hosts.each do |host| - # Set the host to 'aio' in order to adopt the puppet-agent style of - # installation, and configure paths/etc. - host[:type] = 'aio' - configure_defaults_on host, 'aio' - - # Install Puppet - # - # We spawn a thread to print dots periodically while installing puppet to - # avoid inactivity timeouts in Travis. Don't judge me. - progress = Thread.new do - print 'Installing puppet..' - print '.' while sleep 5 - end + # # Set the host to 'aio' in order to adopt the puppet-agent style of + # # installation, and configure paths/etc. + # host[:type] = 'aio' + # configure_defaults_on host, 'aio' - case host.name - when /debian-9/ - # A few special cases need to be installed from gems (if the distro is - # very new and has no puppet repo package or has no upstream packages). - install_puppet_from_gem( - host, - version: Gem.loaded_specs['puppet'].version - ) - else - # Otherwise, just use the all-in-one agent package. - install_puppet_agent_on( - host, - puppet_agent_version: to_agent_version(Gem.loaded_specs['puppet'].version) - ) - end - # Quit the print thread and include some debugging. - progress.exit - puts "done. Installed version #{shell('puppet --version').output}" - - RSpec.configure do |c| - c.add_setting :fact, :default => JSON.parse(fact('', '-j')) - end - - if f['os']['family'] == 'Suse' + if fact('os.family') == 'Suse' install_package host, '--force-resolution augeas-devel libxml2-devel ruby-devel' on host, 'gem install ruby-augeas --no-ri --no-rdoc' end - v[:ext] = case f['os']['family'] + v[:ext] = case fact('os.family') when 'Debian' 'deb' else 'rpm' end if v[:elasticsearch_package] v[:elasticsearch_package].merge!( derive_full_package_url( v[:elasticsearch_full_version], [v[:ext]] ).flat_map do |url, filename| [[:url, url], [:filename, filename], [:path, artifact(filename)]] end.to_h ) end Infrataster::Server.define(:docker) do |server| server.address = host[:ip] server.ssh = host[:ssh].tap { |s| s.delete :forward_agent } end Infrataster::Server.define(:container) do |server| server.address = host[:vm_ip] # this gets ignored anyway server.from = :docker end end RSpec.configure do |c| if v[:is_snapshot] c.before :suite do scp_to default, "#{files_dir}/elasticsearch-snapshot.#{v[:ext]}", "/tmp/elasticsearch-snapshot.#{v[:ext]}" v[:snapshot_package] = "file:/tmp/elasticsearch-snapshot.#{v[:ext]}" end end c.before :suite do # Install module and dependencies install_dev_puppet_module :ignore_list => [ 'junit' ] + Beaker::DSL::InstallUtils::ModuleUtils::PUPPET_MODULE_INSTALL_IGNORE hosts.each do |host| modules = %w[archive augeas_core datacat java java_ks stdlib elastic_stack] dist_module = { 'Debian' => ['apt'], 'Suse' => ['zypprepo'], 'RedHat' => %w[concat yumrepo_core] - }[f['os']['family']] + }[fact('os.family')] modules += dist_module unless dist_module.nil? modules.each do |mod| copy_module_to( host, :module_name => mod, :source => "spec/fixtures/modules/#{mod}" ) end on(host, 'mkdir -p etc/puppet/modules/another/files/') # Apt doesn't update package caches sometimes, ensure we're caught up. - shell 'apt-get update' if f['os']['family'] == 'Debian' + shell 'apt-get update' if fact('os.family') == 'Debian' end # Use the Java class once before the suite of tests unless shell('command -v java', :accept_all_exit_codes => true).exit_code.zero? - java = case f['os']['name'] + java = case fact('os.name') when 'OpenSuSE' 'package => "java-1_8_0-openjdk-headless",' else '' end apply_manifest <<-MANIFEST class { "java" : distribution => "jre", #{java} } MANIFEST end end end -# Java 8 is only easy to manage on recent distros -def v5x_capable? - (f['os']['family'] == 'RedHat' and \ - not (f['os']['name'] == 'OracleLinux' and \ - f['os']['release']['major'] == '6')) or \ - f.dig 'os', 'distro', 'codename' == 'xenial' -end +# # Java 8 is only easy to manage on recent distros +# def v5x_capable? +# (fact('os.family') == 'RedHat' and \ +# not (fact('os.name') == 'OracleLinux' and \ +# f['os']['release']['major'] == '6')) or \ +# f.dig 'os', 'distro', 'codename' == 'xenial' +# end