Skip to content

Commit 37240cc

Browse files
author
Pete Brown
committed
Merge pull request #13 from abstractitptyltd/spec_tests
Spec tests
2 parents 7537759 + edcf023 commit 37240cc

30 files changed

Lines changed: 1079 additions & 23 deletions

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; Plugins are available for notepad++, emacs, vim, gedit,
3+
; textmate, visual studio, and more.
4+
;
5+
; See http://editorconfig.org for details.
6+
7+
root = true
8+
9+
[*]
10+
indent_style = space
11+
indent_size = 2
12+
end_of_line = lf
13+
insert_final_newline = true
14+
trim_trailing_whitespace = true

.fixtures.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
fixtures:
2+
forge_modules:
3+
stdlib:
4+
repo: "puppetlabs/stdlib"
5+
ref: "4.1.0"
6+
concat:
7+
repo: "puppetlabs/concat"
8+
ref: "1.2.0"
9+
symlinks:
10+
sudo: "#{source_dir}"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
pkg/
2-
spec/

.rspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--format documentation
2+
--color

.travis.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
language: ruby
2+
sudo: false
3+
bundler_args: --without development
4+
before_install: rm Gemfile.lock || true
5+
rvm:
6+
- 1.9
7+
- 2.0
8+
- 2.1
9+
script: bundle exec rake test
10+
env:
11+
- PUPPET_VERSION="~> 3.6.0" STRICT_VARIABLES=true
12+
- PUPPET_VERSION="~> 3.7.0" STRICT_VARIABLES=true
13+
- PUPPET_VERSION="~> 3.8.0" STRICT_VARIABLES=true
14+
- PUPPET_VERSION="~> 3.8.0" STRICT_VARIABLES=true PARSER="future"
15+
- PUPPET_VERSION="~> 4.0.0" STRICT_VARIABLES=true
16+
- PUPPET_VERSION="~> 4.1.0" STRICT_VARIABLES=true
17+
- PUPPET_VERSION="~> 4.2.0" STRICT_VARIABLES=true
18+
matrix:
19+
exclude:
20+
- rvm: 1.9
21+
env: PUPPET_VERSION="~> 4.0.0" STRICT_VARIABLES=true
22+
- rvm: 1.9
23+
env: PUPPET_VERSION="~> 4.1.0" STRICT_VARIABLES=true
24+
- rvm: 1.9
25+
env: PUPPET_VERSION="~> 4.2.0" STRICT_VARIABLES=true
26+
- rvm: 2.0
27+
env: PUPPET_VERSION="~> 4.0.0" STRICT_VARIABLES=true
28+
- rvm: 2.0
29+
env: PUPPET_VERSION="~> 4.1.0" STRICT_VARIABLES=true
30+
- rvm: 2.0
31+
env: PUPPET_VERSION="~> 4.2.0" STRICT_VARIABLES=true
32+
notifications:
33+
slack:
34+
secure: Bgqq8f5Ej+g78Iy8o0HSexx4OyCrO2eNrSiev8O8FCB2zQSNZ82EUnuXwDq5LeHJZb3eTBM/6NcAYeXRNuHwgniQQef9xiHC8uBvV3pMstAe5pa+9l7OaXzKyMrVhbjUfqZUhnRYPHY+OYgUMb4UfotfxvRCduPj1YhMrSVXocs=
35+
deploy:
36+
provider: puppetforge
37+
user: abstractit
38+
password:
39+
secure: ZbtzOD15CmlaLJ0zK2qwLLaqXDk+Ile/2nGwZQ3pV5+cx6ILBVHN/cH0PaddVM9z2bV8k/sHN9ZCe5NXEyC54Vta8jCgLvIckS0tRqNICagn5BMhyEg5jSP7IIDhM9pWgF9KiJyMtx+8iWIt6h7v5+HbOylUuSUyhA0ewpFp2GA=
40+
on:
41+
tags: true
42+
rvm: 2.1
43+
condition:
44+
- $PUPPET_VERSION = '~> 4.2.0'
45+
- $STRICT_VARIABLES = true

