summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Barton <barton.tomas@gmail.com>2013-10-12 16:45:19 +0200
committerTomas Barton <barton.tomas@gmail.com>2013-10-12 16:46:20 +0200
commit9c2c7140876bbe20a9871543ba28b7522acdb213 (patch)
treedbaec693db7027496eb579d91fe3bbf65e8a31d3
parent2f2627cd49c93f7455b2e6294e11e16be99a27ac (diff)
testing infrastructure
-rw-r--r--.fixtures.yml8
-rw-r--r--.gitignore2
-rw-r--r--Gemfile5
-rw-r--r--Puppetfile3
-rw-r--r--Puppetfile.lock8
-rw-r--r--Rakefile12
-rw-r--r--spec/spec_helper_system.rb26
7 files changed, 56 insertions, 8 deletions
diff --git a/.fixtures.yml b/.fixtures.yml
deleted file mode 100644
index e05b8fd..0000000
--- a/.fixtures.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-fixtures:
- repositories:
- concat: "https://github.com/puppetlabs/puppetlabs-concat"
- openbsd: "https://github.com/duritong/puppet-openbsd"
- stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib"
-
- symlinks:
- munin: "#{source_dir}"
diff --git a/.gitignore b/.gitignore
index 6ce4053..9ef9ca4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
Gemfile.lock
spec/fixtures/
vendor/
+.tmp/*
+.librarian/*
diff --git a/Gemfile b/Gemfile
index ffc5ecc..d5495b8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -9,3 +9,8 @@ end
gem 'puppet', puppetversion
gem 'puppet-lint', '>=0.3.2'
gem 'puppetlabs_spec_helper', '>=0.2.0'
+gem 'rake', '>=0.9.2.2'
+gem 'librarian-puppet', '>=0.9.10'
+gem 'rspec-system-puppet', :require => false
+gem 'serverspec', :require => false
+gem 'rspec-system-serverspec', :require => false
diff --git a/Puppetfile b/Puppetfile
new file mode 100644
index 0000000..03b0752
--- /dev/null
+++ b/Puppetfile
@@ -0,0 +1,3 @@
+forge 'http://forge.puppetlabs.com'
+
+mod 'puppetlabs/stdlib', '>=0.1.6'
diff --git a/Puppetfile.lock b/Puppetfile.lock
new file mode 100644
index 0000000..d949104
--- /dev/null
+++ b/Puppetfile.lock
@@ -0,0 +1,8 @@
+FORGE
+ remote: http://forge.puppetlabs.com
+ specs:
+ puppetlabs/stdlib (4.1.0)
+
+DEPENDENCIES
+ puppetlabs/stdlib (>= 0.1.6)
+
diff --git a/Rakefile b/Rakefile
index 0d1f018..c0bab20 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,9 +1,21 @@
+require 'bundler'
+Bundler.require(:rake)
+
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
+require 'rspec-system/rake_task'
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"]
PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}'
PuppetLint.configuration.send("disable_class_inherits_from_params_class")
PuppetLint.configuration.send("disable_80chars")
+# 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/"
+end
+task :spec_prep => :librarian_spec_prep
+
+
task :default => [:spec, :lint]
diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb
new file mode 100644
index 0000000..462d2a1
--- /dev/null
+++ b/spec/spec_helper_system.rb
@@ -0,0 +1,26 @@
+require 'rspec-system/spec_helper'
+require 'rspec-system-puppet/helpers'
+require 'rspec-system-serverspec/helpers'
+include Serverspec::Helper::RSpecSystem
+include Serverspec::Helper::DetectOS
+include RSpecSystemPuppet::Helpers
+
+RSpec.configure do |c|
+ # Project root
+ proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+
+ # Enable colour
+ c.tty = true
+
+ c.include RSpecSystemPuppet::Helpers
+
+ # This is where we 'setup' the nodes before running our tests
+ c.before :suite do
+ # Install puppet
+ puppet_install
+
+ # Install modules and dependencies
+ puppet_module_install(:source => proj_root, :module_name => 'munin')
+ shell('puppet module install puppetlabs-stdlib')
+ end
+end