Skip to content

Commit 45a0120

Browse files
author
Aaron Hicks
committed
Update test suite
1 parent 3de99e8 commit 45a0120

8 files changed

+249
-28
lines changed

.fixtures.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
fixtures:
2-
repositories:
3-
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
2+
forge_modules:
3+
stdlib:
4+
repo: 'puppetlabs-stdlib'
5+
ref: '4.6.0'
46
symlinks:
5-
rrd: "#{source_dir}"
7+
ganglia: "#{source_dir}"

.gitattributes

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
# *.c text
7+
# *.h text
8+
9+
# Declare files that will always have LF line endings on checkout.
10+
*.pp text eol=lf linguist-language=Puppet
11+
*.rb text eol=lf
12+
*.md text eol=lf
13+
*.yml text eol=lf
14+
*.erb text eol=lf linguist-language=Ruby
15+
*.conf text eol=lf linguist-language=INI
16+
*.markdown text eol=lf
17+
Gemfile text eol=lf
18+
Rakefile text eol=lf
19+
20+
# Declare files that will always have CRLF line endings on checkout.
21+
*.sln text eol=crlf
22+
*.ps1 text eol=crlf
23+
24+
# Denote all files that are truly binary and should not be modified.
25+
*.png binary
26+
*.jpg binary

.travis.yml

+53-8
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,72 @@
11
language: ruby
2-
bundler_args: --without development
3-
script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
2+
sudo: false
3+
4+
before_script:
5+
- bundle exec metadata-json-lint metadata.json
6+
- bundle exec rake validate_ruby_syntax
7+
- bundle exec rake check_line_endings
8+
- bundle exec rake syntax
9+
- bundle exec rake lint
10+
11+
script:
12+
- bundle exec rake spec SPEC_OPTS='--format documentation'
13+
414
rvm:
515
- 1.8.7
616
- 1.9.3
7-
- ruby-head
17+
- 2.0.0
18+
- 2.1.1
19+
820
env:
21+
matrix:
922
- PUPPET_GEM_VERSION="~> 2.6.0"
1023
- PUPPET_GEM_VERSION="~> 2.7.0"
1124
- PUPPET_GEM_VERSION="~> 3.0.0"
1225
- PUPPET_GEM_VERSION="~> 3.1.0"
26+
- PUPPET_GEM_VERSION="~> 3.2.0"
27+
- PUPPET_GEM_VERSION="~> 3.3.0"
28+
- PUPPET_GEM_VERSION="~> 3.4.0"
29+
- PUPPET_GEM_VERSION="~> 3.5.0"
30+
- PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes"
31+
- PUPPET_GEM_VERSION="~> 3.6.0"
32+
- PUPPET_GEM_VERSION="~> 3.6.0" STRICT_VARIABLES="yes"
33+
- PUPPET_GEM_VERSION="~> 3.7.0"
34+
- PUPPET_GEM_VERSION="~> 3.7.0" STRICT_VARIABLES="yes"
35+
1336
matrix:
37+
fast_finish: true
1438
allow_failures:
15-
- rvm: ruby-head
1639
- env: PUPPET_GEM_VERSION="~> 2.6.0"
40+
- env: PUPPET_GEM_VERSION="~> 2.7.0"
41+
- env: PUPPET_GEM_VERSION="~> 3.0.0"
42+
- env: PUPPET_GEM_VERSION="~> 3.1.0"
1743
exclude:
1844
- rvm: 1.9.3
1945
env: PUPPET_GEM_VERSION="~> 2.7.0"
20-
- rvm: ruby-head
21-
env: PUPPET_GEM_VERSION="~> 2.7.0"
2246
- rvm: 1.9.3
2347
env: PUPPET_GEM_VERSION="~> 2.6.0"
24-
- rvm: ruby-head
48+
- rvm: 2.0.0
49+
env: PUPPET_GEM_VERSION="~> 2.6.0"
50+
- rvm: 2.0.0
51+
env: PUPPET_GEM_VERSION="~> 2.7.0"
52+
- rvm: 2.0.0
53+
env: PUPPET_GEM_VERSION="~> 3.0.0"
54+
- rvm: 2.0.0
55+
env: PUPPET_GEM_VERSION="~> 3.1.0"
56+
- rvm: 2.1.1
2557
env: PUPPET_GEM_VERSION="~> 2.6.0"
58+
- rvm: 2.1.1
59+
env: PUPPET_GEM_VERSION="~> 2.7.0"
60+
- rvm: 2.1.1
61+
env: PUPPET_GEM_VERSION="~> 3.0.0"
62+
- rvm: 2.1.1
63+
env: PUPPET_GEM_VERSION="~> 3.1.0"
64+
- rvm: 2.1.1
65+
env: PUPPET_GEM_VERSION="~> 3.2.0"
66+
- rvm: 2.1.1
67+
env: PUPPET_GEM_VERSION="~> 3.3.0"
68+
- rvm: 2.1.1
69+
env: PUPPET_GEM_VERSION="~> 3.4.0"
70+
2671
notifications:
27-
email: false
72+
email: false

Gemfile

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
source 'https://rubygems.org'
22

3-
group :development, :test do
4-
gem 'puppetlabs_spec_helper', :require => false
5-
end
3+
gem 'metadata-json-lint'
4+
gem 'rspec-puppet-facts'
5+
gem 'puppetlabs_spec_helper', '>= 0.1.0'
6+
gem 'puppet-lint', '>= 1.0.0'
67