.yardopts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--markup markdown

Gemfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
source 'https://rubygems.org'
2+
3+
group :test do
4+
gem 'rake'
5+
gem 'puppet', ENV['PUPPET_VERSION'] || '~> 4.2.0'
6+
gem 'puppet-lint', :git => 'https://github.com/rodjek/puppet-lint'
7+
gem 'puppet-lint-unquoted_string-check', :require => false
8+
gem 'puppet-lint-empty_string-check', :require => false
9+
gem 'puppet-lint-leading_zero-check', :require => false
10+
gem 'puppet-lint-variable_contains_upcase', :require => false
11+
gem 'puppet-lint-spaceship_operator_without_tag-check', :require => false
12+
gem 'puppet-lint-absolute_classname-check', :require => false
13+
gem 'puppet-lint-undef_in_function-check', :require => false
14+
gem 'puppet-lint-roles_and_profiles-check', :require => false
15+
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet'#'~> 2.1'
16+
gem 'rspec-puppet-facts', :git => 'https://github.com/mcanevet/rspec-puppet-facts',:require => false
17+
gem "puppet-syntax"
18+
gem 'metadata-json-lint', :require => false
19+
gem 'puppetlabs_spec_helper', :git => 'https://github.com/puppetlabs/puppetlabs_spec_helper'
20+
gem "rspec", '< 3.2.0'
21+
# gem 'coveralls', require: false
22+
gem 'pry', '<= 0.9.8'
23+
gem "puppet-blacksmith"
24+
end
25+
26+
group :development do
27+
gem 'travis'
28+
gem 'travis-lint'
29+
# gem "beaker", :git => 'https://github.com/puppetlabs/beaker.git'
30+
# gem "beaker-rspec"
31+
end

Gemfile.lock

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
GIT
2+
remote: https://github.com/mcanevet/rspec-puppet-facts
3+
revision: dbdf4deda25d03e9a68d462dc5adfc0fda5ab4ca
4+
specs:
5+
rspec-puppet-facts (1.1.1)
6+
facter
7+
facterdb (>= 0.2.0)
8+
json
9+
puppet
10+
11+
GIT
12+
remote: https://github.com/puppetlabs/puppetlabs_spec_helper
13+
revision: ea5d01fd13aef495b2c7da8e802a3939966f6729
14+
specs:
15+
puppetlabs_spec_helper (0.10.3)
16+
mocha
17+
puppet-lint
18+
puppet-syntax
19+
rake
20+
rspec-puppet
21+
22+
GIT
23+
remote: https://github.com/rodjek/puppet-lint
24+
revision: 2546fed6be894bbcff15c3f48d4b6f6bc15d94d1
25+
specs:
26+
puppet-lint (1.1.0)
27+
28+
GIT
29+
remote: https://github.com/rodjek/rspec-puppet
30+
revision: 7659172a5f47c286c03ba6fa76a39cac1087c324
31+
specs:
32+
rspec-puppet (2.2.1.pre)
33+
rspec
34+
35+
GEM
36+
remote: https://rubygems.org/
37+
specs:
38+
CFPropertyList (2.2.8)
39+
addressable (2.3.8)
40+
backports (3.6.6)
41+
coderay (1.0.9)
42+
diff-lcs (1.2.5)
43+
domain_name (0.5.25)
44+
unf (>= 0.0.5, < 1.0.0)
45+
ethon (0.8.0)
46+
ffi (>= 1.3.0)
47+
facter (2.4.4)
48+
CFPropertyList (~> 2.2.6)
49+
facterdb (0.2.1)
50+
facter
51+
jgrep
52+
json
53+
faraday (0.9.2)
54+
multipart-post (>= 1.2, < 3)
55+
faraday_middleware (0.10.0)
56+
faraday (>= 0.7.4, < 0.10)
57+
ffi (1.9.10)
58+
gh (0.14.0)
59+
addressable
60+
backports
61+
faraday (~> 0.8)
62+
multi_json (~> 1.0)
63+
net-http-persistent (>= 2.7)
64+
net-http-pipeline
65+
hiera (3.0.1)
66+
json_pure
67+
highline (1.7.8)
68+
http-cookie (1.0.2)
69+
domain_name (~> 0.5)
70+
jgrep (1.3.3)
71+
json
72+
json (1.8.3)
73+
json_pure (1.8.3)
74+
launchy (2.4.3)
75+
addressable (~> 2.3)
76+
metaclass (0.0.4)
77+
metadata-json-lint (0.0.11)
78+
json
79+
spdx-licenses (~> 1.0)
80+
method_source (0.7.1)
81+
mime-types (2.6.2)
82+
mocha (1.1.0)
83+
metaclass (~> 0.0.1)
84+
multi_json (1.11.2)
85+
multipart-post (2.0.0)
86+
net-http-persistent (2.9.4)
87+
net-http-pipeline (1.0.1)
88+
netrc (0.10.3)
89+
pry (0.9.8)
90+
coderay (~> 1.0.5)
91+
method_source (~> 0.7)
92+
slop (>= 2.4.3, < 3)
93+
puppet (4.2.2)
94+
facter (> 2.0, < 4)
95+
hiera (>= 2.0, < 4)
96+
json_pure
97+
puppet-blacksmith (3.3.1)
98+
puppet (>= 2.7.16)
99+
rest-client
100+
puppet-lint-absolute_classname-check (0.1.3)
101+
puppet-lint (~> 1.0)
102+
puppet-lint-empty_string-check (0.2.1)
103+
puppet-lint (~> 1.0)
104+
puppet-lint-leading_zero-check (0.1.0)
105+
puppet-lint (~> 1.0)
106+
puppet-lint-roles_and_profiles-check (0.1.0)
107+
puppet-lint (~> 1.0)
108+
puppet-lint-spaceship_operator_without_tag-check (0.1.0)
109+
puppet-lint (~> 1.0)
110+
puppet-lint-undef_in_function-check (0.1.0)
111+
puppet-lint (~> 1.0)
112+
puppet-lint-unquoted_string-check (0.2.5)
113+
puppet-lint (~> 1.0)
114+
puppet-lint-variable_contains_upcase (1.0.0)
115+
puppet-lint (~> 1.0)
116+
puppet-syntax (2.0.0)
117+
rake
118+
pusher-client (0.6.2)
119+
json
120+
websocket (~> 1.0)
121+
rake (10.4.2)
122+
rest-client (1.8.0)
123+
http-cookie (>= 1.0.2, < 2.0)
124+
mime-types (>= 1.16, < 3.0)
125+
netrc (~> 0.7)
126+
rspec (3.1.0)
127+
rspec-core (~> 3.1.0)
128+
rspec-expectations (~> 3.1.0)
129+
rspec-mocks (~> 3.1.0)
130+
rspec-core (3.1.7)
131+
rspec-support (~> 3.1.0)
132+
rspec-expectations (3.1.2)
133+
diff-lcs (>= 1.2.0, < 2.0)
134+
rspec-support (~> 3.1.0)
135+
rspec-mocks (3.1.3)
136+
rspec-support (~> 3.1.0)
137+
rspec-support (3.1.2)
138+
slop (2.4.4)
139+
spdx-licenses (1.0.0)
140+
json
141+
travis (1.8.0)
142+
addressable (~> 2.3)
143+
backports
144+
faraday (~> 0.9)
145+
faraday_middleware (~> 0.9, >= 0.9.1)
146+
gh (~> 0.13)
147+
highline (~> 1.6)
148+
launchy (~> 2.1)
149+
pry (~> 0.9, < 0.10)
150+
pusher-client (~> 0.4)
151+
typhoeus (~> 0.6, >= 0.6.8)
152+
travis-lint (2.0.0)
153+
json
154+
typhoeus (0.8.0)
155+
ethon (>= 0.8.0)
156+
unf (0.1.4)
157+
unf_ext
158+
unf_ext (0.0.7.1)
159+
websocket (1.2.2)
160+
161+
PLATFORMS
162+
ruby
163+
164+
DEPENDENCIES
165+
metadata-json-lint
166+
pry (<= 0.9.8)
167+
puppet (~> 4.2.0)
168+
puppet-blacksmith
169+
puppet-lint!
170+
puppet-lint-absolute_classname-check
171+
puppet-lint-empty_string-check
172+
puppet-lint-leading_zero-check
173+
puppet-lint-roles_and_profiles-check
174+
puppet-lint-spaceship_operator_without_tag-check
175+
puppet-lint-undef_in_function-check
176+
puppet-lint-unquoted_string-check
177+
puppet-lint-variable_contains_upcase
178+
puppet-syntax
179+
puppetlabs_spec_helper!
180+
rake
181+
rspec (< 3.2.0)
182+
rspec-puppet!
183+
rspec-puppet-facts!
184+
travis
185+
travis-lint
186+
187+
BUNDLED WITH
188+
1.10.6

