From c34c887bd3c063b2a958f36c1ea417506c246732 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 11 Nov 2017 01:55:17 +0100 Subject: [PATCH] modulesync 1.4.1 --- .github/CONTRIBUTING.md | 29 ++++++++++++-------- .msync.yml | 2 +- .rubocop.yml | 13 +++++++++ .travis.yml | 21 ++++++++------ Gemfile | 20 +++++++++----- Rakefile | 26 ++++++++++++++++-- spec/acceptance/nodesets/docker/debian-7.yml | 1 - spec/acceptance/nodesets/docker/debian-8.yml | 1 - spec/acceptance/nodesets/docker/debian-9.yml | 20 ++++++++++++++ spec/spec_helper.rb | 3 +- 10 files changed, 101 insertions(+), 35 deletions(-) create mode 100644 spec/acceptance/nodesets/docker/debian-9.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 602f324..7a0980a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ 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 quicker. +will likely make it into a release a little more quickly. ## Contributing @@ -65,6 +65,10 @@ add tests if you're adding new functionality. If you've not used [rspec-puppet](http://rspec-puppet.com/) before then feel free to ask about how best to test your new feature. +To run the linter, the syntax checker and the unit tests: + + bundle exec rake test + To run your all the unit tests bundle exec rake spec SPEC_OPTS='--format documentation' @@ -73,10 +77,6 @@ To run a specific spec test set the `SPEC` variable: bundle exec rake spec SPEC=spec/foo_spec.rb -To run the linter, the syntax checker and the unit tests: - - bundle exec rake test - ## Integration tests The unit tests just check the code runs, not that it does exactly what @@ -89,15 +89,20 @@ with: bundle exec rake acceptance -This will run the tests on an Ubuntu 12.04 virtual machine. You can also -run the integration tests against Centos 6.6 with. +This will run the tests on the module's default nodeset. You can override the +nodeset used, e.g., - BEAKER_set=centos-66-x64 bundle exec rake acceptances + BEAKER_set=centos-7-x64 bundle exec rake acceptance -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_fies`. +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 + +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`. The easiest way to debug in a docker container is to open a shell: diff --git a/.msync.yml b/.msync.yml index 0a4a57d..0220838 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.1.0' +modulesync_config_version: '1.4.1' diff --git a/.rubocop.yml b/.rubocop.yml index b1a9521..3fc819b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,6 +12,7 @@ AllCops: - Gemfile - Rakefile - Guardfile + - Vagrantfile Lint/ConditionPosition: Enabled: True @@ -45,6 +46,9 @@ Style/HashSyntax: Style/RedundantReturn: Enabled: True +Style/EndOfLine: + Enabled: False + Lint/AmbiguousOperator: Enabled: True @@ -530,3 +534,12 @@ Layout/IndentHeredoc: # disable Yaml safe_load. This is needed to support ruby2.0.0 development envs Security/YAMLLoad: Enabled: false + +# This affects hiera interpolation, as well as some configs that we push. +Style/FormatStringToken: + Enabled: false + +# This is useful, but sometimes a little too picky about where unit tests files +# are located. +RSpec/FilePath: + Enabled: false diff --git a/.travis.yml b/.travis.yml index 11e405d..dfe3b16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,16 +16,16 @@ matrix: fast_finish: true include: - rvm: 2.1.9 - bundler_args: --without system_tests development + bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.1 - bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.4.1 - bundler_args: --without system_tests development + - rvm: 2.4.2 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls + - rvm: 2.4.2 + bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=rubocop - - rvm: 2.4.1 - bundler_args: --without system_tests development + - rvm: 2.4.2 + bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes branches: only: @@ -33,6 +33,11 @@ branches: - /^v\d/ notifications: email: false + irc: + on_success: always + on_failure: always + channels: + - "chat.freenode.org#voxpupuli-notifications" deploy: provider: puppetforge user: puppet diff --git a/Gemfile b/Gemfile index 9d5df20..83d63b4 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.2.0', :require => false + gem 'puppetlabs_spec_helper', '~> 2.4.0', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false @@ -22,18 +22,13 @@ group :test do gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false gem 'metadata-json-lint', :require => false - 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 '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 'mocha', '>= 1.2.1', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2' gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' - gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' gem 'parallel_tests', :require => false end @@ -45,8 +40,11 @@ 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', '>= 3.9.0', :require => false end if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] gem 'beaker-rspec', *location_for(beaker_rspec_version) @@ -55,6 +53,14 @@ group :system_tests do end gem 'serverspec', :require => false gem 'beaker-puppet_install_helper', :require => false + gem 'beaker-module_install_helper', :require => false +end + +group :release do + gem 'github_changelog_generator', :require => false 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 end @@ -62,7 +68,7 @@ end if facterversion = ENV['FACTER_GEM_VERSION'] gem 'facter', facterversion.to_s, :require => false, :groups => [:test] else -gem 'facter', :require => false, :groups => [:test] + gem 'facter', :require => false, :groups => [:test] end ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s diff --git a/Rakefile b/Rakefile index ab9411b..14ccf58 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,13 @@ require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet_blacksmith/rake_tasks' -require 'voxpupuli/release/rake_tasks' -require 'puppet-strings/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 @@ -31,6 +37,17 @@ task test: [ :release_checks, ] +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__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' + end +end + begin require 'github_changelog_generator/task' GitHubChangelogGenerator::RakeTask.new :changelog do |config| @@ -39,6 +56,9 @@ begin config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} config.user = 'voxpupuli' + metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') + metadata = JSON.load(File.read(metadata_json)) + config.project = metadata['name'] end rescue LoadError end diff --git a/spec/acceptance/nodesets/docker/debian-7.yml b/spec/acceptance/nodesets/docker/debian-7.yml index 071acbf..41b284d 100644 --- a/spec/acceptance/nodesets/docker/debian-7.yml +++ b/spec/acceptance/nodesets/docker/debian-7.yml @@ -10,7 +10,6 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - - 'echo deb http://ftp.debian.org/debian wheezy-backports main >> /etc/apt/sources.list' - 'apt-get update && apt-get install -y cron locales-all net-tools wget' CONFIG: trace_limit: 200 diff --git a/spec/acceptance/nodesets/docker/debian-8.yml b/spec/acceptance/nodesets/docker/debian-8.yml index 7a1f35c..a630b7e 100644 --- a/spec/acceptance/nodesets/docker/debian-8.yml +++ b/spec/acceptance/nodesets/docker/debian-8.yml @@ -10,7 +10,6 @@ HOSTS: docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - - 'echo deb http://ftp.debian.org/debian jessie-backports main >> /etc/apt/sources.list' - 'apt-get update && apt-get install -y cron locales-all net-tools wget' - 'rm -f /usr/sbin/policy-rc.d' - 'systemctl mask getty@tty1.service getty-static.service' diff --git a/spec/acceptance/nodesets/docker/debian-9.yml b/spec/acceptance/nodesets/docker/debian-9.yml new file mode 100644 index 0000000..dfc8e9c --- /dev/null +++ b/spec/acceptance/nodesets/docker/debian-9.yml @@ -0,0 +1,20 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/theforeman/foreman-installer-modulesync +HOSTS: + debian-9-x64: + platform: debian-9-amd64 + hypervisor: docker + image: debian:9 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get update && apt-get install -y cron locales-all net-tools wget systemd-sysv' + - 'rm -f /usr/sbin/policy-rc.d' + - 'systemctl mask getty@tty1.service getty-static.service' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2aa9da7..cdd4935 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,8 +8,7 @@ if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'simplecov-console' SimpleCov.formatters = [ SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::Console, - Coveralls::SimpleCov::Formatter + SimpleCov::Formatter::Console ] SimpleCov.start do track_files 'lib/**/*.rb'