78
if puppetversion = ENV['PUPPET_GEM_VERSION']
8-
gem 'puppet', puppetversion, :require => false
9+
gem 'puppet', puppetversion
910
else
10-
gem 'puppet', :require => false
11+
gem 'puppet'
12+
end
13+
14+
# rspec must be v2 for ruby 1.8.7
15+
if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9'
16+
gem 'rspec', '~> 2.0'
1117
end
1218

13-
# vim:ft=ruby
19+
# vim:ft=ruby

Modulefile

-11
This file was deleted.

Rakefile

+52
Original file line numberDiff line numberDiff line change
@@ -1 +1,53 @@
11
require 'puppetlabs_spec_helper/rake_tasks'
2+
require 'puppet-lint/tasks/puppet-lint'
3+
require 'puppet-syntax/tasks/puppet-syntax'
4+
5+
exclude_paths = [
6+
'spec/**/*',
7+
'pkg/**/*',
8+
'tests/**/*'
9+
]
10+
11+
PuppetSyntax.exclude_paths = exclude_paths
12+
13+
Rake::Task[:lint].clear
14+
PuppetLint::RakeTask.new :lint do |config|
15+
# Pattern of files to ignore
16+
config.ignore_paths = exclude_paths
17+
18+
# List of checks to disable
19+
config.disable_checks = [
20+
'80chars',
21+
'class_parameter_defaults',
22+
'class_inherits_from_params_class',
23+
'autoloader_layout'
24+
]
25+
26+
# Should the task fail if there were any warnings, defaults to false
27+
config.fail_on_warnings = true
28+
29+
# Print out the context for the problem, defaults to false
30+
config.with_context = true
31+
32+
# Format string for puppet-lint's output (see the puppet-lint help output
33+
# for details
34+
config.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
35+
36+
# Compare module layout relative to the module root
37+
# config.relative = true
38+
end
39+
40+
desc 'Check for ruby syntax errors.'
41+
task :validate_ruby_syntax do
42+
ruby_parse_command = 'ruby -c'
43+
Dir['spec/**/*.rb'].each do |path|
44+
sh "#{ruby_parse_command} #{path}"
45+
end
46+
end
47+
48+
desc 'Check for evil line endings.'
49+
task :check_line_endings do
50+
Dir['spec/**/*.rb','manifests/**/*.pp','tests/**/*.pp'].each do |path|
51+
sh "file #{path}|grep -v CRLF"
52+
end
53+
end

metadata.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "Aethylred-rrd",
3+
"version": "0.1.0",
4+
"summary": "A Puppet Module to install and configure the Round Robin Database tools, cache and bindings.",
5+
"author": "Aethylred",
6+
"description": "This is a Puppet Module for installing and configuring the [Round Robin Database](http://oss.oetiker.ch/rrdtool/) tools, cache, and bindings.",
7+
"dependencies": [
8+
{
9+
"name": "puppetlabs/stdlib",
10+
"version_requirement": ">=3.2.0 <5.0.0"
11+
}
12+
],
13+
"source": "https://github.com/nesi/puppet-rrd",
14+
"project_page": "https://github.com/nesi/puppet-rrd",
15+
"issues_url": "https://github.com/nesi/puppet-rrd/issues",
16+
"license": "Apache-2.0",
17+
"operatingsystem_support": [
18+
{
19+
"operatingsystem": "Debian",
20+
"operatingsystemrelease": [
21+
"6",
22+
"7"
23+
]
24+
},
25+
{
26+
"operatingsystem": "Ubuntu",
27+
"operatingsystemrelease": [
28+
"10.04",
29+
"12.04",
30+
"14.04"
31+
]
32+
},
33+
{
34+
"operatingsystem": "RedHat",
35+
"operatingsystemrelease": [
36+
"5",
37+
"6",
38+
"7"
39+
]
40+
},
41+
{
42+
"operatingsystem": "CentOS",
43+
"operatingsystemrelease": [
44+
"5",
45+
"6",
46+
"7"
47+
]
48+
}
49+
]
50+
}

spec/spec_helper.rb

+51
Original file line numberDiff line numberDiff line change
@@ -1 +1,52 @@
11
require 'puppetlabs_spec_helper/module_spec_helper'
2+
require 'rspec-puppet-facts'
3+
include RspecPuppetFacts
4+
5+
RSpec.configure do |c|
6+
7+
c.treat_symbols_as_metadata_keys_with_true_values = true
8+
9+
c.before :each do
10+
# Ensure that we don't accidentally cache facts and environment
11+
# between test cases.
12+
Facter::Util::Loader.any_instance.stubs(:load_all)
13+
Facter.clear
14+
Facter.clear_messages
15+
16+
# Store any environment variables away to be restored later
17+
@old_env = {}
18+
ENV.each_key {|k| @old_env[k] = ENV[k]}
19+
20+
if ENV['STRICT_VARIABLES'] == 'yes'
21+
Puppet.settings[:strict_variables]=true
22+
end
23+
end
24+
end
25+
26+
shared_examples :compile, :compile => true do
27+
it { should compile.with_all_deps }
28+
end
29+
30+
$supported_os = on_supported_os.map do |os, facts|
31+
os_expects = {}
32+
expects = {
33+
34+
}
35+
case facts[:osfamily]
36+
when 'Debian'
37+
expects.merge!( {
38+
39+
} )
40+
when 'RedHat'
41+
expects.merge!( {
42+
43+
} )
44+
end
45+
46+
os_expects = {
47+
:os => os,
48+
:facts => facts,
49+
:expects => expects
50+
}
51+
os_expects
52+
end

0 commit comments

Comments
 (0)