From 3a0e7802a8eb1ac7ff58deacea5acfd1cd06dd99 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Thu, 19 Mar 2015 15:12:25 -0700 Subject: [PATCH 1/5] Update tests for rspec-puppet 2 This patch uses `catalogue` instead of `subject` for the raise_error matcher since `subject` is not evaluated the way it used to be. We also unpin rspec-puppet. --- Gemfile | 1 - spec/classes/ntp_spec.rb | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 62c56939..2452d15b 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,6 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :unit_tests do gem 'rake', :require => false gem 'rspec-core', '3.1.7', :require => false - gem 'rspec-puppet', '~> 1.0', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'puppet-lint', :require => false gem 'simplecov', :require => false diff --git a/spec/classes/ntp_spec.rb b/spec/classes/ntp_spec.rb index bffcc031..539fe628 100644 --- a/spec/classes/ntp_spec.rb +++ b/spec/classes/ntp_spec.rb @@ -363,8 +363,8 @@ }) end - it { expect{ subject }.to raise_error( - /^The ntp module is not supported on an unsupported based system./ + it { expect{ catalogue }.to raise_error( + /The ntp module is not supported on an unsupported based system./ )} end end From 44dd10715e36a3f3d119e06d0cbc7025695b89cb Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 18 Mar 2015 15:29:25 -0700 Subject: [PATCH 2/5] Remove unneeded dependencies puppetlabs_spec_helper handles these dependencies for us. --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index 2452d15b..cc77f38c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,8 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :unit_tests do - gem 'rake', :require => false gem 'rspec-core', '3.1.7', :require => false gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', :require => false gem 'simplecov', :require => false gem 'puppet_facts', :require => false gem 'json', :require => false From 78183a1bd2d1873122183531205811a3edd83e5d Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 18 Mar 2015 15:29:49 -0700 Subject: [PATCH 3/5] Fix lint warnings and ensure lint fails on warnings --- Rakefile | 2 +- manifests/config.pp | 16 ++++++++-------- manifests/install.pp | 6 +++--- manifests/service.pp | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Rakefile b/Rakefile index e3be95b0..181157e6 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' -PuppetLint.configuration.fail_on_warnings +PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.send('relative') PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') diff --git a/manifests/config.pp b/manifests/config.pp index 91990ba1..e54feff0 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,22 +1,22 @@ # class ntp::config inherits ntp { - if $keys_enable { - $directory = ntp_dirname($keys_file) + if $ntp::keys_enable { + $directory = ntp_dirname($ntp::keys_file) file { $directory: - ensure => directory, - owner => 0, - group => 0, - mode => '0755', + ensure => directory, + owner => 0, + group => 0, + mode => '0755', } } - file { $config: + file { $ntp::config: ensure => file, owner => 0, group => 0, mode => '0644', - content => template($config_template), + content => template($ntp::config_template), } } diff --git a/manifests/install.pp b/manifests/install.pp index 49f4044b..9709d708 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,10 +1,10 @@ # class ntp::install inherits ntp { - if $package_manage { + if $ntp::package_manage { - package { $package_name: - ensure => $package_ensure, + package { $ntp::package_name: + ensure => $ntp::package_ensure, } } diff --git a/manifests/service.pp b/manifests/service.pp index 3f1ada0b..6bc951bf 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,15 +1,15 @@ # class ntp::service inherits ntp { - if ! ($service_ensure in [ 'running', 'stopped' ]) { + if ! ($ntp::service_ensure in [ 'running', 'stopped' ]) { fail('service_ensure parameter must be running or stopped') } - if $service_manage == true { + if $ntp::service_manage == true { service { 'ntp': - ensure => $service_ensure, - enable => $service_enable, - name => $service_name, + ensure => $ntp::service_ensure, + enable => $ntp::service_enable, + name => $ntp::service_name, hasstatus => true, hasrestart => true, } From fbb80430444c5773aee4dd4f1045efb17d5a240c Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Mon, 23 Mar 2015 12:08:24 -0700 Subject: [PATCH 4/5] Keep testing on puppet 2.7 The modulesync config repo is dropping universal support for puppet 2.7, but individual repos should still keep support until the next naturally-occuring major release. --- .sync.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.sync.yml b/.sync.yml index 66a03c64..ac837907 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,3 +1,9 @@ --- +.travis.yml: + extras: + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" spec/spec_helper.rb: unmanaged: true From dffe18dd5cfc07f17e7f6530d75bba729e9c0d60 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Mon, 23 Mar 2015 12:24:45 -0700 Subject: [PATCH 5/5] Update .travis.yml This commit makes the following changes to the test matrix: - Runs tests on ruby 2.1.5 instead of 2.0.0 - Runs tests on ruby 1.8.7 with puppet 3.x - Adds an environment to run on an intermediate 3.x puppet version instead of latest (specifically 3.4.x) - Adds an environment to run with the future parser on latest puppet. This would affect the test runs for the validate and spec checks. - Runs the tests on docker --- .travis.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6cf8b004..d1a0d7cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,28 @@ --- +sudo: false language: ruby bundler_args: --without system_tests script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" matrix: fast_finish: true include: + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.4.0" - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" + env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.4.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" notifications: email: false