diff --git a/.sync.yml b/.sync.yml index ca484a3..e2e45ff 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,21 +1,14 @@ --- .travis.yml: beaker_sets: - docker/centos-7 - docker/centos-6 - docker/debian-8 Rakefile: param_docs_pattern: - manifests/init.pp spec/spec_helper.rb: extra_code: | def unsupported_puppetmaster_osfamily(osfamily) ['Archlinux', 'windows', 'Suse'].include?(osfamily) end -spec/spec_helper_acceptance.rb: - modules: - - puppet-extlib - - puppetlabs-apache - - puppetlabs-concat - - puppetlabs-hocon - - puppetlabs-stdlib diff --git a/.travis.yml b/.travis.yml index a60fae3..0cee635 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,43 +1,38 @@ --- # This file is managed centrally by modulesync # https://github.com/theforeman/foreman-installer-modulesync rvm: - 2.1.5 + - 2.2.6 + - 2.3.0 + - 2.4.1 + env: matrix: - # First test the major distros - - PUPPET_VERSION=4.6 ONLY_OS=centos-6-x86_64,centos-7-x86_64,debian-7-x86_64,debian-8-x86_64,ubuntu-14-x86_64,ubuntu-14.04-x86_64,ubuntu-16-x86_64,ubuntu-16.04-x86_64 - # Test the rest of the supported platforms - - PUPPET_VERSION=4.6 EXCLUDE_OS=centos-6-x86_64,centos-7-x86_64,debian-7-x86_64,debian-8-x86_64,ubuntu-14-x86_64,ubuntu-14.04-x86_64,ubuntu-16-x86_64,ubuntu-16.04-x86_64,scientific-6-x86_64,scientific-7-x86_64 + - PUPPET_VERSION=4.9 matrix: fast_finish: true include: - - rvm: 2.2.6 - env: PUPPET_VERSION=4.6 ONLY_OS="debian-8-x86_64,centos-7-x86_64,ubuntu-16-x86_64,ubuntu-16.04-x86_64,freebsd-10-amd64,windows-2012 R2-x64" - - rvm: 2.3.0 - env: PUPPET_VERSION=4.6 ONLY_OS="debian-8-x86_64,centos-7-x86_64,ubuntu-16-x86_64,ubuntu-16.04-x86_64,freebsd-10-amd64,windows-2012 R2-x64" - rvm: 2.4.1 - env: PUPPET_VERSION=4.6 ONLY_OS="debian-8-x86_64,centos-7-x86_64,ubuntu-16-x86_64,ubuntu-16.04-x86_64,freebsd-10-amd64,windows-2012 R2-x64" - - rvm: 2.4.1 - env: PUPPET_VERSION=5.0 ONLY_OS="debian-8-x86_64,centos-7-x86_64,ubuntu-16-x86_64,ubuntu-16.04-x86_64,freebsd-10-amd64,windows-2012 R2-x64" + env: PUPPET_VERSION=5.0 # Acceptance tests - rvm: 2.3.1 dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7 script: bundle exec rake beaker services: docker bundler_args: --without development - rvm: 2.3.1 dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-6 script: bundle exec rake beaker services: docker bundler_args: --without development - rvm: 2.3.1 dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/debian-8 script: bundle exec rake beaker services: docker bundler_args: --without development bundler_args: --without system_tests development sudo: false diff --git a/Gemfile b/Gemfile index 0e14fb5..614b8b2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,37 +1,37 @@ # This file is managed centrally by modulesync # https://github.com/theforeman/foreman-installer-modulesync source 'https://rubygems.org' gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '>= 4.6' -gem 'facter', ENV.key?('FACTER_VERSION') ? "~> #{ENV['FACTER_VERSION']}" : '~> 2.4.6' gem 'rake' gem 'rspec', '~> 3.0' gem 'rspec-puppet', '~> 2.3' gem 'rspec-puppet-facts', '>= 1.7' gem 'puppetlabs_spec_helper', '>= 2.1.1' gem 'puppet-lint', '>= 2' gem 'puppet-lint-unquoted_string-check' gem 'puppet-lint-empty_string-check' gem 'puppet-lint-spaceship_operator_without_tag-check' gem 'puppet-lint-variable_contains_upcase' gem 'puppet-lint-absolute_classname-check' gem 'puppet-lint-undef_in_function-check' gem 'puppet-lint-leading_zero-check' gem 'puppet-lint-trailing_comma-check' gem 'puppet-lint-file_ensure-check' gem 'puppet-lint-param-docs', '>= 1.3.0' gem 'simplecov' gem 'puppet-blacksmith', '>= 3.1.0', {"groups"=>["development"]} gem 'json', '~> 1.0', {"platforms"=>["ruby_19"], "groups"=>["test"]} gem 'json_pure', '~> 1.0', {"platforms"=>["ruby_19"], "groups"=>["test"]} gem 'logging', '~> 2.1.0', {"platforms"=>["ruby_19"], "groups"=>["test"]} gem 'beaker-rspec', {"groups"=>["system_tests"]} +gem 'beaker-module_install_helper', {"groups"=>["system_tests"]} gem 'beaker-puppet_install_helper', {"groups"=>["system_tests"]} gem 'metadata-json-lint' gem 'kafo_module_lint' gem 'rgen' gem 'parallel_tests' # vim:ft=ruby diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 3839aad..f8b4ef7 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,42 +1,46 @@ require 'beaker-rspec/spec_helper' require 'beaker-rspec/helpers/serverspec' require 'beaker/puppet_install_helper' +require 'beaker/module_install_helper' run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' +install_module_on(hosts) +install_module_dependencies_on(hosts) 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 - puppet_module_install(:source => proj_root, :module_name => 'puppet') hosts.each do |host| - ['puppet-extlib', 'puppetlabs-apache', 'puppetlabs-concat', 'puppetlabs-hocon', 'puppetlabs-stdlib'].each do |mod| - on host, puppet('module', 'install', mod), { :acceptable_exit_codes => [0] } - end - if fact_on(host, 'osfamily') == 'RedHat' # don't delete downloaded rpm for use with BEAKER_provision=no + # BEAKER_destroy=no on host, 'sed -i "s/keepcache=.*/keepcache=1/" /etc/yum.conf' # refresh check if cache needs refresh on next yum command on host, 'yum clean expire-cache' end end end end shared_examples 'a idempotent resource' do it 'applies with no errors' do apply_manifest(pp, catch_failures: true) end it 'applies a second time without changes' do apply_manifest(pp, catch_changes: true) end end + +shared_examples 'the example' do |name| + let(:pp) do + path = File.join(File.dirname(File.dirname(__FILE__)), 'examples', name) + File.read(path) + end + + include_examples 'a idempotent resource' +end