From 4e842c38823fdf19b786293a1a8544e739556963 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 25 Jul 2018 22:08:53 +0200 Subject: [PATCH 01/10] modulesync 1.9.4 --- .msync.yml | 2 +- .travis.yml | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.msync.yml b/.msync.yml index c39f6b7..1115a3f 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.9.3' +modulesync_config_version: '1.9.4' diff --git a/.travis.yml b/.travis.yml index a527ff4..840abb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,8 @@ sudo: false dist: trusty language: ruby cache: bundler -# related to https://github.com/rubygems/rubygems/issues/2123 before_install: - - 'rm -f Gemfile.lock' - - 'gem update --system' - - 'gem install bundler' + - rm -f Gemfile.lock script: - 'bundle exec rake $CHECK' matrix: From 2eaeb00ef0d7911cf5f4b900bce76d3c26e3b84d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 5 Sep 2018 13:45:15 +0200 Subject: [PATCH 02/10] modulesync 2.0.0 --- .msync.yml | 2 +- .overcommit.yml | 1 + .travis.yml | 48 ++++++++++++++++++++++++++++++++++++++++++------ Gemfile | 6 ++++-- 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/.msync.yml b/.msync.yml index 1115a3f..e1cef55 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.9.4' +modulesync_config_version: '2.0.0' diff --git a/.overcommit.yml b/.overcommit.yml index 31699e7..1b03fad 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -58,6 +58,7 @@ PrePush: enabled: true description: 'Run rake targets' targets: + - 'validate' - 'test' - 'rubocop' command: [ 'bundle', 'exec', 'rake' ] diff --git a/.travis.yml b/.travis.yml index 840abb3..36c9c66 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,37 +28,73 @@ matrix: - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian7-64{hypervisor=docker} CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian7-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker services: docker sudo: required branches: diff --git a/Gemfile b/Gemfile index 8da95fb..20f3df0 100644 --- a/Gemfile +++ b/Gemfile @@ -53,15 +53,17 @@ group :system_tests do end gem 'serverspec', :require => false gem 'beaker-hostgenerator', '>= 1.1.10', :require => false + gem 'beaker-docker', :require => false + gem 'beaker-puppet', :require => false gem 'beaker-puppet_install_helper', :require => false gem 'beaker-module_install_helper', :require => false - gem 'rbnacl', '~> 4', :require => false if RUBY_VERSION >= '2.2.6' + gem 'rbnacl', '>= 4', :require => false if RUBY_VERSION >= '2.2.6' gem 'rbnacl-libsodium', :require => false if RUBY_VERSION >= '2.2.6' gem 'bcrypt_pbkdf', :require => false end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator' if RUBY_VERSION >= '2.2.2' + gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' if RUBY_VERSION >= '2.2.2' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' gem 'puppet-strings', '>= 1.0', :require => false From 2fabd51965e358e15148b187c6381e124c2f60b4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 5 Sep 2018 13:51:14 +0200 Subject: [PATCH 03/10] update spec_helper_acceptance --- spec/spec_helper_acceptance.rb | 35 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index eb508cd..03b781d 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,27 +1,22 @@ -require 'beaker-rspec/spec_helper' -require 'beaker-rspec/helpers/serverspec' +require 'beaker-rspec' +require 'beaker-puppet' +require 'beaker/puppet_install_helper' +require 'beaker/module_install_helper' -version = ENV['PUPPET_VERSION'] || '1.5.2' -install_puppet_agent_on(hosts, puppet_agent_version: version) +run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' +install_ca_certs unless ENV['PUPPET_INSTALL_TYPE'] =~ %r{pe}i +install_module_on(hosts) +install_module_dependencies_on(hosts) RSpec.configure do |c| - 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 - puppet_module_install(source: proj_root, module_name: 'report_hipchat') - - # Install Dependencies - hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs-stdlib') - - # needed to test reporting - on host, puppet('module', 'install', 'camptocamp-puppetserver') - on host, puppet('module', 'install', 'puppetlabs-inifile') - on host, puppet('module', 'install', 'puppetlabs-puppetserver_gem') + hosts.each do |host| + if host[:platform] =~ %r{el-7-x86_64} && host[:hypervisor] =~ %r{docker} + on(host, "sed -i '/nodocs/d' /etc/yum.conf") end + install_module_from_forge('puppet-puppetserver', '>= 3.0.0 < 4.0.0') + install_module_from_forge('puppetlabs-inifile', '>= 2.3.0 < 3.0.0') + install_module_from_forge('puppetlabs-puppetserver_gem', '>= 1.0.0 < 2.0.0') end end From d94085d74145f24b84fb179fcb46ddfab300b4ce Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 5 Sep 2018 13:59:31 +0200 Subject: [PATCH 04/10] dont test on legacy debian 7 --- .sync.yml | 1 - .travis.yml | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/.sync.yml b/.sync.yml index 06af99f..e9a511d 100644 --- a/.sync.yml +++ b/.sync.yml @@ -3,7 +3,6 @@ docker_sets: - set: centos6-64 - set: centos7-64 - - set: debian7-64 - set: debian8-64 - set: ubuntu1404-64 - set: ubuntu1604-64 diff --git a/.travis.yml b/.travis.yml index 36c9c66..58c0432 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,18 +49,6 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian7-64{hypervisor=docker} CHECK=beaker - services: docker - sudo: required - - rvm: 2.5.1 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian7-64{hypervisor=docker} CHECK=beaker - services: docker - sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty From 5b7cd5885c657e83936f6ef6b58070aa3aeebbeb Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 13 Oct 2018 17:38:55 +0200 Subject: [PATCH 05/10] modulesync 2.2.0 --- .github/CONTRIBUTING.md | 75 ++++++++++++++++++++++++++++++++--------- .msync.yml | 2 +- .travis.yml | 38 ++++++++++++++++++--- Gemfile | 5 ++- spec/default_facts.yml | 1 - spec/spec_helper.rb | 19 +++++------ 6 files changed, 106 insertions(+), 34 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 496a5c0..832578e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -12,15 +12,20 @@ By participating in this project you agree to abide by its terms. 1. Create a separate branch for your change. -1. Run the tests. We only take pull requests with passing tests, and - documentation. +1. We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) + runs the tests for us. You can also execute them locally. This is explained + in a later section. + +1. Checkout [our docs](https://voxpupuli.org/docs/#reviewing-a-module-pr) we + use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). + They provide some guidance for new code that might help you before you submit a pull request. 1. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. 1. Squash your commits down into logical components. Make sure to rebase - against the current master. + against our current master. 1. Push the branch to your fork and submit a pull request. @@ -38,7 +43,9 @@ By default the tests use a baseline version of Puppet. If you have Ruby 2.x or want a specific version of Puppet, you must set an environment variable such as: - export PUPPET_VERSION="~> 4.2.0" +```sh +export PUPPET_VERSION="~> 5.5.6" +``` You can install all needed gems for spec tests into the modules directory by running: @@ -65,13 +72,17 @@ The test suite will run [Puppet Lint](http://puppet-lint.com/) and [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to check various syntax and style things. You can run these locally with: - bundle exec rake lint - bundle exec rake validate +```sh +bundle exec rake lint +bundle exec rake validate +``` It will also run some [Rubocop](http://batsov.com/rubocop/) tests against it. You can run those locally ahead of time with: - bundle exec rake rubocop +```sh +bundle exec rake rubocop +``` ## Running the unit tests @@ -82,15 +93,21 @@ about how best to test your new feature. To run the linter, the syntax checker and the unit tests: - bundle exec rake test +```sh +bundle exec rake test +``` To run your all the unit tests - bundle exec rake spec SPEC_OPTS='--format documentation' +```sh +bundle exec rake spec +``` To run a specific spec test set the `SPEC` variable: - bundle exec rake spec SPEC=spec/foo_spec.rb +```sh +bundle exec rake spec SPEC=spec/foo_spec.rb +``` ## Integration tests @@ -102,23 +119,51 @@ This fires up a new virtual machine (using vagrant) and runs a series of simple tests against it after applying the module. You can run this with: - bundle exec rake acceptance +```sh +bundle exec rake acceptance +``` This will run the tests on the module's default nodeset. You can override the nodeset used, e.g., - BEAKER_set=centos-7-x64 bundle exec rake acceptance +```sh +BEAKER_set=centos-7-x64 bundle exec rake acceptance +``` There are default rake tasks for the various acceptance test modules, e.g., - bundle exec rake beaker:centos-7-x64 - bundle exec rake beaker:ssh:centos-7-x64 +```sh +bundle exec rake beaker:centos-7-x64 +bundle exec rake beaker:ssh:centos-7-x64 +``` If you don't want to have to recreate the virtual machine every time you can use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the created virtual machines will be in `.vagrant/beaker_vagrant_files`. +Beaker also supports docker containers. We also use that in our automated CI +pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: + +``` +PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker +``` + +You can replace the string `debian9` with any common operating system. +The following strings are known to work: + +* ubuntu1604 +* ubuntu1804 +* debian8 +* debian9 +* centos6 +* centos7 + The easiest way to debug in a docker container is to open a shell: - docker exec -it -u root ${container_id_or_name} bash +```sh +docker exec -it -u root ${container_id_or_name} bash +``` + +The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) +repository. diff --git a/.msync.yml b/.msync.yml index e1cef55..1d2221f 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.0.0' +modulesync_config_version: '2.2.0' diff --git a/.travis.yml b/.travis.yml index 58c0432..41e6e97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,11 +18,11 @@ matrix: env: PUPPET_VERSION="~> 5.0" CHECK=test - rvm: 2.5.1 bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=rubocop + env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - rvm: 2.5.1 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 6.0" CHECK=rubocop + - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - rvm: 2.5.1 @@ -31,6 +31,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -43,6 +49,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -55,6 +67,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -67,6 +85,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -79,6 +103,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty diff --git a/Gemfile b/Gemfile index 20f3df0..7ed69d4 100644 --- a/Gemfile +++ b/Gemfile @@ -11,9 +11,8 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.6', :require => false - gem 'rspec-puppet', '~> 2.5', :require => false - gem 'rspec-puppet-facts', :require => false + gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false + gem 'rspec-puppet-facts', '>= 1.8.0', :require => false gem 'rspec-puppet-utils', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false diff --git a/spec/default_facts.yml b/spec/default_facts.yml index 13c4165..2f6698d 100644 --- a/spec/default_facts.yml +++ b/spec/default_facts.yml @@ -8,7 +8,6 @@ # Hint if using with rspec-puppet-facts ("on_supported_os.each"): # if a same named fact exists in facterdb it will be overridden. --- -concat_basedir: "/tmp" ipaddress: "172.16.254.254" is_pe: false macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ea74a52..88bca59 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,10 +1,9 @@ -require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' -include RspecPuppetFacts - # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config +require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' +include RspecPuppetFacts if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'coveralls' @@ -23,13 +22,13 @@ end RSpec.configure do |c| - default_facts = { - puppetversion: Puppet.version, - facterversion: Facter.version - } + default_facts = {} default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) c.default_facts = default_facts -end -# vim: syntax=ruby + # Coverage generation + c.after(:suite) do + RSpec::Puppet::Coverage.report! + end +end From 1e7728be899c4f1c076e2a2fc65d195b985dc881 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 16 Dec 2018 00:51:21 +0100 Subject: [PATCH 06/10] modulesync 2.3.1 --- .editorconfig | 14 +++++++++ .github/CONTRIBUTING.md | 15 ++++++++++ .msync.yml | 2 +- .pmtignore | 1 + .travis.yml | 30 +++++++++---------- Dockerfile | 21 +++++++++++++ Gemfile | 7 +++-- spec/acceptance/nodesets/centos-511-x64.yml | 15 ---------- spec/acceptance/nodesets/centos-6-x64.yml | 15 ---------- spec/acceptance/nodesets/centos-66-x64-pe.yml | 17 ----------- spec/acceptance/nodesets/centos-66-x64.yml | 15 ---------- spec/acceptance/nodesets/centos-7-x64.yml | 15 ---------- spec/acceptance/nodesets/centos-72-x64.yml | 15 ---------- spec/acceptance/nodesets/debian-78-x64.yml | 15 ---------- spec/acceptance/nodesets/debian-82-x64.yml | 15 ---------- spec/acceptance/nodesets/fedora-24-x64.yml | 15 ---------- spec/acceptance/nodesets/fedora-25-x64.yml | 16 ---------- spec/acceptance/nodesets/fedora-26-x64.yml | 16 ---------- spec/acceptance/nodesets/fedora-27-x64.yml | 18 ----------- .../nodesets/ubuntu-server-1204-x64.yml | 15 ---------- .../nodesets/ubuntu-server-1404-x64.yml | 15 ---------- .../nodesets/ubuntu-server-1604-x64.yml | 15 ---------- spec/classes/coverage_spec.rb | 4 --- 23 files changed, 71 insertions(+), 255 deletions(-) create mode 100644 .editorconfig create mode 100644 Dockerfile delete mode 100644 spec/acceptance/nodesets/centos-511-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-6-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-66-x64-pe.yml delete mode 100644 spec/acceptance/nodesets/centos-66-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-7-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-72-x64.yml delete mode 100644 spec/acceptance/nodesets/debian-78-x64.yml delete mode 100644 spec/acceptance/nodesets/debian-82-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-24-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-25-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-26-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-27-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1204-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1604-x64.yml delete mode 100644 spec/classes/coverage_spec.rb diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d77700e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# editorconfig.org + +# MANAGED BY MODULESYNC + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +tab_width = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 832578e..4a51969 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -109,6 +109,21 @@ To run a specific spec test set the `SPEC` variable: bundle exec rake spec SPEC=spec/foo_spec.rb ``` +### Unit tests in docker + +Some people don't want to run the dependencies locally or don't want to install +ruby. We ship a Dockerfile that enables you to run all unit tests and linting. +You only need to run: + +```sh +docker build . +``` + +Please ensure that a docker daemon is running and that your user has the +permission to talk to it. You can specify a remote docker host by setting the +`DOCKER_HOST` environment variable. it will copy the content of the module into +the docker image. So it will not work if a Gemfile.lock exists. + ## Integration tests The unit tests just check the code runs, not that it does exactly what diff --git a/.msync.yml b/.msync.yml index 1d2221f..648cf24 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.2.0' +modulesync_config_version: '2.3.1' diff --git a/.pmtignore b/.pmtignore index fb58957..4e6d54b 100644 --- a/.pmtignore +++ b/.pmtignore @@ -18,3 +18,4 @@ Puppetfile.lock *.iml .*.sw? .yardoc/ +Dockerfile diff --git a/.travis.yml b/.travis.yml index 41e6e97..829ca10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,91 +28,91 @@ matrix: - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required branches: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..27a33cf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM ruby:2.5.1 + +WORKDIR /opt/puppet + +# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 +RUN mkdir -p /etc/sv + +ARG PUPPET_VERSION="~> 6.0" +ARG PARALLEL_TEST_PROCESSORS=4 + +# Cache gems +COPY Gemfile . +RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} + +COPY . . + +RUN bundle install +RUN bundle exec release_checks + +# Container should not saved +RUN exit 1 diff --git a/Gemfile b/Gemfile index 7ed69d4..9648d7d 100644 --- a/Gemfile +++ b/Gemfile @@ -28,7 +28,8 @@ group :test do gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' - gem 'parallel_tests', :require => false + gem 'parallel_tests', '2.24.0', :require => false if RUBY_VERSION < '2.2.0' + gem 'parallel_tests', :require => false if RUBY_VERSION >= '2.2.0' end group :development do @@ -43,7 +44,7 @@ group :system_tests do if beaker_version = ENV['BEAKER_VERSION'] gem 'beaker', *location_for(beaker_version) else - gem 'beaker', '>= 3.9.0', :require => false + gem 'beaker', '>= 4.2.0', :require => false end if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] gem 'beaker-rspec', *location_for(beaker_rspec_version) @@ -51,7 +52,7 @@ group :system_tests do gem 'beaker-rspec', :require => false end gem 'serverspec', :require => false - gem 'beaker-hostgenerator', '>= 1.1.10', :require => false + gem 'beaker-hostgenerator', '>= 1.1.22', :require => false gem 'beaker-docker', :require => false gem 'beaker-puppet', :require => false gem 'beaker-puppet_install_helper', :require => false diff --git a/spec/acceptance/nodesets/centos-511-x64.yml b/spec/acceptance/nodesets/centos-511-x64.yml deleted file mode 100644 index 089d646..0000000 --- a/spec/acceptance/nodesets/centos-511-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-511-x64: - roles: - - master - platform: el-5-x86_64 - box: puppetlabs/centos-5.11-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-6-x64.yml b/spec/acceptance/nodesets/centos-6-x64.yml deleted file mode 100644 index 16abc8f..0000000 --- a/spec/acceptance/nodesets/centos-6-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-6-x64: - roles: - - master - platform: el-6-x86_64 - box: centos/6 - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-66-x64-pe.yml b/spec/acceptance/nodesets/centos-66-x64-pe.yml deleted file mode 100644 index 1e7aea6..0000000 --- a/spec/acceptance/nodesets/centos-66-x64-pe.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-66-x64: - roles: - - master - - database - - dashboard - platform: el-6-x86_64 - box: puppetlabs/centos-6.6-64-puppet-enterprise - hypervisor: vagrant -CONFIG: - type: pe -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-66-x64.yml b/spec/acceptance/nodesets/centos-66-x64.yml deleted file mode 100644 index 42455e7..0000000 --- a/spec/acceptance/nodesets/centos-66-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-66-x64: - roles: - - master - platform: el-6-x86_64 - box: puppetlabs/centos-6.6-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-7-x64.yml b/spec/acceptance/nodesets/centos-7-x64.yml deleted file mode 100644 index e05a3ae..0000000 --- a/spec/acceptance/nodesets/centos-7-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-7-x64: - roles: - - master - platform: el-7-x86_64 - box: centos/7 - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-72-x64.yml b/spec/acceptance/nodesets/centos-72-x64.yml deleted file mode 100644 index 85af89d..0000000 --- a/spec/acceptance/nodesets/centos-72-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-72-x64: - roles: - - master - platform: el-7-x86_64 - box: puppetlabs/centos-7.2-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-78-x64.yml b/spec/acceptance/nodesets/debian-78-x64.yml deleted file mode 100644 index 6ef6de8..0000000 --- a/spec/acceptance/nodesets/debian-78-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - debian-78-x64: - roles: - - master - platform: debian-7-amd64 - box: puppetlabs/debian-7.8-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-82-x64.yml b/spec/acceptance/nodesets/debian-82-x64.yml deleted file mode 100644 index 9897a8f..0000000 --- a/spec/acceptance/nodesets/debian-82-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - debian-82-x64: - roles: - - master - platform: debian-8-amd64 - box: puppetlabs/debian-8.2-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-24-x64.yml b/spec/acceptance/nodesets/fedora-24-x64.yml deleted file mode 100644 index 820b62d..0000000 --- a/spec/acceptance/nodesets/fedora-24-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - fedora-24-x64: - roles: - - master - platform: fedora-24-x86_64 - box: fedora/24-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-25-x64.yml b/spec/acceptance/nodesets/fedora-25-x64.yml deleted file mode 100644 index 54dd330..0000000 --- a/spec/acceptance/nodesets/fedora-25-x64.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -HOSTS: - fedora-25-x64: - roles: - - master - platform: fedora-25-x86_64 - box: fedora/25-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-26-x64.yml b/spec/acceptance/nodesets/fedora-26-x64.yml deleted file mode 100644 index 598822b..0000000 --- a/spec/acceptance/nodesets/fedora-26-x64.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -HOSTS: - fedora-26-x64: - roles: - - master - platform: fedora-26-x86_64 - box: fedora/26-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-27-x64.yml b/spec/acceptance/nodesets/fedora-27-x64.yml deleted file mode 100644 index c2b61eb..0000000 --- a/spec/acceptance/nodesets/fedora-27-x64.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# platform is fedora 26 because there is no puppet-agent -# for fedora 27 as of 2017-11-17 -HOSTS: - fedora-27-x64: - roles: - - master - platform: fedora-26-x86_64 - box: fedora/27-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml 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 29102c5..0000000 --- a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-server-1204-x64: - roles: - - master - platform: ubuntu-12.04-amd64 - box: puppetlabs/ubuntu-12.04-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml deleted file mode 100644 index 054e658..0000000 --- a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-server-1404-x64: - roles: - - master - platform: ubuntu-14.04-amd64 - box: puppetlabs/ubuntu-14.04-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml deleted file mode 100644 index bc85e0e..0000000 --- a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-server-1604-x64: - roles: - - master - platform: ubuntu-16.04-amd64 - box: puppetlabs/ubuntu-16.04-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb deleted file mode 100644 index de44654..0000000 --- a/spec/classes/coverage_spec.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'rspec-puppet' - -at_exit { RSpec::Puppet::Coverage.report! } -# vim: syntax=ruby From 9cba7736d7673d36e347498824f7e94993873e02 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 26 Dec 2018 00:53:20 +0100 Subject: [PATCH 07/10] modulesync 2.4.0 --- .msync.yml | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.msync.yml b/.msync.yml index 648cf24..fa528f5 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.3.1' +modulesync_config_version: '2.4.0' diff --git a/.travis.yml b/.travis.yml index 829ca10..e16c24f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ --- sudo: false -dist: trusty +dist: xenial language: ruby cache: bundler before_install: From 130737a31cb759a2e028441fa6480db31fbb76d3 Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Fri, 6 Dec 2019 15:36:08 +0100 Subject: [PATCH 08/10] modulesync 2.9.0 --- .github/CONTRIBUTING.md | 157 +++++++++++++++++++++++++------ .github/PULL_REQUEST_TEMPLATE.md | 10 +- .msync.yml | 2 +- .travis.yml | 104 +++++--------------- Dockerfile | 4 +- Gemfile | 28 +++--- Rakefile | 71 +++++++------- spec/default_facts.yml | 13 --- spec/spec_helper.rb | 35 ++++++- 9 files changed, 243 insertions(+), 181 deletions(-) delete mode 100644 spec/default_facts.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 4a51969..f3ffb57 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,3 +1,18 @@ +# Contribution guidelines + +## Table of contents + +* [Contributing](#contributing) +* [Writing proper commits - short version](#writing-proper-commits-short-version) +* [Writing proper commits - long version](#writing-proper-commits-long-version) +* [Dependencies](#dependencies) + * [Note for OS X users](#note-for-os-x-users) +* [The test matrix](#the-test-matrix) +* [Syntax and style](#syntax-and-style) +* [Running the unit tests](#running-the-unit-tests) +* [Unit tests in docker](#unit-tests-in-docker) +* [Integration tests](#integration-tests) + This module has grown over time based on a range of contributions from people using it. If you follow these contributing guidelines your patch will likely make it into a release a little more quickly. @@ -8,29 +23,92 @@ Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. [Contributor Code of Conduct](https://voxpupuli.org/coc/). -1. Fork the repo. - -1. Create a separate branch for your change. - -1. We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) - runs the tests for us. You can also execute them locally. This is explained - in a later section. - -1. Checkout [our docs](https://voxpupuli.org/docs/#reviewing-a-module-pr) we - use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). - They provide some guidance for new code that might help you before you submit a pull request. - -1. Add a test for your change. Only refactoring and documentation - changes require no new tests. If you are adding functionality - or fixing a bug, please add a test. - -1. Squash your commits down into logical components. Make sure to rebase - against our current master. - -1. Push the branch to your fork and submit a pull request. - -Please be prepared to repeat some of these steps as our contributors review -your code. +* Fork the repo. +* Create a separate branch for your change. +* We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) runs the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). +* Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. +* Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. +* Squash your commits down into logical components. Make sure to rebase against our current master. +* Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review your code. + +## Writing proper commits - short version + +* Make commits of logical units. +* Check for unnecessary whitespace with "git diff --check" before committing. +* Commit using Unix line endings (check the settings around "crlf" in git-config(1)). +* Do not check in commented out code or unneeded files. +* The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. +* Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". +* The body should provide a meaningful commit message, which: + *uses the imperative, present tense: `change`, not `changed` or `changes`. + * includes motivation for the change, and contrasts its implementation with the previous behavior. + * Make sure that you have tests for the bug you are fixing, or feature you are adding. + * Make sure the test suites passes after your commit: + * When introducing a new feature, make sure it is properly documented in the README.md + +## Writing proper commits - long version + + 1. Make separate commits for logically separate changes. + + Please break your commits down into logically consistent units + which include new or changed tests relevant to the rest of the + change. The goal of doing this is to make the diff easier to + read for whoever is reviewing your code. In general, the easier + your diff is to read, the more likely someone will be happy to + review it and get it into the code base. + + If you are going to refactor a piece of code, please do so as a + separate commit from your feature or bug fix changes. + + We also really appreciate changes that include tests to make + sure the bug is not re-introduced, and that the feature is not + accidentally broken. + + Describe the technical detail of the change(s). If your + description starts to get too long, that is a good sign that you + probably need to split up your commit into more finely grained + pieces. + + Commits which plainly describe the things which help + reviewers check the patch and future developers understand the + code are much more likely to be merged in with a minimum of + bike-shedding or requested changes. Ideally, the commit message + would include information, and be in a form suitable for + inclusion in the release notes for the version of Puppet that + includes them. + + Please also check that you are not introducing any trailing + whitespace or other "whitespace errors". You can do this by + running "git diff --check" on your changes before you commit. + + 2. Sending your patches + + To submit your changes via a GitHub pull request, we _highly_ + recommend that you have them on a topic branch, instead of + directly on `master`. + It makes things much easier to keep track of, especially if + you decide to work on another thing before your first change + is merged in. + + GitHub has some pretty good + [general documentation](http://help.github.com/) on using + their site. They also have documentation on + [creating pull requests](http://help.github.com/send-pull-requests/). + + In general, after pushing your topic branch up to your + repository on GitHub, you can switch to the branch in the + GitHub UI and click "Pull Request" towards the top of the page + in order to open a pull request. + + + 3. Update the related GitHub issue. + + If there is a GitHub issue associated with the change you + submitted, then you should update the ticket to include the + location of your branch, along with any other commentary you + may wish to make. ## Dependencies @@ -51,22 +129,39 @@ You can install all needed gems for spec tests into the modules directory by running: ```sh -bundle install --path .vendor/ --without development --without system_tests --without release +bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" ``` If you also want to run acceptance tests: ```sh -bundle install --path .vendor/ --without development --with system_tests --without release +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" ``` Our all in one solution if you don't know if you need to install or update gems: ```sh -bundle install --path .vendor/ --without development --with system_tests --without release; bundle update; bundle clean +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +``` + +As an alternative to the `--jobs "$(nproc)` parameter, you can set an +environment variable: + +```sh +BUNDLE_JOBS="$(nproc)" ``` -## Syntax and style +### Note for OS X users + +`nproc` isn't a valid command under OS x. As an alternative, you can do: + +```sh +--jobs "$(sysctl -n hw.ncpu)" +``` + +## The test matrix + +### Syntax and style The test suite will run [Puppet Lint](http://puppet-lint.com/) and [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to @@ -84,7 +179,7 @@ against it. You can run those locally ahead of time with: bundle exec rake rubocop ``` -## Running the unit tests +### Running the unit tests The unit test suite covers most of the code, as mentioned above please add tests if you're adding new functionality. If you've not used @@ -109,7 +204,7 @@ To run a specific spec test set the `SPEC` variable: bundle exec rake spec SPEC=spec/foo_spec.rb ``` -### Unit tests in docker +#### Unit tests in docker Some people don't want to run the dependencies locally or don't want to install ruby. We ship a Dockerfile that enables you to run all unit tests and linting. @@ -124,7 +219,7 @@ permission to talk to it. You can specify a remote docker host by setting the `DOCKER_HOST` environment variable. it will copy the content of the module into the docker image. So it will not work if a Gemfile.lock exists. -## Integration tests +### Integration tests The unit tests just check the code runs, not that it does exactly what we want on a real machine. For that we're using @@ -160,7 +255,7 @@ created virtual machines will be in `.vagrant/beaker_vagrant_files`. Beaker also supports docker containers. We also use that in our automated CI pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: -``` +```sh PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker ``` diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index ef25cdb..342807b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,13 +8,13 @@ Thank you for contributing to this project! --> #### Pull Request (PR) description #### This Pull Request (PR) fixes the following issues diff --git a/.msync.yml b/.msync.yml index fa528f5..a7c0bbf 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.4.0' +modulesync_config_version: '2.9.0' diff --git a/.travis.yml b/.travis.yml index e16c24f..2ac6df2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,120 +1,68 @@ --- -sudo: false -dist: xenial +dist: bionic language: ruby cache: bundler before_install: - - rm -f Gemfile.lock + - gem update --system + - gem update bundler + - bundle --version script: - 'bundle exec rake $CHECK' matrix: fast_finish: true include: - - rvm: 2.1.9 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=12 - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 6.0" CHECK=rubocop - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.5.1 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - sudo: required - - rvm: 2.5.1 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - sudo: required - - rvm: 2.5.1 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - sudo: required - - rvm: 2.5.1 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - sudo: required - - rvm: 2.5.1 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required branches: only: - master diff --git a/Dockerfile b/Dockerfile index 27a33cf..6fd6342 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.5.1 +FROM ruby:2.5.3 WORKDIR /opt/puppet @@ -15,7 +15,7 @@ RUN bundle install --without system_tests development release --path=${BUNDLE_PA COPY . . RUN bundle install -RUN bundle exec release_checks +RUN bundle exec rake release_checks # Container should not saved RUN exit 1 diff --git a/Gemfile b/Gemfile index 9648d7d..5a2e737 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,8 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false - gem 'rspec-puppet-facts', '>= 1.8.0', :require => false + gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false + gem 'rspec-puppet-facts', '>= 1.9.5', :require => false gem 'rspec-puppet-utils', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false @@ -20,16 +20,18 @@ group :test do gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false + gem 'puppet-lint-absolute_classname-check', :require => false + gem 'puppet-lint-topscope-variable-check', :require => false + gem 'puppet-lint-legacy_facts-check', :require => false + gem 'puppet-lint-anchor-check', :require => false gem 'metadata-json-lint', :require => false gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0' - gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop', '~> 0.49.1', :require => false + gem 'rubocop-rspec', '~> 1.15.0', :require => false gem 'mocha', '~> 1.4.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' - gem 'parallel_tests', '2.24.0', :require => false if RUBY_VERSION < '2.2.0' - gem 'parallel_tests', :require => false if RUBY_VERSION >= '2.2.0' + gem 'parallel_tests', :require => false end group :development do @@ -57,16 +59,16 @@ group :system_tests do gem 'beaker-puppet', :require => false gem 'beaker-puppet_install_helper', :require => false gem 'beaker-module_install_helper', :require => false - gem 'rbnacl', '>= 4', :require => false if RUBY_VERSION >= '2.2.6' - gem 'rbnacl-libsodium', :require => false if RUBY_VERSION >= '2.2.6' + gem 'rbnacl', '>= 4', :require => false + gem 'rbnacl-libsodium', :require => false gem 'bcrypt_pbkdf', :require => false end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' if RUBY_VERSION >= '2.2.2' + gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes' gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' - gem 'puppet-strings', '>= 1.0', :require => false + gem 'voxpupuli-release', :require => false + gem 'puppet-strings', '>= 2.2', :require => false end @@ -77,7 +79,7 @@ else gem 'facter', :require => false, :groups => [:test] end -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 279580a..e3642ac 100644 --- a/Rakefile +++ b/Rakefile @@ -3,19 +3,12 @@ require 'puppetlabs_spec_helper/rake_tasks' # load optional tasks for releases # only available if gem group releases is installed begin - require 'puppet_blacksmith/rake_tasks' require 'voxpupuli/release/rake_tasks' - require 'puppet-strings/tasks' rescue LoadError end PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' -PuppetLint.configuration.fail_on_warnings = true -PuppetLint.configuration.send('relative') -PuppetLint.configuration.send('disable_140chars') -PuppetLint.configuration.send('disable_class_inherits_from_params_class') -PuppetLint.configuration.send('disable_documentation') -PuppetLint.configuration.send('disable_single_quote_string_with_variables') +PuppetLint.configuration.absolute_classname_reverse = true exclude_paths = %w( pkg/**/* @@ -28,8 +21,7 @@ PuppetSyntax.exclude_paths = exclude_paths desc 'Auto-correct puppet-lint offenses' task 'lint:auto_correct' do - PuppetLint.configuration.fix = true - Rake::Task[:lint].invoke + Rake::Task[:lint_fix].invoke end desc 'Run acceptance tests' @@ -37,11 +29,24 @@ RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' end -desc 'Run tests metadata_lint, release_checks' -task test: [ - :metadata_lint, - :release_checks, -] +desc 'Run tests' +task test: [:release_checks] + +namespace :check do + desc 'Check for trailing whitespace' + task :trailing_whitespace do + Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename| + next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)} + File.foreach(filename).each_with_index do |line, index| + if line =~ %r{\s\n$} + puts "#{filename} has trailing whitespace on line #{index + 1}" + exit 1 + end + end + end + end +end +Rake::Task[:release_checks].enhance ['check:trailing_whitespace'] desc "Run main 'test' task and report merged results to coveralls" task test_with_coveralls: [:test] do @@ -54,25 +59,10 @@ task test_with_coveralls: [:test] do end end -desc "Print supported beaker sets" -task 'beaker_sets', [:directory] do |t, args| - directory = args[:directory] - - metadata = JSON.load(File.read('metadata.json')) - - (metadata['operatingsystem_support'] || []).each do |os| - (os['operatingsystemrelease'] || []).each do |release| - if directory - beaker_set = "#{directory}/#{os['operatingsystem'].downcase}-#{release}" - else - beaker_set = "#{os['operatingsystem'].downcase}-#{release}-x64" - end - - filename = "spec/acceptance/nodesets/#{beaker_set}.yml" - - puts beaker_set if File.exists? filename - end - end +desc 'Generate REFERENCE.md' +task :reference, [:debug, :backtrace] do |t, args| + patterns = '' + Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) end begin @@ -87,6 +77,19 @@ begin metadata = JSON.load(File.read(metadata_json)) config.project = metadata['name'] end + + # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 + require 'rbconfig' + if RbConfig::CONFIG['host_os'] =~ /linux/ + task :changelog do + puts 'Fixing line endings...' + changelog_file = File.join(__dir__, 'CHANGELOG.md') + changelog_txt = File.read(changelog_file) + new_contents = changelog_txt.gsub(%r{\r\n}, "\n") + File.open(changelog_file, "w") {|file| file.puts new_contents } + end + end + rescue LoadError end # vim: syntax=ruby diff --git a/spec/default_facts.yml b/spec/default_facts.yml deleted file mode 100644 index 2f6698d..0000000 --- a/spec/default_facts.yml +++ /dev/null @@ -1,13 +0,0 @@ -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# use default_module_facts.yaml for module specific -# facts. -# -# Hint if using with rspec-puppet-facts ("on_supported_os.each"): -# if a same named fact exists in facterdb it will be overridden. ---- -ipaddress: "172.16.254.254" -is_pe: false -macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 88bca59..93f417a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,10 +1,29 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config +RSpec.configure do |c| + c.mock_with :rspec +end + require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' +require 'bundler' include RspecPuppetFacts +if ENV['DEBUG'] + Puppet::Util::Log.level = :debug + Puppet::Util::Log.newdestination(:console) +end + +if File.exist?(File.join(__dir__, 'default_module_facts.yml')) + facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + if facts + facts.each do |name, value| + add_custom_fact name.to_sym, value + end + end +end + if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'coveralls' require 'simplecov' @@ -18,14 +37,22 @@ add_filter '/spec' add_filter '/vendor' add_filter '/.vendor' + add_filter Bundler.configured_bundle_path.path end end RSpec.configure do |c| - default_facts = {} - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) - c.default_facts = default_facts + # getting the correct facter version is tricky. We use facterdb as a source to mock facts + # see https://github.com/camptocamp/facterdb + # people might provide a specific facter version. In that case we use it. + # Otherwise we need to match the correct facter version to the used puppet version. + # as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14 + # https://puppet.com/docs/puppet/5.5/about_agent.html + c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION'] + ENV['FACTERDB_FACTS_VERSION'] + else + Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0' + end # Coverage generation c.after(:suite) do From b699b25b0ddd28d180fc368be2b6e882a8679e45 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 23 Dec 2019 01:10:30 +0100 Subject: [PATCH 09/10] modulesync 2.10.0 --- .msync.yml | 2 +- .rubocop.yml | 2 +- .travis.yml | 4 ++-- CONTRIBUTING.md | 27 --------------------------- Gemfile | 2 +- Rakefile | 10 ---------- 6 files changed, 5 insertions(+), 42 deletions(-) delete mode 100644 CONTRIBUTING.md diff --git a/.msync.yml b/.msync.yml index a7c0bbf..11aed5f 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.9.0' +modulesync_config_version: '2.10.0' diff --git a/.rubocop.yml b/.rubocop.yml index 099a11c..5984ccc 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,6 @@ require: rubocop-rspec AllCops: - TargetRubyVersion: 1.9 + TargetRubyVersion: 2.1 Include: - ./**/*.rb Exclude: diff --git a/.travis.yml b/.travis.yml index 2ac6df2..350f310 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,7 @@ dist: bionic language: ruby cache: bundler before_install: - - gem update --system - - gem update bundler + - yes | gem update --system - bundle --version script: - 'bundle exec rake $CHECK' @@ -69,6 +68,7 @@ branches: - /^v\d/ notifications: email: false + webhooks: https://voxpupu.li/incoming/travis irc: on_success: always on_failure: always diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 6b9dd54..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,27 +0,0 @@ -Checklist (abreviated) -====================== - - * Commits: - - - Commits should be logically grouped. Do not have multiple unrelated changes in a single commit. - - - Avoid unnesscessary whitespace additions. Use "git diff --check" before committing. - - Avoid checking in commented code or nonrelevant files. - - - The first line of the commit message should be less than 50 characters and is the title of the change. Additional details may be included on additional lines. - - - Associate the Issue ID on the first line of the commit message in the form of "(#XXX) Rest of Message" - - - The body of the commit message should be meaningful and provide enough detail as to why the change was needed. - - * Submission: - - * Preferred Method: - - - Fork the repository on GitHub. - - - Push your changes to a topic branch in your fork of the repository. (the format ticket/1234-short_description_of change is usually preferred. - - - Submit a pull request to the repository. - - - Contributions will only be accepted if spec / acceptance tests are included and passing. If you require assistance please submit the request and ask for advice. diff --git a/Gemfile b/Gemfile index 5a2e737..50a9030 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ group :test do gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false - gem 'puppet-lint-absolute_classname-check', :require => false + gem 'puppet-lint-absolute_classname-check', '>= 2.0.0', :require => false gem 'puppet-lint-topscope-variable-check', :require => false gem 'puppet-lint-legacy_facts-check', :require => false gem 'puppet-lint-anchor-check', :require => false diff --git a/Rakefile b/Rakefile index e3642ac..c0f2d37 100644 --- a/Rakefile +++ b/Rakefile @@ -8,16 +8,6 @@ rescue LoadError end PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' -PuppetLint.configuration.absolute_classname_reverse = true - -exclude_paths = %w( - pkg/**/* - vendor/**/* - .vendor/**/* - spec/**/* -) -PuppetLint.configuration.ignore_paths = exclude_paths -PuppetSyntax.exclude_paths = exclude_paths desc 'Auto-correct puppet-lint offenses' task 'lint:auto_correct' do From 3d6f7a633c6aa1f6a9028bc48fcd6c5cb990b9ed Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 25 Jul 2020 14:22:16 +0200 Subject: [PATCH 10/10] modulesync 3.0.0 --- .github/CONTRIBUTING.md | 6 +++-- .github/SECURITY.md | 3 +++ .msync.yml | 2 +- .rubocop.yml | 6 ++++- .travis.yml | 25 ++++++++++---------- Gemfile | 45 ++++-------------------------------- Rakefile | 33 +------------------------- spec/spec_helper.rb | 51 ++++------------------------------------- 8 files changed, 35 insertions(+), 136 deletions(-) create mode 100644 .github/SECURITY.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f3ffb57..2240a97 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -256,18 +256,20 @@ Beaker also supports docker containers. We also use that in our automated CI pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: ```sh -PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker +PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker ``` -You can replace the string `debian9` with any common operating system. +You can replace the string `debian10` with any common operating system. The following strings are known to work: * ubuntu1604 * ubuntu1804 * debian8 * debian9 +* debian10 * centos6 * centos7 +* centos8 The easiest way to debug in a docker container is to open a shell: diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..cacadf2 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Vox Pupuli Security Policy + +Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.msync.yml b/.msync.yml index 11aed5f..4c7999c 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.10.0' +modulesync_config_version: '3.0.0' diff --git a/.rubocop.yml b/.rubocop.yml index 5984ccc..316e4ec 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,7 @@ require: rubocop-rspec AllCops: - TargetRubyVersion: 2.1 +# Puppet Server 5 defaults to jruby 1.7 so TargetRubyVersion must stay at 1.9 until we drop support for puppet 5 + TargetRubyVersion: 1.9 Include: - ./**/*.rb Exclude: @@ -527,6 +528,9 @@ RSpec/RepeatedDescription: RSpec/NestedGroups: Enabled: False +RSpec/MultipleExpectations: + Enabled: false + # this is broken on ruby1.9 Layout/IndentHeredoc: Enabled: False diff --git a/.travis.yml b/.travis.yml index 350f310..6da0bb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ --- +os: linux dist: bionic language: ruby cache: bundler @@ -7,7 +8,7 @@ before_install: - bundle --version script: - 'bundle exec rake $CHECK' -matrix: +jobs: fast_finish: true include: - rvm: 2.4.4 @@ -24,43 +25,43 @@ matrix: env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos6-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos6-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian8-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian8-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1404-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1404-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1604-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1604-64 CHECK=beaker services: docker branches: only: @@ -76,7 +77,7 @@ notifications: - "chat.freenode.org#voxpupuli-notifications" deploy: provider: puppetforge - user: puppet + username: puppet password: secure: "iB8hRDwZ1xe+O7IixA34KFBav+oOJZO/UzetZ8u12IJ1e3FJIvBVz49J9XS/xBB9q0j/YiL8WMSzlaejGPUGsR5IOWUer0QuIqKMjJwNR27sn3JO3YHUJ9yprs4mEfOFDCyUqilJ5MCuNYcHlE6G21z5mZKUK0IkpSTqGSt15hpu5YRIEu9ZwUJ66Zy127lH69xVmi6gh1Ntt2X4nAPWtEvkRCD3OLYSooqwgubWaNjaaxJu1xoSpMQjPXZ7sq7dIkzEwAFSjkaTcXRVXdKFEoRG6OpKVTd/Kted9bcYoYJoPKFcXk+43yj1UZPbjk00erSjmPsl2eXE8pVcReZHUbEvu5DO3bSNgoqCeKqsAQX6YuFqlESrk9pSLQeEWSDdIVojhAKUHm8b/QHJDXMpV7e8bFkL2yotzP3+U5y30sMAvyFl44GQv0Hpk4fNemUlD5AQv556Z5b2G0MDWWEog8gSKOun4HHaf9jgsZs7W7RZM6Fal8fUSd1YqvM8p/bPm4bZ+SSfTtGGRAdMu0Dv9VAN0mot4c9q1n93GS/4mPOREnS+9AqJM4SXIXY3m7Es7LscdWdGY9EVriMBfJpCAmPqBGQBzAKgpm5+5vPk0njCyWwdnLhkgA6GJXSB6Bh4hZLkZbrQKlmRLp2qGah045BXAY8PtNkxcJwMFPKN2pE=" on: diff --git a/Gemfile b/Gemfile index 50a9030..8592cd6 100644 --- a/Gemfile +++ b/Gemfile @@ -11,27 +11,9 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false - gem 'rspec-puppet-facts', '>= 1.9.5', :require => false - gem 'rspec-puppet-utils', :require => false - gem 'puppet-lint-leading_zero-check', :require => false - gem 'puppet-lint-trailing_comma-check', :require => false - gem 'puppet-lint-version_comparison-check', :require => false - gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false - gem 'puppet-lint-unquoted_string-check', :require => false - gem 'puppet-lint-variable_contains_upcase', :require => false - gem 'puppet-lint-absolute_classname-check', '>= 2.0.0', :require => false - gem 'puppet-lint-topscope-variable-check', :require => false - gem 'puppet-lint-legacy_facts-check', :require => false - gem 'puppet-lint-anchor-check', :require => false - gem 'metadata-json-lint', :require => false - gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.49.1', :require => false - gem 'rubocop-rspec', '~> 1.15.0', :require => false - gem 'mocha', '~> 1.4.0', :require => false - gem 'coveralls', :require => false - gem 'simplecov-console', :require => false - gem 'parallel_tests', :require => false + gem 'voxpupuli-test', '~> 2.0', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false end group :development do @@ -42,26 +24,7 @@ group :development do end group :system_tests do - gem 'winrm', :require => false - if beaker_version = ENV['BEAKER_VERSION'] - gem 'beaker', *location_for(beaker_version) - else - gem 'beaker', '>= 4.2.0', :require => false - end - if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] - gem 'beaker-rspec', *location_for(beaker_rspec_version) - else - gem 'beaker-rspec', :require => false - end - gem 'serverspec', :require => false - gem 'beaker-hostgenerator', '>= 1.1.22', :require => false - gem 'beaker-docker', :require => false - gem 'beaker-puppet', :require => false - gem 'beaker-puppet_install_helper', :require => false - gem 'beaker-module_install_helper', :require => false - gem 'rbnacl', '>= 4', :require => false - gem 'rbnacl-libsodium', :require => false - gem 'bcrypt_pbkdf', :require => false + gem 'voxpupuli-acceptance', :require => false end group :release do diff --git a/Rakefile b/Rakefile index c0f2d37..b450fe7 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,4 @@ -require 'puppetlabs_spec_helper/rake_tasks' +require 'voxpupuli/test/rake' # load optional tasks for releases # only available if gem group releases is installed @@ -7,37 +7,6 @@ begin rescue LoadError end -PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' - -desc 'Auto-correct puppet-lint offenses' -task 'lint:auto_correct' do - Rake::Task[:lint_fix].invoke -end - -desc 'Run acceptance tests' -RSpec::Core::RakeTask.new(:acceptance) do |t| - t.pattern = 'spec/acceptance' -end - -desc 'Run tests' -task test: [:release_checks] - -namespace :check do - desc 'Check for trailing whitespace' - task :trailing_whitespace do - Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename| - next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)} - File.foreach(filename).each_with_index do |line, index| - if line =~ %r{\s\n$} - puts "#{filename} has trailing whitespace on line #{index + 1}" - exit 1 - end - end - end - end -end -Rake::Task[:release_checks].enhance ['check:trailing_whitespace'] - desc "Run main 'test' task and report merged results to coveralls" task test_with_coveralls: [:test] do if Dir.exist?(File.expand_path('../lib', __FILE__)) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 93f417a..b2b2704 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,19 +1,12 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -RSpec.configure do |c| - c.mock_with :rspec -end -require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' -require 'bundler' -include RspecPuppetFacts +# puppetlabs_spec_helper will set up coverage if the env variable is set. +# We want to do this if lib exists and it hasn't been explicitly set. +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) -if ENV['DEBUG'] - Puppet::Util::Log.level = :debug - Puppet::Util::Log.newdestination(:console) -end +require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) @@ -23,39 +16,3 @@ end end end - -if Dir.exist?(File.expand_path('../../lib', __FILE__)) - require 'coveralls' - require 'simplecov' - require 'simplecov-console' - SimpleCov.formatters = [ - SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::Console - ] - SimpleCov.start do - track_files 'lib/**/*.rb' - add_filter '/spec' - add_filter '/vendor' - add_filter '/.vendor' - add_filter Bundler.configured_bundle_path.path - end -end - -RSpec.configure do |c| - # getting the correct facter version is tricky. We use facterdb as a source to mock facts - # see https://github.com/camptocamp/facterdb - # people might provide a specific facter version. In that case we use it. - # Otherwise we need to match the correct facter version to the used puppet version. - # as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14 - # https://puppet.com/docs/puppet/5.5/about_agent.html - c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION'] - ENV['FACTERDB_FACTS_VERSION'] - else - Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0' - end - - # Coverage generation - c.after(:suite) do - RSpec::Puppet::Coverage.report! - end -end