summaryrefslogtreecommitdiffstats
path: root/test/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-11-12 22:08:44 -0600
committerLuke Kanies <luke@madstop.com>2007-11-12 22:08:44 -0600
commit72510bfaa65e97f4eaaf246ef8f1c155716967b6 (patch)
tree978aa0e92812f5854978048162c6e2ab752dad72 /test/lib
parentdd7caa76e160ed51c8b0e123c18f7526b575bfec (diff)
downloadpuppet-72510bfaa65e97f4eaaf246ef8f1c155716967b6.tar.gz
puppet-72510bfaa65e97f4eaaf246ef8f1c155716967b6.tar.xz
puppet-72510bfaa65e97f4eaaf246ef8f1c155716967b6.zip
Fixing #800 by refactoring how configurations are retrieved
from the server. The real problem was getting all of the validation done before any caching, which required a good bit more refactoring than I expected. In actuality, this commit is relatively small even though it covers many files; most of the changes just make the code clearer or shorter.
Diffstat (limited to 'test/lib')
-rwxr-xr-xtest/lib/puppettest.rb17
-rw-r--r--test/lib/puppettest/support/assertions.rb2
2 files changed, 16 insertions, 3 deletions
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb
index 92981b557..6447b80fb 100755
--- a/test/lib/puppettest.rb
+++ b/test/lib/puppettest.rb
@@ -20,6 +20,17 @@ if ARGV.include?("-d")
$console = true
end
+# Some monkey-patching to allow us to test private methods.
+class Class
+ def publicize_methods(*methods)
+ saved_private_instance_methods = methods.empty? ? self.private_instance_methods : methods
+
+ self.class_eval { public *saved_private_instance_methods }
+ yield
+ self.class_eval { private *saved_private_instance_methods }
+ end
+end
+
module PuppetTest
# Munge cli arguments, so we can enable debugging if we want
# and so we can run just specific methods.
@@ -196,7 +207,7 @@ module PuppetTest
Puppet[:ignoreschedules] = true
- @start = Time.now
+ #@start = Time.now
end
def tempfile
@@ -246,8 +257,8 @@ module PuppetTest
end
def teardown
- @stop = Time.now
- File.open("/tmp/test_times.log", ::File::WRONLY|::File::CREAT|::File::APPEND) { |f| f.puts "%0.4f %s %s" % [@stop - @start, @method_name, self.class] }
+ #@stop = Time.now
+ #File.open("/tmp/test_times.log", ::File::WRONLY|::File::CREAT|::File::APPEND) { |f| f.puts "%0.4f %s %s" % [@stop - @start, @method_name, self.class] }
@@cleaners.each { |cleaner| cleaner.call() }
@@tmpfiles.each { |file|
diff --git a/test/lib/puppettest/support/assertions.rb b/test/lib/puppettest/support/assertions.rb
index 7e3e5ca2b..906bb3c76 100644
--- a/test/lib/puppettest/support/assertions.rb
+++ b/test/lib/puppettest/support/assertions.rb
@@ -1,7 +1,9 @@
require 'puppettest'
+require 'puppettest/support/utils'
require 'fileutils'
module PuppetTest
+ include PuppetTest::Support::Utils
def assert_logged(level, regex, msg = nil)
# Skip verifying logs that we're not supposed to send.
return unless Puppet::Util::Log.sendlevel?(level)