From 50cdf185f8c3f63145ebabebe50ede4002ba9ef1 Mon Sep 17 00:00:00 2001 From: Joseph Yaworski Date: Thu, 17 Mar 2016 14:23:21 -0400 Subject: [PATCH] Update from voxpupuli modulesync_config --- .gitignore | 13 ++- .rspec | 2 + .rubocop.yml | 70 ++++++++++++++ .sync.yml | 3 + .travis.yml | 44 +++++---- CONTRIBUTING.md | 96 +++++++++++++++++++ Gemfile | 82 ++++++++++------ Rakefile | 78 ++++----------- manifests/init.pp | 2 +- spec/acceptance/class_spec.rb | 40 +++----- spec/acceptance/nodesets/centos-511-x64.yml | 9 ++ spec/acceptance/nodesets/centos-66-x64-pe.yml | 11 +++ spec/acceptance/nodesets/centos-66-x64.yml | 9 ++ spec/acceptance/nodesets/centos-72-x64.yml | 9 ++ spec/acceptance/nodesets/debian-78-x64.yml | 9 ++ spec/acceptance/nodesets/debian-82-x64.yml | 9 ++ .../nodesets/ubuntu-server-1204-x64.yml | 9 ++ .../nodesets/ubuntu-server-1404-x64.yml | 9 ++ spec/classes/coverage_spec.rb | 3 + spec/spec_helper.rb | 20 +--- spec/spec_helper_acceptance.rb | 10 +- tests/init.pp | 4 +- 22 files changed, 382 insertions(+), 159 deletions(-) create mode 100644 .rspec create mode 100644 .rubocop.yml create mode 100644 .sync.yml create mode 100644 CONTRIBUTING.md create mode 100644 spec/acceptance/nodesets/centos-511-x64.yml create mode 100644 spec/acceptance/nodesets/centos-66-x64-pe.yml create mode 100644 spec/acceptance/nodesets/centos-66-x64.yml create mode 100644 spec/acceptance/nodesets/centos-72-x64.yml create mode 100644 spec/acceptance/nodesets/debian-78-x64.yml create mode 100644 spec/acceptance/nodesets/debian-82-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1204-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 spec/classes/coverage_spec.rb diff --git a/.gitignore b/.gitignore index 53895c1d..88946576 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,11 @@ -*.swp -*.swo -*.swn pkg/ +Gemfile.lock +vendor/ +spec/fixtures/ .vagrant/ .bundle/ -vendor/ -Gemfile.lock +coverage/ +log/ +.idea/ +*.iml +.*.sw diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..8c18f1ab --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--format documentation +--color diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..f4023ed4 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,70 @@ +AllCops: + Include: + - ./**/*.rb + Exclude: + - vendor/**/* + - pkg/**/* + - spec/fixtures/**/* + +# Configuration parameters: AllowURI, URISchemes. +Metrics/LineLength: + Max: 328 + +# 'Complexity' is very relative +Metrics/PerceivedComplexity: + Enabled: false + +# 'Complexity' is very relative +Metrics/CyclomaticComplexity: + Enabled: false + +# 'Complexity' is very relative +Metrics/AbcSize: + Enabled: false + +# Method length is not necessarily an indicator of code quality +Metrics/MethodLength: + Enabled: false + +# Module length is not necessarily an indicator of code quality +Metrics/ModuleLength: + Enabled: false + +# Class length is not necessarily an indicator of code quality +Metrics/ClassLength: + Enabled: false + +# dealbreaker: +Style/TrailingCommaInArguments: + Enabled: false +Style/TrailingCommaInLiteral: + Enabled: false +Style/ClosingParenthesisIndentation: + Enabled: false + +# we still support ruby 1.8 +Style/HashSyntax: + Enabled: false + +Lint/AmbiguousRegexpLiteral: + Enabled: true +Style/RegexpLiteral: + Enabled: true +Style/WordArray: + Enabled: true + +# this catches the cases of using `module` for parser functions, types, or +# providers +Style/ClassAndModuleChildren: + Enabled: false + +Style/Documentation: + Description: 'Document classes and non-namespace modules.' + Enabled: false + +# More comfortable block layouts +Style/BlockDelimiters: + Enabled: False + +Style/MultilineBlockLayout: + Enabled: False diff --git a/.sync.yml b/.sync.yml new file mode 100644 index 00000000..7895c548 --- /dev/null +++ b/.sync.yml @@ -0,0 +1,3 @@ +--- +.travis.yml: + secure: "Hw0ScFZ+tANSuxXvkQlHOtbnV+9O6FyIxY4e8ZuNiE+4E045olgGjqus+ffo0MoHOHzCPPbThF107yQIXXHCwIy3wzOVIjQ7KQ/yVeamCl4K9A4AFP1Pcr/zMTRdK16zrgxBH+6wDkjSxHGonT8AyUKBrT7AeET+pqxwVHvHCfo=" diff --git a/.travis.yml b/.travis.yml index 1162891a..d9ff9732 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,44 @@ -notifications: - email: false -language: ruby -bundler_args: --without development system_tests +--- sudo: false +language: ruby +cache: bundler +bundler_args: --without system_tests before_install: rm Gemfile.lock || true -script: bundle exec rake test +script: + - 'bundle exec rake $CHECK' matrix: + fast_finish: true include: - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 3.0" FACTER_GEM_VERSION="~> 1.7.0" - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.0" STRICT_VARIABLES=yes FUTURE_PARSER="yes" - + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 2.1.8 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test FUTURE_PARSER=yes + - rvm: 2.1.8 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test FUTURE_PARSER=yes + - rvm: 2.1.8 + env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 2.2.4 + env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 2.2.4 + env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=rubocop + - rvm: 2.3.0 + env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test + allow_failures: + - rvm: 2.3.0 + env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test +notifications: + email: false deploy: provider: puppetforge user: puppet password: secure: "Hw0ScFZ+tANSuxXvkQlHOtbnV+9O6FyIxY4e8ZuNiE+4E045olgGjqus+ffo0MoHOHzCPPbThF107yQIXXHCwIy3wzOVIjQ7KQ/yVeamCl4K9A4AFP1Pcr/zMTRdK16zrgxBH+6wDkjSxHGonT8AyUKBrT7AeET+pqxwVHvHCfo=" - on: tags: true # all_branches is required to use tags all_branches: true # Only publish if our main Ruby target builds rvm: 1.9.3 + condition: "$FUTURE_PARSER = yes" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..00deb27d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,96 @@ +This module has grown over time based on a range of contributions from +people using it. If you follow these contributing guidelines your patch +will likely make it into a release a little quicker. + + +## Contributing + +Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. [Contributor Code of Conduct](https://voxpupuli.org/coc/). + +1. Fork the repo. + +1. Create a separate branch for your change. + +1. Run the tests. We only take pull requests with passing tests, and + documentation. + +1. Add a test for your change. Only refactoring and documentation + changes require no new tests. If you are adding functionality + or fixing a bug, please add a test. + +1. Squash your commits down into logical components. Make sure to rebase + against the current master. + +1. Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review +your code. + +## Dependencies + +The testing and development tools have a bunch of dependencies, +all managed by [bundler](http://bundler.io/) according to the +[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). + +By default the tests use a baseline version of Puppet. + +If you have Ruby 2.x or want a specific version of Puppet, +you must set an environment variable such as: + + export PUPPET_VERSION="~> 4.2.0" + +Install the dependencies like so... + + bundle install + +## Syntax and style + +The test suite will run [Puppet Lint](http://puppet-lint.com/) and +[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to +check various syntax and style things. You can run these locally with: + + bundle exec rake lint + bundle exec rake validate + +## Running the unit tests + +The unit test suite covers most of the code, as mentioned above please +add tests if you're adding new functionality. If you've not used +[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask +about how best to test your new feature. + +To run your all the unit tests + + bundle exec rake spec SPEC_OPTS='--format documentation' + +To run a specific spec test set the `SPEC` variable: + + bundle exec rake spec SPEC=spec/foo_spec.rb + +To run the linter, the syntax checker and the unit tests: + + bundle exec rake test + + +## Integration tests + +The unit tests just check the code runs, not that it does exactly what +we want on a real machine. For that we're using +[beaker](https://github.com/puppetlabs/beaker). + +This fires up a new virtual machine (using vagrant) and runs a series of +simple tests against it after applying the module. You can run this +with: + + bundle exec rake acceptance + +This will run the tests on an Ubuntu 12.04 virtual machine. You can also +run the integration tests against Centos 6.5 with. + + BEAKER_set=centos-64-x64 bundle exec rake acceptances + +If you don't want to have to recreate the virtual machine every time you +can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will +at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile +for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`. + diff --git a/Gemfile b/Gemfile index dd60a849..66ed713b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,38 +1,64 @@ -# Copyright 2014 Puppet Community -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -source "https://rubygems.org" +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +def location_for(place, fake_version = nil) + if place =~ /^(git[:@][^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end +end group :test do - gem "rake" - gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0' - gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git' - gem "puppetlabs_spec_helper" - gem "metadata-json-lint" - gem "rspec-puppet-facts" - gem "rspec", "< 3.2.0", { "platforms" => ["ruby_18"] } - gem "puppet-blacksmith", "> 3.3.0", { "platforms" => ["ruby_19", "ruby_20", "ruby_21"] } + gem 'rake', :require => false + gem 'rspec-puppet', :require => false, :git => 'https://github.com/rodjek/rspec-puppet.git' + gem 'puppet-lint', :require => false, :git => 'https://github.com/rodjek/puppet-lint.git' + gem 'metadata-json-lint', :require => false + gem 'rspec-puppet-facts', :require => false + gem 'rspec', :require => false + gem 'puppet-blacksmith', :require => false, :git => 'https://github.com/voxpupuli/puppet-blacksmith.git' + gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git' + gem 'rubocop', '~> 0.38', :require => false + gem 'rspec-puppet-utils', :require => false + gem 'puppetlabs_spec_helper', :require => false + gem 'puppet-lint-absolute_classname-check', :require => false + gem 'puppet-lint-leading_zero-check', :require => false + gem 'puppet-lint-trailing_comma-check', :require => false + gem 'puppet-lint-version_comparison-check', :require => false + gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false + gem 'puppet-lint-unquoted_string-check', :require => false + gem 'puppet-lint-variable_contains_upcase', :require => false end group :development do - gem "travis" - gem "travis-lint" - gem "guard-rake" + gem 'travis', :require => false + gem 'travis-lint', :require => false + gem 'guard-rake', :require => false end group :system_tests do - gem "beaker" - gem "beaker-rspec" + gem 'beaker', :require => false + if beaker_version = ENV['BEAKER_VERSION'] + gem 'beaker', *location_for(beaker_version) + end + if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end + gem 'beaker-puppet_install_helper', :require => false end + + +if facterversion = ENV['FACTER_GEM_VERSION'] +gem 'facter', facterversion.to_s, :require => false, :groups => [:test] +else +gem 'facter', :require => false, :groups => [:test] +end + +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 3.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +gem 'puppet', puppetversion, :require => false, :groups => [:test] + +# vim:ft=ruby diff --git a/Rakefile b/Rakefile index 6a62f514..0ffcb86a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,80 +1,38 @@ -# Copyright 2014 Puppet Community -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' require 'puppet-syntax/tasks/puppet-syntax' require 'metadata-json-lint/rake_task' +require 'puppet_blacksmith/rake_tasks' +require 'voxpupuli/release/rake_tasks' +require 'rubocop/rake_task' -# These two gems aren't always present, for instance -# on Travis with --without development -begin - require 'puppet_blacksmith/rake_tasks' -rescue LoadError -end +RuboCop::RakeTask.new -PuppetLint.configuration.relative = true -PuppetLint.configuration.send("disable_80chars") -PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" +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('relative') +PuppetLint.configuration.send('disable_140chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') - -exclude_paths = [ - "pkg/**/*", - "vendor/**/*", - "spec/**/*", -] +PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_single_quote_string_with_variables') + +exclude_paths = %w( + pkg/**/* + vendor/**/* + spec/**/* +) PuppetLint.configuration.ignore_paths = exclude_paths PuppetSyntax.exclude_paths = exclude_paths -desc "Run acceptance tests" +desc 'Run acceptance tests' RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' end -desc "Run metadata_lint, lint, syntax, and spec tests." -task :test => [ +desc 'Run metadata_lint, lint, syntax, and spec tests.' +task test: [ :metadata_lint, :lint, :syntax, :spec, ] - -if RUBY_VERSION >= "1.9.0" then - Blacksmith::RakeTask.new do |t| - t.build = false # do not build the module nor push it to the Forge - # just do the tagging [:clean, :tag, :bump_commit] - end - - - desc "Offload release process to Travis." - task :travis_release => [ - :check_changelog, # check that the changelog contains an entry for the current release - :"module:release", # do everything except build / push to forge, travis will do that for us - ] - - desc "Check Changelog." - task :check_changelog do - v = Blacksmith::Modulefile.new.version - if File.readlines('CHANGELOG.md').grep("Releasing #{v}").size == 0 then - fail "Unable to find a CHANGELOG.md entry for the #{v} release." - end - end -end - diff --git a/manifests/init.pp b/manifests/init.pp index 90c20fa3..a3fabdaa 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -279,7 +279,7 @@ } if $manage_virtualenv and !defined(Package[$::puppetboard::params::virtualenv]) { - class { 'python': + class { '::python': virtualenv => 'present', } } diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 9b635577..2fb28f2d 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -1,17 +1,16 @@ require 'spec_helper_acceptance' describe 'puppetboard class' do - context 'default parameters' do hosts.each do |host| if fact('osfamily') == 'RedHat' if fact('architecture') == 'amd64' - on host, "wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm" + on host, 'wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm' else - on host, "wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm" + on host, 'wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm' end end - on host, "puppet module install puppetlabs/apache" + on host, 'puppet module install puppetlabs/apache' install_package host, 'python-virtualenv' install_package host, 'git' end @@ -25,30 +24,29 @@ end # TODO: get this working - #it 'should not answer to localhost' do + # it 'should not answer to localhost' do # shell("/usr/bin/curl localhost:80", :acceptable_exit_codes => 7) do |r| # r.exit_code.should == 7 # curl (7): Couldn't connect to host # end - #end - + # end end context 'default parameters' do hosts.each do |host| if fact('osfamily') == 'RedHat' if fact('architecture') == 'amd64' - on host, "wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm" + on host, 'wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm' else - on host, "wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm" + on host, 'wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm' end end - on host, "puppet module install puppetlabs/apache" + on host, 'puppet module install puppetlabs/apache' install_package host, 'python-virtualenv' install_package host, 'git' end it 'should work with no errors' do - pp= <<-EOS + pp = <<-EOS # Configure Apache on this server class { 'apache': default_vhost => false, @@ -65,15 +63,13 @@ class { 'puppetboard::apache::vhost': } EOS - # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) apply_manifest(pp, :catch_failures => true) end - it 'should answer to localhost' do - shell("/usr/bin/curl localhost:5000") do |r| + shell('/usr/bin/curl localhost:5000') do |r| r.stdout.should =~ /niele Sluijters/ r.exit_code.should == 0 end @@ -84,18 +80,18 @@ class { 'puppetboard::apache::vhost': hosts.each do |host| if fact('osfamily') == 'RedHat' if fact('architecture') == 'amd64' - on host, "wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm" + on host, 'wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm' else - on host, "wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm" + on host, 'wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm; rpm -ivh epel-release-6-8.noarch.rpm' end end - on host, "puppet module install puppetlabs/apache" + on host, 'puppet module install puppetlabs/apache' install_package host, 'python-virtualenv' install_package host, 'git' end it 'should work with no errors' do - pp= <<-EOS + pp = <<-EOS class { 'puppetboard': manage_virtualenv => true, puppetdb_host => 'puppet.example.com', @@ -106,20 +102,14 @@ class { 'puppetboard': } EOS - # Run it twice and test for idempotency apply_manifest(pp, :catch_failures => true) apply_manifest(pp, :catch_failures => true) end - - describe file("/srv/puppetboard/puppetboard/settings.py") do + describe file('/srv/puppetboard/puppetboard/settings.py') do it { should contain "PUPPETDB_KEY = '/var/lib/puppet/ssl/private_keys/test.networkninjas.net.pem'" } it { should contain "PUPPETDB_CERT = '/var/lib/puppet/ssl/certs/test.networkninjas.net.pem'" } end - end end - - - diff --git a/spec/acceptance/nodesets/centos-511-x64.yml b/spec/acceptance/nodesets/centos-511-x64.yml new file mode 100644 index 00000000..ca14463e --- /dev/null +++ b/spec/acceptance/nodesets/centos-511-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + centos-511-x64: + roles: + - master + platform: el-5-x86_64 + box: puppetlabs/centos-5.11-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/centos-66-x64-pe.yml b/spec/acceptance/nodesets/centos-66-x64-pe.yml new file mode 100644 index 00000000..9a930370 --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64-pe.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-66-x64: + roles: + - master + - database + - dashboard + platform: el-6-x86_64 + box: puppetlabs/centos-6.6-64-puppet-enterprise + hypervisor: vagrant +CONFIG: + type: pe diff --git a/spec/acceptance/nodesets/centos-66-x64.yml b/spec/acceptance/nodesets/centos-66-x64.yml new file mode 100644 index 00000000..214318a1 --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + centos-66-x64: + roles: + - master + platform: el-6-x86_64 + box: puppetlabs/centos-6.6-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/centos-72-x64.yml b/spec/acceptance/nodesets/centos-72-x64.yml new file mode 100644 index 00000000..2c628fc6 --- /dev/null +++ b/spec/acceptance/nodesets/centos-72-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + centos-72-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.2-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/debian-78-x64.yml b/spec/acceptance/nodesets/debian-78-x64.yml new file mode 100644 index 00000000..2baa693e --- /dev/null +++ b/spec/acceptance/nodesets/debian-78-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + debian-78-x64: + roles: + - master + platform: debian-7-amd64 + box: puppetlabs/debian-7.8-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/debian-82-x64.yml b/spec/acceptance/nodesets/debian-82-x64.yml new file mode 100644 index 00000000..f496f121 --- /dev/null +++ b/spec/acceptance/nodesets/debian-82-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + debian-82-x64: + roles: + - master + platform: debian-8-amd64 + box: puppetlabs/debian-8.2-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml new file mode 100644 index 00000000..fa94e2c0 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + ubuntu-server-1204-x64: + roles: + - master + platform: ubuntu-12.04-amd64 + box: puppetlabs/ubuntu-12.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 00000000..72ba9c2d --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb new file mode 100644 index 00000000..c083569a --- /dev/null +++ b/spec/classes/coverage_spec.rb @@ -0,0 +1,3 @@ +require 'rspec-puppet' + +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5fda5887..1ffdf178 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,17 +1,3 @@ -dir = File.expand_path(File.dirname(__FILE__)) -$LOAD_PATH.unshift File.join(dir, 'lib') - -require 'mocha' -require 'puppet' -require 'rspec' -require 'spec/autorun' - -Spec::Runner.configure do |config| - config.mock_with :mocha -end - -# We need this because the RAL uses 'should' as a method. This -# allows us the same behaviour but with a different method name. -class Object - alias :must :should -end +require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' +include RspecPuppetFacts diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 6d32ad6d..65a087b8 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,8 +1,8 @@ require 'beaker-rspec' -hosts.each do |host| +hosts.each do |_host| # Install Puppet - install_puppet + install_puppet end RSpec.configure do |c| @@ -17,9 +17,9 @@ # Install module puppet_module_install(:source => proj_root, :module_name => 'puppetboard') hosts.each do |host| - on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module','install','stankevich-python'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module','install','puppetlabs-vcsrepo'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module', 'install', 'puppetlabs-stdlib'), :acceptable_exit_codes => [0, 1] + on host, puppet('module', 'install', 'stankevich-python'), :acceptable_exit_codes => [0, 1] + on host, puppet('module', 'install', 'puppetlabs-vcsrepo'), :acceptable_exit_codes => [0, 1] end end end diff --git a/tests/init.pp b/tests/init.pp index a4a6ff98..7e408b5c 100644 --- a/tests/init.pp +++ b/tests/init.pp @@ -8,5 +8,5 @@ # # Learn more about module testing here: http://docs.puppetlabs.com/guides/tests_smoke.html # -include puppetboard -include puppetboard::apache::conf +include ::puppetboard +include ::puppetboard::apache::conf