Commit 2befbaa0 authored by Vikraman Choudhury's avatar Vikraman Choudhury Committed by GitHub
Browse files

Merge pull request #151 from ghoneycutt/improve_testing

Improve testing
parents 53618fde 45f36790
fixtures:
repositories:
'concat':
repo: 'https://github.com/puppetlabs/puppetlabs-concat.git'
ref: '1.2.5'
'stdlib':
repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
ref: '4.6.0'
symlinks:
'portage': "#{source_dir}"
# Default .gitignore for Ruby
*.gem
*.rbc
.bundle .bundle
.config
coverage
InstalledFiles
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
# YARD artifacts
.yardoc
_yardoc
doc/
# Vim
*.swp
# Eclipse
.project
# OS X
.DS_Store
# Puppet
coverage/
spec/fixtures/manifests/*
spec/fixtures/modules/*
Gemfile.lock Gemfile.lock
/pkg/
--- ---
language: ruby language: ruby
script: "bundle exec rspec --color --format documentation"
notifications:
email: false
rvm: rvm:
- 2.2.0
- 2.1.0
- 2.0.0
- 1.9.3 - 1.9.3
- 2.0.0
- 2.1.0
- 2.2.0
- 2.3.1
env:
matrix:
- PUPPET_GEM_VERSION="~> 3.1.0"
- PUPPET_GEM_VERSION="~> 3.2.0"
- PUPPET_GEM_VERSION="~> 3.3.0"
- PUPPET_GEM_VERSION="~> 3.4.0"
- PUPPET_GEM_VERSION="~> 3.5.0"
- PUPPET_GEM_VERSION="~> 3.6.0"
- PUPPET_GEM_VERSION="~> 3.7.0"
- PUPPET_GEM_VERSION="~> 3.8.0"
- PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes"
- PUPPET_GEM_VERSION="~> 4.0.0"
- PUPPET_GEM_VERSION="~> 4.1.0"
- PUPPET_GEM_VERSION="~> 4.2.0"
- PUPPET_GEM_VERSION="~> 4.3.0"
- PUPPET_GEM_VERSION="~> 4.4.0"
- PUPPET_GEM_VERSION="~> 4.5.0"
- PUPPET_GEM_VERSION="~> 4.6.0"
- PUPPET_GEM_VERSION="~> 4.7.0"
- PUPPET_GEM_VERSION="~> 4.8.0"
- PUPPET_GEM_VERSION="~> 4"
sudo: false
before_install:
- 'gem update --system'
- 'gem update bundler'
script: 'SPEC_OPTS="--format documentation" bundle exec rake validate lint spec'
matrix:
fast_finish: true
exclude:
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.2.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.3.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.4.0"
- rvm: 2.2.0
env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 2.2.0
env: PUPPET_GEM_VERSION="~> 3.2.0"
- rvm: 2.2.0
env: PUPPET_GEM_VERSION="~> 3.3.0"
- rvm: 2.2.0
env: PUPPET_GEM_VERSION="~> 3.4.0"
- rvm: 2.2.0
env: PUPPET_GEM_VERSION="~> 3.5.0"
- rvm: 2.2.0
env: PUPPET_GEM_VERSION="~> 3.6.0"
- rvm: 2.2.0
env: PUPPET_GEM_VERSION="~> 3.7.0"
- rvm: 2.2.0
env: PUPPET_GEM_VERSION="~> 3.8.0"
- rvm: 2.2.0
env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.2.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.3.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.4.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.5.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.6.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.7.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.8.0"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes"
notifications:
email: false
source 'https://rubygems.org' source ENV['GEM_SOURCE'] || 'https://rubygems.org'
# Earlier versions of puppet might work but have not been verified if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', '>= 2.7.12' gem 'puppet', puppetversion, :require => false
else
group(:development, :test) do gem 'puppet', :require => false
gem 'rspec', '~> 2.10.0', :require => false
gem 'mocha', '~> 0.10.5', :require => false
end end
gem 'puppetlabs_spec_helper', '>= 1.2.0'
gem 'facter', '>= 1.7.0'
gem 'rspec-puppet'
gem 'rspec-collection_matchers'
gem 'puppet-lint', '~> 2.0'
gem 'puppet-lint-absolute_classname-check'
gem 'puppet-lint-alias-check'
gem 'puppet-lint-empty_string-check'
gem 'puppet-lint-file_ensure-check'
gem 'puppet-lint-file_source_rights-check'
gem 'puppet-lint-leading_zero-check'
gem 'puppet-lint-spaceship_operator_without_tag-check'
gem 'puppet-lint-trailing_comma-check'
gem 'puppet-lint-undef_in_function-check'
gem 'puppet-lint-unquoted_string-check'
gem 'puppet-lint-variable_contains_upcase'
gem 'rspec', '~> 2.0', :require => false if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9'
gem 'rspec', :require => false if RUBY_VERSION >= '1.9'
gem 'rake', '~> 10.0', :require => false if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9'
gem 'rake', :require => false if RUBY_VERSION >= '1.9'
gem 'json', '<= 1.8', :require => false if RUBY_VERSION < '2.0.0'
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0'
gem 'metadata-json-lint', '0.0.11', :require => false if RUBY_VERSION < '1.9'
gem 'metadata-json-lint', :require => false if RUBY_VERSION >= '1.9'
gem 'mocha', :require => false
...@@ -187,3 +187,4 @@ Contributors ...@@ -187,3 +187,4 @@ Contributors
* [John-John Tedro](https://github.com/udoprog) * [John-John Tedro](https://github.com/udoprog)
* [Vikraman Choudhury](https://github.com/vikraman) * [Vikraman Choudhury](https://github.com/vikraman)
* [Matthias Saou](https://github.com/thias) * [Matthias Saou](https://github.com/thias)
* [Garrett Honeycutt](http://learnpuppet.com)
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_140chars')
PuppetLint.configuration.relative = true
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
end
...@@ -46,7 +46,7 @@ class portage ( ...@@ -46,7 +46,7 @@ class portage (
$portage_utils_use = $portage::params::portage_utils_use, $portage_utils_use = $portage::params::portage_utils_use,
) inherits portage::params { ) inherits portage::params {
include portage::install include ::portage::install
file { [ file { [
'/etc/portage/package.keywords', '/etc/portage/package.keywords',
...@@ -68,9 +68,9 @@ class portage ( ...@@ -68,9 +68,9 @@ class portage (
} }
concat { $make_conf: concat { $make_conf:
owner => 'root', owner => 'root',
group => 'root', group => 'root',
mode => '0644', mode => '0644',
} }
if ($make_conf_remerge) { if ($make_conf_remerge) {
...@@ -80,7 +80,7 @@ class portage ( ...@@ -80,7 +80,7 @@ class portage (
concat::fragment { 'makeconf_header': concat::fragment { 'makeconf_header':
target => $make_conf, target => $make_conf,
content => template('portage/makeconf.header.conf.erb'), content => template('portage/makeconf.header.conf.erb'),
order => '00' order => '00',
} }
} }
class portage::install { class portage::install {
include portage include ::portage
portage::package { 'sys-apps/portage': portage::package { 'sys-apps/portage':
ensure => $portage::portage_ensure, ensure => $portage::portage_ensure,
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
define portage::makeconf( define portage::makeconf(
$ensure = present, $ensure = present,
$content = '', $content = undef,
) { ) {
include portage include ::portage
if($ensure == 'present') { if($ensure == 'present') {
concat::fragment { $name: concat::fragment { $name:
......
...@@ -3,14 +3,11 @@ ...@@ -3,14 +3,11 @@
"version": "2.3.0", "version": "2.3.0",
"author": "Gentoo", "author": "Gentoo",
"summary": "Puppet types and providers for Gentoo portage", "summary": "Puppet types and providers for Gentoo portage",
"license": "GPLv2", "license": "GPL-2.0",
"source": "https://github.com/gentoo/puppet-portage.git", "source": "https://github.com/gentoo/puppet-portage.git",
"project_page": "https://github.com/gentoo/puppet-portage", "project_page": "https://github.com/gentoo/puppet-portage",
"issues_url": "https://github.com/gentoo/puppet-portage/issues", "issues_url": "https://github.com/gentoo/puppet-portage/issues",
"dependencies": [ "dependencies": [
{ {"name":"puppetlabs/concat","version_requirement":">= 1.0.0 < 2.0.0"}
"name": "puppetlabs/concat",
"version_range": "1.x"
}
] ]
} }
require 'rspec/collection_matchers'
dir = File.expand_path(File.join(File.dirname(__FILE__), "..")) dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib') $LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')
......
...@@ -60,7 +60,7 @@ describe Puppet::Type.type(:package_env) do ...@@ -60,7 +60,7 @@ describe Puppet::Type.type(:package_env) do
end end
it "should properly handle nested arrays" do it "should properly handle nested arrays" do
described_class.new(:name => "sys-devel/gcc", :env => ["foo",["bar"]]).property(:env).insync?(["foo","bar"]).should be_true described_class.new(:name => "sys-devel/gcc", :env => ["foo",["bar"]]).property(:env).insync?(["foo","bar"]).should eq true
end end
end end
end end
...@@ -64,7 +64,7 @@ describe Puppet::Type.type(:package_keywords) do ...@@ -64,7 +64,7 @@ describe Puppet::Type.type(:package_keywords) do
end end
it "should properly handle nested arrays" do it "should properly handle nested arrays" do
described_class.new(:name => "sys-devel/gcc", :keywords => ["foo",["bar"]]).property(:keywords).insync?(["foo","bar"]).should be_true described_class.new(:name => "sys-devel/gcc", :keywords => ["foo",["bar"]]).property(:keywords).insync?(["foo","bar"]).should eq true
end end
end end
end end
...@@ -64,7 +64,7 @@ describe Puppet::Type.type(:package_use) do ...@@ -64,7 +64,7 @@ describe Puppet::Type.type(:package_use) do
end end
it "should properly handle nested arrays" do it "should properly handle nested arrays" do
described_class.new(:name => "sys-devel/gcc", :use => ["foo",["bar"]]).property(:use).insync?(["foo","bar"]).should be_true described_class.new(:name => "sys-devel/gcc", :use => ["foo",["bar"]]).property(:use).insync?(["foo","bar"]).should eq true
end end
end end
end end
...@@ -37,13 +37,13 @@ describe Puppet::Util::Portage do ...@@ -37,13 +37,13 @@ describe Puppet::Util::Portage do
valid_atoms.each do |atom| valid_atoms.each do |atom|
it "should accept '#{atom}' as a valid name" do it "should accept '#{atom}' as a valid name" do
Puppet::Util::Portage.valid_atom?(atom).should be_true Puppet::Util::Portage.valid_atom?(atom).should eq true
end end
end end
invalid_atoms.each do |atom| invalid_atoms.each do |atom|
it "should reject #{atom} as an invalid name" do it "should reject #{atom} as an invalid name" do
Puppet::Util::Portage.valid_atom?(atom).should be_false Puppet::Util::Portage.valid_atom?(atom).should eq false
end end
end end
end end
...@@ -70,13 +70,13 @@ describe Puppet::Util::Portage do ...@@ -70,13 +70,13 @@ describe Puppet::Util::Portage do
valid_packages.each do |package| valid_packages.each do |package|
it "should accept #{package} as valid" do it "should accept #{package} as valid" do
Puppet::Util::Portage.valid_package?(package).should be_true Puppet::Util::Portage.valid_package?(package).should eq true
end end
end end
invalid_packages.each do |package| invalid_packages.each do |package|
it "should reject #{package} as invalid" do it "should reject #{package} as invalid" do
Puppet::Util::Portage.valid_package?(package).should be_false Puppet::Util::Portage.valid_package?(package).should eq false
end end
end end
end end
...@@ -113,7 +113,7 @@ describe Puppet::Util::Portage do ...@@ -113,7 +113,7 @@ describe Puppet::Util::Portage do
(valid_versions + valid_wildcards).each do |ver| (valid_versions + valid_wildcards).each do |ver|
it "should accept #{ver} as valid" do it "should accept #{ver} as valid" do
Puppet::Util::Portage.valid_version?(ver).should be_true Puppet::Util::Portage.valid_version?(ver).should eq true
end end
end end
...@@ -124,14 +124,14 @@ describe Puppet::Util::Portage do ...@@ -124,14 +124,14 @@ describe Puppet::Util::Portage do
version_strings.each do |ver| version_strings.each do |ver|
it "should accept #{ver} as valid" do it "should accept #{ver} as valid" do
Puppet::Util::Portage.valid_version?(ver).should be_true Puppet::Util::Portage.valid_version?(ver).should eq true
end end
end end
end end
(invalid_versions + invalid_wildcards).each do |ver| (invalid_versions + invalid_wildcards).each do |ver|
it "should reject #{ver} as invalid" do it "should reject #{ver} as invalid" do
Puppet::Util::Portage.valid_version?(ver).should be_false Puppet::Util::Portage.valid_version?(ver).should eq false
end end
end end
end end
...@@ -159,7 +159,7 @@ describe Puppet::Util::Portage do ...@@ -159,7 +159,7 @@ describe Puppet::Util::Portage do
valid_slots.each do |slot| valid_slots.each do |slot|
it "should accept #{slot} as valid" do it "should accept #{slot} as valid" do
Puppet::Util::Portage.valid_slot?(slot).should be_true Puppet::Util::Portage.valid_slot?(slot).should eq true
end end
end end
...@@ -175,14 +175,14 @@ describe Puppet::Util::Portage do ...@@ -175,14 +175,14 @@ describe Puppet::Util::Portage do
end end
slots_with_operators.each do |slot_str| slots_with_operators.each do |slot_str|
it "should accept #{slot_str} as valid" do it "should accept #{slot_str} as valid" do
Puppet::Util::Portage.valid_slot?(slot_str).should be_true Puppet::Util::Portage.valid_slot?(slot_str).should eq true
end end
end end
end end
invalid_slots.each do |slot| invalid_slots.each do |slot|
it "should reject #{slot} as invalid" do it "should reject #{slot} as invalid" do
Puppet::Util::Portage.valid_slot?(slot).should be_false Puppet::Util::Portage.valid_slot?(slot).should eq false
end end
end end
end end
......
...@@ -25,13 +25,13 @@ describe Puppet::Util::Webapp do ...@@ -25,13 +25,13 @@ describe Puppet::Util::Webapp do
valid_names.each do |name| valid_names.each do |name|
it "should accept '#{name}' as a valid name" do it "should accept '#{name}' as a valid name" do
Puppet::Util::Webapp.valid_name?(name).should be_true Puppet::Util::Webapp.valid_name?(name).should eq true
end end
end end
invalid_names.each do |name| invalid_names.each do |name|
it "should reject '#{name}' as an invalid name" do it "should reject '#{name}' as an invalid name" do
Puppet::Util::Webapp.valid_name?(name).should be_false Puppet::Util::Webapp.valid_name?(name).should eq false
end end
end end
end end
...@@ -55,13 +55,13 @@ describe Puppet::Util::Webapp do ...@@ -55,13 +55,13 @@ describe Puppet::Util::Webapp do
valid_paths.each do |path| valid_paths.each do |path|
it "should accept '#{path}' as a valid path" do it "should accept '#{path}' as a valid path" do
Puppet::Util::Webapp.valid_path?(path).should be_true Puppet::Util::Webapp.valid_path?(path).should eq true
end end
end end
invalid_paths.each do |path| invalid_paths.each do |path|
it "should reject '#{path}' as an invalid path" do it "should reject '#{path}' as an invalid path" do
Puppet::Util::Webapp.valid_path?(path).should be_false Puppet::Util::Webapp.valid_path?(path).should eq false
end end
end end
end end
...@@ -81,13 +81,13 @@ describe Puppet::Util::Webapp do ...@@ -81,13 +81,13 @@ describe Puppet::Util::Webapp do
valid_apps.each do |app| valid_apps.each do |app|
it "should accept '#{app}' as a valid app" do it "should accept '#{app}' as a valid app" do
Puppet::Util::Webapp.valid_app?(app).should be_true Puppet::Util::Webapp.valid_app?(app).should eq true
end end
end end
invalid_apps.each do |app| invalid_apps.each do |app|
it "should reject '#{app}' as an invalid app" do it "should reject '#{app}' as an invalid app" do
Puppet::Util::Webapp.valid_app?(app).should be_false Puppet::Util::Webapp.valid_app?(app).should eq false
end end
end end
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment