]> review.fuel-infra Code Review - puppet-modules/puppetlabs-firewall.git/commitdiff
Moved some of the puppet setup stuff in system tests to rspec-system-puppet
authorKen Barber <ken@bob.sh>
Sat, 6 Apr 2013 02:29:15 +0000 (03:29 +0100)
committerKen Barber <ken@bob.sh>
Sat, 6 Apr 2013 02:29:15 +0000 (03:29 +0100)
Signed-off-by: Ken Barber <ken@bob.sh>
Gemfile
spec/spec_helper_system.rb

diff --git a/Gemfile b/Gemfile
index 5ff9461f6c343f44ed0c1ad491d20f84dacb4e28..405a51cf56608e63a5a9dbc5628036871d711bf7 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
 
 group :development, :test do
   gem 'puppetlabs_spec_helper', :require => false
-  gem 'rspec-system'
+  gem 'rspec-system-puppet'
 end
 
 if puppetversion = ENV['PUPPET_GEM_VERSION']
index f4b91e3995238c10254a0134b91e0cfa4f8e9d3f..47bf9e7a768c5486bae7df8352d900166094bc2c 100644 (file)
@@ -1,6 +1,7 @@
 # This helper file is specific to the system tests for puppetlabs-firewall
 # and should be included by all tests under spec/system
 require 'rspec-system/spec_helper'
+require 'rspec-system-puppet/helpers'
 
 RSpec.configure do |c|
   # Project root for the firewall code
@@ -8,44 +9,13 @@ RSpec.configure do |c|
 
   # This is where we 'setup' the nodes before running our tests
   c.system_setup_block = proc do
-    # TODO: find a better way of importing these into this namespace
-    include RSpecSystem::Helpers
-    include RSpecSystem::Log
+    # TODO: find a better way of importing this into this namespace
+    include RSpecSystemPuppet::Helpers
 
-    # TODO: this setup stuff is fairly generic, should move this into a plugin
-    # for rspec-system.
+    # Install puppet
+    system_puppet_install
 
-    # Grab facts from node
-    facts = system_node.facts
-
-    # Remove annoying mesg n from profile, otherwise on Debian we get:
-    # stdin: is not a tty which messes with our tests later on.
-    if facts['osfamily'] == 'Debian'
-      log.info("Remove 'mesg n' from profile to stop noise")
-      system_run("sed -i 's/^mesg n/# mesg n/' /root/.profile")
-    end
-
-    # Grab PL repository and install PL copy of puppet
-    log.info "Starting installation of puppet from PL repos"
-    if facts['osfamily'] == 'RedHat'
-      system_run('rpm -ivh http://yum.puppetlabs.com/el/5/products/i386/puppetlabs-release-5-6.noarch.rpm')
-      system_run('yum install -y puppet')
-    elsif facts['osfamily'] == 'Debian'
-      system_run("wget http://apt.puppetlabs.com/puppetlabs-release-#{facts['lsbdistcodename']}.deb")
-      system_run("dpkg -i puppetlabs-release-#{facts['lsbdistcodename']}.deb")
-      system_run('apt-get update')
-      system_run('apt-get install -y puppet')
-    end
-
-    # Prep modules dir
-    log.info("Preparing modules dir")
-    system_run('mkdir -p /etc/puppet/modules')
-
-    # Copy the current code into appropriate module dir
-    # TODO: we could always use the build process, copy tarball across etc.
-    # just a shame the puppet module tool doesn't handle standalone tarballs
-    # yet.
-    log.info("Now transferring module onto node")
-    system_rcp(:sp => proj_root, :dp => '/etc/puppet/modules/firewall')
+    # Copy this module into the module path of the test node
+    system_puppet_module_from_path(:source => proj_root, :module_name => 'firewall')
   end
 end