-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use voxpupuli-test #612
Use voxpupuli-test #612
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,32 +38,10 @@ | |
Gemfile: | ||
required: | ||
':test': | ||
- gem: puppetlabs_spec_helper | ||
version: '>= 2.14.0' | ||
- gem: rspec-puppet-facts | ||
version: '>= 1.9.5' | ||
- gem: rspec-puppet-utils | ||
- gem: puppet-lint-leading_zero-check | ||
- gem: puppet-lint-trailing_comma-check | ||
- gem: puppet-lint-version_comparison-check | ||
- gem: puppet-lint-classes_and_types_beginning_with_digits-check | ||
- gem: puppet-lint-unquoted_string-check | ||
- gem: puppet-lint-variable_contains_upcase | ||
- gem: puppet-lint-absolute_classname-check | ||
version: '>= 2.0.0' | ||
- gem: puppet-lint-topscope-variable-check | ||
- gem: puppet-lint-legacy_facts-check | ||
- gem: puppet-lint-anchor-check | ||
- gem: metadata-json-lint | ||
- gem: rubocop | ||
version: '~> 0.49.1' | ||
- gem: rubocop-rspec | ||
version: '~> 1.15.0' | ||
- gem: mocha | ||
version: '~> 1.4.0' | ||
- gem: voxpupuli-test | ||
version: '>= 1.0.0' | ||
- gem: coveralls | ||
- gem: simplecov-console | ||
- gem: parallel_tests | ||
':development': | ||
- gem: travis | ||
- gem: travis-lint | ||
|
@@ -141,7 +119,7 @@ spec/acceptance/nodesets/windows-2012-serverstandard-x64.yml: | |
spec/acceptance/nodesets/windows-2012R2-serverstandard-x64.yml: | ||
delete: true | ||
spec/spec_helper.rb: | ||
mock_with: ':rspec' | ||
mock_with: false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we leave this out or keep it in as a reference on what to document? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think more documentation is always a good approach There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit behind on this, why set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because voxpupupli-test defaults to |
||
CONTRIBUTING.md: | ||
delete: true | ||
... | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'voxpupuli/test/rake' | ||
|
||
# load optional tasks for releases | ||
# only available if gem group releases is installed | ||
|
@@ -7,37 +7,6 @@ begin | |
rescue LoadError | ||
end | ||
|
||
PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' | ||
|
||
desc 'Auto-correct puppet-lint offenses' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've entirely dropped this since the puppetlabs_spec_helper task |
||
task 'lint:auto_correct' do | ||
Rake::Task[:lint_fix].invoke | ||
end | ||
|
||
desc 'Run acceptance tests' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We normally use the |
||
RSpec::Core::RakeTask.new(:acceptance) do |t| | ||
t.pattern = 'spec/acceptance' | ||
end | ||
|
||
desc 'Run tests' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also a customization that I've dropped for now. |
||
task test: [:release_checks] | ||
|
||
namespace :check do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved to the gem |
||
desc 'Check for trailing whitespace' | ||
task :trailing_whitespace do | ||
Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename| | ||
next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md|CHANGELOG.md)} | ||
File.foreach(filename).each_with_index do |line, index| | ||
if line =~ %r{\s\n$} | ||
puts "#{filename} has trailing whitespace on line #{index + 1}" | ||
exit 1 | ||
end | ||
end | ||
end | ||
end | ||
end | ||
Rake::Task[:release_checks].enhance ['check:trailing_whitespace'] | ||
|
||
desc "Run main 'test' task and report merged results to coveralls" | ||
task test_with_coveralls: [:test] do | ||
if Dir.exist?(File.expand_path('../lib', __FILE__)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
# This file is managed via modulesync | ||
# https://github.com/voxpupuli/modulesync | ||
# https://github.com/voxpupuli/modulesync_config | ||
<%- if @configs['mock_with'] -%> | ||
<%- if @configs['mock_with'] || @configs['hiera_config'] -%> | ||
|
||
RSpec.configure do |c| | ||
<%- if @configs['mock_with'] -%> | ||
c.mock_with <%= @configs['mock_with'] %> | ||
<%- end -%> | ||
<%- if @configs['hiera_config'] -%> | ||
c.hiera_config = <%= @configs['hiera_config'] %> | ||
<%- end -%> | ||
end | ||
|
||
<%- end -%> | ||
require 'puppetlabs_spec_helper/module_spec_helper' | ||
require 'rspec-puppet-facts' | ||
require 'bundler' | ||
include RspecPuppetFacts | ||
|
||
if ENV['DEBUG'] | ||
Puppet::Util::Log.level = :debug | ||
Puppet::Util::Log.newdestination(:console) | ||
end | ||
# puppetlabs_spec_helper will set up coverage if the env variable is set. | ||
# We want to do this if lib exists and it hasn't been explicitly set. | ||
ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) | ||
|
||
require 'voxpupuli/test/spec_helper' | ||
|
||
if File.exist?(File.join(__dir__, 'default_module_facts.yml')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that we can actually get rid of this since most have a small set. Once it's easy to unmanage the file, we should convert those to directly use |
||
facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) | ||
|
@@ -25,8 +27,8 @@ if File.exist?(File.join(__dir__, 'default_module_facts.yml')) | |
end | ||
end | ||
end | ||
|
||
<% if @configs['augeasproviders'] -%> | ||
|
||
# Setup augeasproviders | ||
require 'pathname' | ||
dir = Pathname.new(__FILE__).parent | ||
|
@@ -40,48 +42,6 @@ puts 'augeasproviders: setting Puppet[:libdir] to work around broken type autolo | |
Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib" | ||
|
||
<% end -%> | ||
if Dir.exist?(File.expand_path('../../lib', __FILE__)) | ||
require 'coveralls' | ||
require 'simplecov' | ||
require 'simplecov-console' | ||
SimpleCov.formatters = [ | ||
SimpleCov::Formatter::HTMLFormatter, | ||
SimpleCov::Formatter::Console | ||
] | ||
SimpleCov.start do | ||
track_files 'lib/**/*.rb' | ||
add_filter '/spec' | ||
add_filter '/vendor' | ||
add_filter '/.vendor' | ||
add_filter Bundler.configured_bundle_path.path | ||
end | ||
end | ||
|
||
RSpec.configure do |c| | ||
<%- if @configs['hiera_config'] -%> | ||
c.hiera_config = <%= @configs['hiera_config'] %> | ||
<%- end -%> | ||
# getting the correct facter version is tricky. We use facterdb as a source to mock facts | ||
# see https://github.com/camptocamp/facterdb | ||
# people might provide a specific facter version. In that case we use it. | ||
# Otherwise we need to match the correct facter version to the used puppet version. | ||
# as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14 | ||
# https://puppet.com/docs/puppet/5.5/about_agent.html | ||
# | ||
# The environment variable `PUPPET_VERSION` is available in our travis environment, but we cannot rely on it | ||
# if somebody runs the tests locally. For that case we should fallback the the puppet gem version. | ||
c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION'] | ||
ENV['FACTERDB_FACTS_VERSION'] | ||
else | ||
puppet_version = ENV['PUPPET_VERSION'] ? ENV['PUPPET_VERSION'] : Gem.loaded_specs['puppet'].version.to_s | ||
Gem::Dependency.new('', puppet_version).match?('', '5') ? '3.11.0' : '3.14.0' | ||
end | ||
|
||
# Coverage generation | ||
c.after(:suite) do | ||
RSpec::Puppet::Coverage.report! | ||
end | ||
end | ||
<%- [@configs['spec_overrides']].flatten.compact.each do |line| -%> | ||
|
||
<%= line %> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are people's thoughts on pinning this? Should we release a 1.0.0 and stick to semver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since I didn't discover any further issues I'm 👍 for a 1.0.0 release + pinning to >= 1.0.0