Skip to content

Commit

Permalink
Merge pull request #3 from adamcrews/spec_update
Browse files Browse the repository at this point in the history
Spec update & Misc fixes
  • Loading branch information
adamcrews committed May 26, 2015
2 parents 6cce0ee + f615af6 commit a4bf717
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 78 deletions.
40 changes: 29 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
---
language: ruby
bundler_args: --without development
bundler_args: --without development system_tests
before_install: rm Gemfile.lock || true
script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
script: bundle exec rake test
rvm:
- 1.9.3
- 2.0.0
- 2.1.0
env:
- PUPPET_GEM_VERSION="~> 3.4.0"
- PUPPET_GEM_VERSION="~> 3.5.0"
- PUPPET_GEM_VERSION="~> 3.6.0"
- PUPPET_VERSION="~> 3.2.0"
- PUPPET_VERSION="~> 3.3.0"
- PUPPET_VERSION="~> 3.4.0"
- PUPPET_VERSION="~> 3.5.0" STRICT_VARIABLES=yes
- PUPPET_VERSION="~> 3.6.0" STRICT_VARIABLES=yes
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=yes
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes
- PUPPET_VERSION="~> 4.0.0" STRICT_VARIABLES=yes

matrix:
exclude:
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 2.7.0"
# Ruby 1.9.3
- rvm: 1.9.3
env: PUPPET_VERSION="~> 2.7.0"

# Ruby 2.0.0
- rvm: 2.0.0
env: PUPPET_VERSION="~> 2.7.0"

# Ruby 2.1.0
- rvm: 2.1.0
env: PUPPET_VERSION="~> 2.7.0"
- rvm: 2.1.0
env: PUPPET_VERSION="~> 3.2.0"
- rvm: 2.1.0
env: PUPPET_VERSION="~> 3.3.0"
- rvm: 2.1.0
env: PUPPET_VERSION="~> 3.4.0"
notifications:
email: false
36 changes: 34 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,42 @@
2015-05-26 08:41:12 -0700 Adam Crews

* Fixed quoting on param (HEAD, spec_update)

2015-05-26 08:40:55 -0700 Adam Crews

* Fixed tests to better check content

2015-05-26 06:32:19 -0700 Adam Crews

* Fix license name (origin/spec_update)

2015-05-26 06:28:34 -0700 Adam Crews

* Update spec tests, prep for a release

2015-05-26 14:01:10 +0200 Steve Traylen

* Eplicitly specify origin of class variables

2015-05-26 13:35:13 +0200 Steve Traylen

* Typo in error message

2015-05-26 13:33:23 +0200 Steve Traylen

* Ensure default works on redhat 5 systems. In particular it avoids the following error:

2015-05-26 13:25:10 +0200 Steve Traylen

* Tests on contents of updatedb.conf

2014-12-02 12:03:15 -0800 Adam Crews

* Fixed badge url (HEAD, master)
* Fixed badge url

2014-12-02 12:01:23 -0800 Adam Crews

* Added forge badge (origin/master)
* Added forge badge

2014-07-30 13:55:24 -0700 Adam Crews

Expand Down
37 changes: 18 additions & 19 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"
source "https://rubygems.org"

group :development, :test do
gem 'rake', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'serverspec', :require => false
gem 'puppet-lint', :require => false
gem 'rspec', '< 2.99', :require => false
gem 'simplecov', :require => false
group :test do
gem "rake"
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0'
gem "rspec", '< 3.2.0'
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
gem "puppetlabs_spec_helper"
gem "metadata-json-lint"
gem "rspec-puppet-facts"
end

if facterversion = ENV['FACTER_GEM_VERSION']
gem 'facter', facterversion, :require => false
else
gem 'facter', :require => false
group :development do
gem "travis"
gem "travis-lint"
gem "vagrant-wrapper"
gem "puppet-blacksmith"
gem "guard-rake"
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
group :system_tests do
gem "beaker"
gem "beaker-rspec"
end

# vim:ft=ruby
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Install and manage the mlocate/updatedb package.
## Module Description

