From 6ca17a43872cc6c43948639a921817acd72adfc1 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 3 Feb 2018 14:22:34 +0100 Subject: [PATCH 1/7] add tests for php5.6 --- spec/acceptance/php56_spec.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 spec/acceptance/php56_spec.rb diff --git a/spec/acceptance/php56_spec.rb b/spec/acceptance/php56_spec.rb new file mode 100644 index 00000000..228ee0d4 --- /dev/null +++ b/spec/acceptance/php56_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper_acceptance' + +describe 'with specific php version' do + it 'works with 5.6' do + pp = <<-EOS + class { 'php::globals': + php_version => '5.6', + } + -> class { 'php': + ensure => 'present', + manage_repos => true, + fpm => true, + dev => true, + composer => true, + pear => true, + phpunit => false, + } + EOS + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + case default[:platform] + when %r{16.04} + describe package('php5.6-fpm') do + it { is_expected.to be_installed } + end + when %r{14.04} + describe package('php5.6-fpm') do + it { is_expected.to be_installed } + end + end +end From d3045fb766130dabce4f0b14929b48dcb4eca8d1 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 17 Feb 2018 12:38:40 +0100 Subject: [PATCH 2/7] fix the ubuntu16.04 nodeset this will go upstream into modulesync_config --- spec/acceptance/nodesets/docker/ubuntu-16.04.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml index 2d173c5b..da996956 100644 --- a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml +++ b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml @@ -10,8 +10,11 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: + - 'systemctl mask getty@tty1.service getty-static.service' + - 'apt-get update' - 'apt-get install -y net-tools wget locales apt-transport-https' - 'locale-gen en_US.UTF-8' + - 'echo LANG=en_US.UTF-8 > /etc/default/locale' CONFIG: trace_limit: 200 masterless: true From c0cb2d072df4c9ebffc2ad0e891fb90e0ec28e7a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 17 Feb 2018 14:40:52 +0100 Subject: [PATCH 3/7] run acceptance tests on each spec file this will execute each of them in their own container --- .travis.yml | 58 +++++++++++++++++++++++++++-------- spec/acceptance/php56_spec.rb | 56 +++++++++++++++++---------------- spec/acceptance/php_spec.rb | 40 ++++++++++++------------ 3 files changed, 95 insertions(+), 59 deletions(-) diff --git a/.travis.yml b/.travis.yml index 94cb977d..124d7af6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,41 +12,73 @@ matrix: include: - rvm: 2.1.9 bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=12 + env: PUPPET_VERSION="~> 4.0" CHECK="test" PARALLEL_TEST_PROCESSORS=12 - rvm: 2.4.3 bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls + env: PUPPET_VERSION="~> 5.0" CHECK="test_with_coveralls" - rvm: 2.5.0 bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls + env: PUPPET_VERSION="~> 5.0" CHECK="test_with_coveralls" - rvm: 2.4.3 bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=rubocop + env: PUPPET_VERSION="~> 5.0" CHECK="rubocop" - rvm: 2.4.3 bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.4.2 + env: PUPPET_VERSION="~> 5.0" CHECK="build" DEPLOY_TO_FORGE=yes + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04 + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04 CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04 + script: 'bundle exec rspec spec/acceptance/php_spec.rb' services: docker sudo: require - - rvm: 2.4.2 + - rvm: 2.4.3 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 + script: 'bundle exec rspec spec/acceptance/php_spec.rb' services: docker sudo: require - - rvm: 2.4.2 + - rvm: 2.4.3 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 + script: 'bundle exec rspec spec/acceptance/php_spec.rb' services: docker sudo: require - - rvm: 2.4.2 + - rvm: 2.4.3 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 + script: 'bundle exec rspec spec/acceptance/php_spec.rb' services: docker sudo: require branches: diff --git a/spec/acceptance/php56_spec.rb b/spec/acceptance/php56_spec.rb index 228ee0d4..2d07bb25 100644 --- a/spec/acceptance/php56_spec.rb +++ b/spec/acceptance/php56_spec.rb @@ -1,34 +1,36 @@ require 'spec_helper_acceptance' describe 'with specific php version' do - it 'works with 5.6' do - pp = <<-EOS - class { 'php::globals': - php_version => '5.6', - } - -> class { 'php': - ensure => 'present', - manage_repos => true, - fpm => true, - dev => true, - composer => true, - pear => true, - phpunit => false, - } - EOS - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - - case default[:platform] - when %r{16.04} - describe package('php5.6-fpm') do - it { is_expected.to be_installed } + context 'with params' do + it 'works with 5.6' do + pp = <<-EOS + class { 'php::globals': + php_version => '5.6', + } + -> class { 'php': + ensure => 'present', + manage_repos => true, + fpm => true, + dev => true, + composer => true, + pear => true, + phpunit => false, + } + EOS + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) end - when %r{14.04} - describe package('php5.6-fpm') do - it { is_expected.to be_installed } + + case default[:platform] + when %r{16.04} + describe package('php5.6-fpm') do + it { is_expected.to be_installed } + end + when %r{14.04} + describe package('php5.6-fpm') do + it { is_expected.to be_installed } + end end end end diff --git a/spec/acceptance/php_spec.rb b/spec/acceptance/php_spec.rb index f7e3263b..95b99686 100644 --- a/spec/acceptance/php_spec.rb +++ b/spec/acceptance/php_spec.rb @@ -1,25 +1,27 @@ require 'spec_helper_acceptance' -describe 'php' do - it 'works with defaults' do - pp = 'include php' - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - - case default[:platform] - when %r{16.04} - describe package('php7.0-fpm') do - it { is_expected.to be_installed } +describe 'php with default settings' do + context 'default parameters' do + it 'works with defaults' do + pp = 'include php' + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) end - when %r{14.04} - describe package('php5-fpm') do - it { is_expected.to be_installed } - end - when %(7) - describe package('php-fpm') do - it { is_expected.to be_installed } + + case default[:platform] + when %r{16.04} + describe package('php7.0-fpm') do + it { is_expected.to be_installed } + end + when %r{14.04} + describe package('php5-fpm') do + it { is_expected.to be_installed } + end + when %(7) + describe package('php-fpm') do + it { is_expected.to be_installed } + end end end end From 3412e96c6dca55866b6db7858c9f8469b6ac2777 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 23 Feb 2018 00:28:24 +0100 Subject: [PATCH 4/7] add acceptance tests to modulesync config --- .sync.yml | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/.sync.yml b/.sync.yml index 70edc3fc..c80a1646 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,8 +1,60 @@ --- .travis.yml: - docker_sets: - - set: docker/ubuntu-16.04 - - set: docker/ubuntu-14.04 - - set: docker/centos-7 - - set: docker/debian-8 + extras: + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04 + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04 + script: 'bundle exec rspec spec/acceptance/php_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 + script: 'bundle exec rspec spec/acceptance/php_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 + script: 'bundle exec rspec spec/acceptance/php_spec.rb' + services: docker + sudo: require + - rvm: 2.4.3 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 + script: 'bundle exec rspec spec/acceptance/php_spec.rb' + services: docker + sudo: require secure: "GOhttACuJt+3s38m4WnW5RuTgwqaAoeEQnNT+X1Ukn7KdcIk4KV8NzYU/CC0VIm8lUOnBWYJKEC4ixX/J/4Wbxox2RAoKMQrO++L0DB1zTCJnq9SfoUBMaQhXvLu+PbxAR0p3P47ozra0C+pOWDpOaxT9ecufrPQt9W9Z4aY/bs=" From eb6fcdb2c5210daf943605db99615bcea8c0e2cf Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 28 Feb 2018 00:05:21 +0100 Subject: [PATCH 5/7] use modulesync to generate acceptance tests --- .sync.yml | 82 +++++++++++++++++-------------------------------------- 1 file changed, 25 insertions(+), 57 deletions(-) diff --git a/.sync.yml b/.sync.yml index c80a1646..e2b2369a 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,60 +1,28 @@ --- .travis.yml: - extras: - - rvm: 2.4.3 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04 - script: 'bundle exec rspec spec/acceptance/php56_spec.rb' - services: docker - sudo: require - - rvm: 2.4.3 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 - script: 'bundle exec rspec spec/acceptance/php56_spec.rb' - services: docker - sudo: require - - rvm: 2.4.3 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 - script: 'bundle exec rspec spec/acceptance/php56_spec.rb' - services: docker - sudo: require - - rvm: 2.4.3 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 - script: 'bundle exec rspec spec/acceptance/php56_spec.rb' - services: docker - sudo: require - - rvm: 2.4.3 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-16.04 - script: 'bundle exec rspec spec/acceptance/php_spec.rb' - services: docker - sudo: require - - rvm: 2.4.3 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04 - script: 'bundle exec rspec spec/acceptance/php_spec.rb' - services: docker - sudo: require - - rvm: 2.4.3 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 - script: 'bundle exec rspec spec/acceptance/php_spec.rb' - services: docker - sudo: require - - rvm: 2.4.3 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 - script: 'bundle exec rspec spec/acceptance/php_spec.rb' - services: docker - sudo: require + docker_sets: + - set: docker/ubuntu-16.04 + options: + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + - set: docker/ubuntu-14.04 + options: + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + - set: docker/centos-7 + options: + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + - set: docker/debian-8 + options: + script: 'bundle exec rspec spec/acceptance/php56_spec.rb' + - set: docker/ubuntu-16.04 + options: + script: 'bundle exec rspec spec/acceptance/php_spec.rb' + - set: docker/ubuntu-14.04 + options: + script: 'bundle exec rspec spec/acceptance/php_spec.rb' + - set: docker/centos-7 + options: + script: 'bundle exec rspec spec/acceptance/php_spec.rb' + - set: docker/debian-8 + options: + script: 'bundle exec rspec spec/acceptance/php_spec.rb' secure: "GOhttACuJt+3s38m4WnW5RuTgwqaAoeEQnNT+X1Ukn7KdcIk4KV8NzYU/CC0VIm8lUOnBWYJKEC4ixX/J/4Wbxox2RAoKMQrO++L0DB1zTCJnq9SfoUBMaQhXvLu+PbxAR0p3P47ozra0C+pOWDpOaxT9ecufrPQt9W9Z4aY/bs=" From 4544b3bacde497fb8c0ee70b4d58f27989e4f5cf Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 28 Feb 2018 00:35:13 +0100 Subject: [PATCH 6/7] restructure php56 acceptance tests --- spec/acceptance/php56_spec.rb | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/spec/acceptance/php56_spec.rb b/spec/acceptance/php56_spec.rb index 2d07bb25..11d62505 100644 --- a/spec/acceptance/php56_spec.rb +++ b/spec/acceptance/php56_spec.rb @@ -1,6 +1,16 @@ require 'spec_helper_acceptance' describe 'with specific php version' do + case default[:platform] + when %r{ubuntu} + packagename = 'php5.6-fpm' + when %r{el} + # ell = Enterprise Linux = CentOS.... + packagename = 'php-fpm' + when %r{debian} + packagename = 'php5-fpm' + end + context 'with params' do it 'works with 5.6' do pp = <<-EOS @@ -17,20 +27,21 @@ class { 'php::globals': phpunit => false, } EOS + # Run it twice and test for idempotency apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end - case default[:platform] - when %r{16.04} - describe package('php5.6-fpm') do - it { is_expected.to be_installed } - end - when %r{14.04} - describe package('php5.6-fpm') do - it { is_expected.to be_installed } - end + describe package(packagename) do + it { is_expected.to be_installed } + end + describe service(packagename) do + it { is_expected.to be_running } + it { is_expected.to be_enabled } + end + describe command('php --version') do + its(:stdout) { is_expected.to match %r{5\.6} } end end end From 2b970d75d7b92943e7cc07310315d87beb0f23c7 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 6 Mar 2018 14:12:29 +0100 Subject: [PATCH 7/7] cleanup php7 acceptance test --- spec/acceptance/php_spec.rb | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/spec/acceptance/php_spec.rb b/spec/acceptance/php_spec.rb index 95b99686..36bc845b 100644 --- a/spec/acceptance/php_spec.rb +++ b/spec/acceptance/php_spec.rb @@ -10,18 +10,22 @@ end case default[:platform] - when %r{16.04} - describe package('php7.0-fpm') do - it { is_expected.to be_installed } - end - when %r{14.04} - describe package('php5-fpm') do - it { is_expected.to be_installed } - end - when %(7) - describe package('php-fpm') do - it { is_expected.to be_installed } - end + when %r{ubuntu-16.04} + packagename = 'php7.0-fpm' + when %r{ubuntu-14.04} + packagename = 'php5-fpm' + when %r{el} + packagename = 'php-fpm' + when %r{debian} + packagename = 'php5-fpm' + end + describe package(packagename) do + it { is_expected.to be_installed } + end + + describe service(packagename) do + it { is_expected.to be_running } + it { is_expected.to be_enabled } end end end