From 0329bdf2c0b2c157cf80c15f7dde580fbd243e3c Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 21 Oct 2016 17:46:09 +0200 Subject: add a testing boilerplate --- Rakefile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Rakefile (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..e136b8e --- /dev/null +++ b/Rakefile @@ -0,0 +1,7 @@ +require 'rubygems' +# keep for compatibility for now +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] + -- cgit v1.2.3 From 4510682dff23142df5de4cfcc988e4319fcb73cd Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 31 Oct 2016 23:15:18 +0100 Subject: add a default set of specs so that the minimum is tested --- Rakefile | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index e136b8e..0c37d3b 100644 --- a/Rakefile +++ b/Rakefile @@ -5,3 +5,13 @@ require 'puppet-lint/tasks/puppet-lint' PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] +# use librarian-puppet to manage fixtures instead of .fixtures.yml +# offers more possibilities like explicit version management, forge downloads,... +task :librarian_spec_prep do + sh "librarian-puppet install --path=spec/fixtures/modules/" + pwd = `pwd`.strip + unless File.directory?("#{pwd}/spec/fixtures/modules/tor") + sh "ln -s #{pwd} #{pwd}/spec/fixtures/modules/tor" + end +end +task :spec_prep => :librarian_spec_prep -- cgit v1.2.3 From 48132d55bba99a4356d91ad13d8639755d9f9401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-Philippe=20V=C3=A9ronneau?= Date: Fri, 2 Feb 2018 13:45:12 -0500 Subject: replace the CI tests by the ones used in the backupninja module/ --- Rakefile | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 85326bb..401002e 100644 --- a/Rakefile +++ b/Rakefile @@ -1,19 +1,10 @@ -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-lint/tasks/puppet-lint' -PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] +task :tests do + require 'puppetlabs_spec_helper/rake_tasks' -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 + # run syntax checks on manifests, templates and hiera data + # also runs :metadata_lint + Rake::Task[:validate].invoke -task :test => [:lint, :syntax , :validate, :spec] + # runs puppet-lint + Rake::Task[:lint].invoke +end -- cgit v1.2.3