Mlocate is a useful tool that does a find of your system and records the files present.
It's a bit old, and not commonly used, irrelevant on dispisable systems, but I like it, so get off my lawn.
It's a bit old, not commonly used, irrelevant on disposable systems, but I like it, so get off my lawn.

## Setup

Expand Down
67 changes: 53 additions & 14 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,56 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet/version'
require 'puppet/vendor/semantic/lib/semantic' unless Puppet.version.to_f < 3.6
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc "Validate manifests, templates, and ruby files"
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
require 'puppet-syntax/tasks/puppet-syntax'

# These gems aren't always present, for instance
# on Travis with --without development
begin
require 'puppet_blacksmith/rake_tasks'
rescue LoadError
end

Rake::Task[:lint].clear

PuppetLint.configuration.relative = true
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
PuppetLint.configuration.fail_on_warnings = true

# Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
# http://puppet-lint.com/checks/class_parameter_defaults/
PuppetLint.configuration.send('disable_class_parameter_defaults')
# http://puppet-lint.com/checks/class_inherits_from_params_class/
PuppetLint.configuration.send('disable_class_inherits_from_params_class')

exclude_paths = [
"bundle/**/*",
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths

desc "Run acceptance tests"
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end

desc "Populate CONTRIBUTORS file"
task :contributors do
system("git log --format='%aN' | sort -u > CONTRIBUTORS")
end

task :metadata do
sh "metadata-json-lint metadata.json"
end

desc "Run syntax, lint, and spec tests."
task :test => [
:syntax,
:lint,
:spec,
:metadata,
]
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$update_on_install = true
$conf_file = '/etc/updatedb.conf'
$cron_ensure = 'present'
if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == 5 {
if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '5' {
$prune_bind_mounts = undef
$prunenames = undef
} else {
Expand Down
12 changes: 6 additions & 6 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"name": "adamcrews-mlocate",
"version": "0.1.2",
"version": "0.2.0",
"author": "Adam Crews",
"summary": "Manage the mlocate package for updatedb/locate.",
"license": "Apache 2.0",
"license": "Apache-2.0",
"source": "https://github.com/adamcrews/puppet-mlocate.git",
"project_page": "https://github.com/adamcrews/puppet-mlocate",
"issues_url": "https://github.com/adamcrews/puppet-mlocate/issues",
"requirements": [
{
"name": "pe",
"version_requirement": ">=3.2.0 <3.4.0"
"version_requirement": ">=3.2.0 <4.0.0"
},
{
"name": "puppet",
"version_requirement": ">=3.0.0 <4.0.0"
"version_requirement": ">=3.0.0 <4.2.0"
}
],
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
"operatingsystem_release": [
"operatingsystemrelease": [
"5",
"6"
]
},
{
"operatingsystem": "CentOS",
"operatingsystem_release": [
"operatingsystemrelease": [
"5",
"6"
]
Expand Down
24 changes: 0 additions & 24 deletions spec/classes/init_spec.rb

This file was deleted.

32 changes: 32 additions & 0 deletions spec/classes/mlocate_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require 'spec_helper'

describe 'mlocate' do

context 'supported operating systems' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end

context 'with defaults for all parameters' do
it { should contain_class('mlocate') }
it { should contain_class('mlocate::install') }
it { should contain_class('mlocate::cron') }

it { should contain_file('updatedb.conf').with_path('/etc/updatedb.conf') }
it { should contain_file('updatedb.conf').with_content(/^PRUNEPATHS = \"\/afs .*$/) }
it { should contain_file('updatedb.conf').with_content(/^PRUNEFS = \"9p afs .*$/) }

if facts[:osfamily] == 'RedHat' and facts[:operatingsystemmajrelease] == '5' then
it { should contain_file('updatedb.conf').without_content(/^PRUNE_BIND_MOUNTS.*$/) }
it { should contain_file('updatedb.conf').without_content(/^PRUNENAMES.*$/) }
else
it { should contain_file('updatedb.conf').with_content(/^PRUNE_BIND_MOUNTS = "yes"$/) }
it { should contain_file('updatedb.conf').with_content(/^PRUNENAMES = ".git .hg .svn"$/) }
end
end
end
end
end
end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts

0 comments on commit a4bf717

Please sign in to comment.