Skip to content

Commit

Permalink
run acceptance tests on each spec file
Browse files Browse the repository at this point in the history
this will execute each of them in their own container
  • Loading branch information
bastelfreak committed Mar 3, 2018
1 parent d3045fb commit c0cb2d0
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 59 deletions.
58 changes: 45 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
56 changes: 29 additions & 27 deletions spec/acceptance/php56_spec.rb
Original file line number Diff line number Diff line change
@@ -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
40 changes: 21 additions & 19 deletions spec/acceptance/php_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c0cb2d0

Please sign in to comment.