Rakefile

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
require 'rubygems'
2+
require 'puppetlabs_spec_helper/rake_tasks'
3+
require 'puppet-lint/tasks/puppet-lint'
4+
require 'metadata-json-lint/rake_task'
5+
require 'puppet-syntax/tasks/puppet-syntax'
6+
7+
begin
8+
require 'puppet_blacksmith/rake_tasks'
9+
rescue LoadError
10+
end
11+
12+
PuppetLint.configuration.fail_on_warnings = true
13+
PuppetLint.configuration.relative = true
14+
PuppetLint.configuration.send('disable_80chars')
15+
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
16+
# PuppetLint.configuration.send('disable_class_parameter_defaults')
17+
PuppetLint.configuration.send('disable_documentation')
18+
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
19+
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
20+
21+
PuppetLint.configuration.send('disable_selector_inside_resource')
22+
PuppetLint.configuration.send('disable_empty_string_assignment')
23+
24+
exclude_paths = [
25+
"pkg/**/*",
26+
"vendor/**/*",
27+
"spec/**/*",
28+
]
29+
30+
PuppetLint.configuration.ignore_paths = exclude_paths
31+
PuppetSyntax.exclude_paths = exclude_paths
32+
33+
desc "Populate CONTRIBUTORS file"
34+
task :contributors do
35+
system("git log --format='%aN' | sort -u > CONTRIBUTORS")
36+
end
37+
38+
task :metadata do
39+
sh "bundle exec metadata-json-lint metadata.json"
40+
end
41+
42+
desc "Validate manifests, templates, and ruby files in lib."
43+
task :validate do
44+
Dir['manifests/**/*.pp'].each do |manifest|
45+
sh "puppet parser validate --noop #{manifest}"
46+
end
47+
Dir['lib/**/*.rb'].each do |lib_file|
48+
sh "ruby -c #{lib_file}"
49+
end
50+
Dir['templates/**/*.erb'].each do |template|
51+
sh "erb -P -x -T '-' #{template} | ruby -c"
52+
end
53+
end
54+
55+
desc "Run syntax, lint, and spec tests."
56+
task :test => [
57+
:syntax,
58+
:validate,
59+
:lint,
60+
:spec,
61+
:metadata,
62+
]
63+
64+
if RUBY_VERSION >= "2.1.0" then
65+
Blacksmith::RakeTask.new do |t|
66+
t.build = false # do not build the module nor push it to the Forge
67+
# just do the tagging [:clean, :tag, :bump_commit]
68+
end
69+
70+
desc "Offload release process to Travis."
71+
task :travis_release => [
72+
:check_changelog, # check that the changelog contains an entry for the current release
73+
:"module:release", # do everything except build / push to forge, travis will do that for us
74+
]
75+
76+
desc "Check Changelog."
77+
task :check_changelog do
78+
v = Blacksmith::Modulefile.new.version
79+
if File.readlines('CHANGELOG.md').grep("Releasing #{v}").size == 0 then
80+
fail "Unable to find a CHANGELOG.md entry for the #{v} release."
81+
end
82+
end
83+
end

0 commit comments

Comments
 (0)