-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from adamcrews/spec_update
Spec update & Misc fixes
- Loading branch information
Showing
10 changed files
with
176 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |