summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-05 18:26:12 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-05 18:26:12 +0000
commitd0ecc0e45cc5ff0cd5235e6ab9bcd031030973c2 (patch)
treed1c442139297a2afe4040cb953de406cb6bec01e /test
parent2728f500c62118a19b5f93640747cbfdbd97a9bd (diff)
downloadpuppet-d0ecc0e45cc5ff0cd5235e6ab9bcd031030973c2.tar.gz
puppet-d0ecc0e45cc5ff0cd5235e6ab9bcd031030973c2.tar.xz
puppet-d0ecc0e45cc5ff0cd5235e6ab9bcd031030973c2.zip
Messing around a bit with how tests work
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2054 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r--test/Rakefile11
-rw-r--r--test/lib/rake/puppet_test_loader.rb12
-rw-r--r--test/lib/rake/puppet_testtask.rb14
-rwxr-xr-xtest/providers/mount/parsed.rb2
-rwxr-xr-xtest/providers/parsedsshkey.rb4
5 files changed, 36 insertions, 7 deletions
diff --git a/test/Rakefile b/test/Rakefile
index 1f9bfa203..4e4512d0b 100644
--- a/test/Rakefile
+++ b/test/Rakefile
@@ -4,6 +4,7 @@ rescue LoadError
$stderr.puts "You must have 'rake' installed to use this file"
exit(1)
end
+
require 'find'
include Find
@@ -12,6 +13,10 @@ include FileTest
$exclusions = %W(lib data)
$test_library_paths = %W(lib ../lib)
+$: << File.join(Dir.getwd, "lib")
+
+require 'rake/puppet_testtask'
+
filemap = Hash.new { |hash, key| hash[key] = [] }
allfiles = []
@@ -48,7 +53,7 @@ find(".") do |f|
end
desc "Run the full test suite"
-Rake::TestTask.new :test do |t|
+Rake::PuppetTestTask.new :test do |t|
t.libs << $test_library_paths
# Add every file as a test file to run
@@ -65,7 +70,7 @@ filemap.each do |dir, files|
# First create a separate task for each file in the namespace.
namespace ns do
files.each do |file|
- Rake::TestTask.new File.basename(file, '.rb').to_sym do |t|
+ Rake::PuppetTestTask.new File.basename(file, '.rb').to_sym do |t|
t.libs << $test_library_paths + ['..']
t.test_files = [ file ]
t.verbose = true
@@ -74,7 +79,7 @@ filemap.each do |dir, files|
end
# Then create a task that matches the directory itself.
- Rake::TestTask.new dir do |t|
+ Rake::PuppetTestTask.new dir do |t|
t.libs << $test_library_paths
if ENV["TESTFILES"]
t.test_files = ENV["TESTFILES"].split(/\s+/)
diff --git a/test/lib/rake/puppet_test_loader.rb b/test/lib/rake/puppet_test_loader.rb
new file mode 100644
index 000000000..3b9e58a60
--- /dev/null
+++ b/test/lib/rake/puppet_test_loader.rb
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+
+require 'test/unit/autorunner'
+
+runner = Test::Unit::AutoRunner.new(false)
+runner.process_args
+
+ARGV.each { |f| load f unless f =~ /^-/ }
+
+runner.run
+
+# $Id$
diff --git a/test/lib/rake/puppet_testtask.rb b/test/lib/rake/puppet_testtask.rb
new file mode 100644
index 000000000..8a882c184
--- /dev/null
+++ b/test/lib/rake/puppet_testtask.rb
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+
+module Rake
+ class PuppetTestTask < Rake::TestTask
+ def rake_loader
+ file = find_file('rake/puppet_test_loader') or
+ fail "unable to find rake test loader"
+ puts file
+ return file
+ end
+ end
+end
+
+# $Id$
diff --git a/test/providers/mount/parsed.rb b/test/providers/mount/parsed.rb
index e4450ee0e..8c60c9626 100755
--- a/test/providers/mount/parsed.rb
+++ b/test/providers/mount/parsed.rb
@@ -139,7 +139,7 @@ class TestParsedMounts < Test::Unit::TestCase
end
assert_equal(:present, provider.state_hash[:ensure],
- "Could not find root fs")
+ "Could not find root fs with provider %s" % provider.name)
assert_nothing_raised {
assert(provider.mounted?, "Root is considered not mounted")
diff --git a/test/providers/parsedsshkey.rb b/test/providers/parsedsshkey.rb
index 9fc52e643..edda8317f 100755
--- a/test/providers/parsedsshkey.rb
+++ b/test/providers/parsedsshkey.rb
@@ -26,8 +26,6 @@ class TestParsedSSHKey < Test::Unit::TestCase
end
def mkkey(name = "host.domain.com")
- mount = nil
-
if defined? @pcount
@pcount += 1
else
@@ -41,7 +39,7 @@ class TestParsedSSHKey < Test::Unit::TestCase
:ensure => :present
}
- fakemodel = fakemodel(:mount, args[:name])
+ fakemodel = fakemodel(:sshkey, args[:name])
key = @provider.new(fakemodel)
args.each do |p,v|