summaryrefslogtreecommitdiffstats
path: root/ext/puppet-test
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-03-20 11:55:42 -0500
committerLuke Kanies <luke@madstop.com>2008-03-20 11:55:42 -0500
commite1907798425a7b163ac1b831b0cf11e88985815e (patch)
tree281191621b07b939ad724981d110b9a85463b5e1 /ext/puppet-test
parent9f8bb7e42aeea4670d9292f935529f8db5d57bc5 (diff)
parente00065a8e63a7222eacbc7e8aaa925e967fd5c60 (diff)
downloadpuppet-e1907798425a7b163ac1b831b0cf11e88985815e.tar.gz
puppet-e1907798425a7b163ac1b831b0cf11e88985815e.tar.xz
puppet-e1907798425a7b163ac1b831b0cf11e88985815e.zip
Merge branch '0.24.x'
Diffstat (limited to 'ext/puppet-test')
-rwxr-xr-xext/puppet-test48
1 files changed, 34 insertions, 14 deletions
diff --git a/ext/puppet-test b/ext/puppet-test
index e18dd1c57..117a5a11a 100755
--- a/ext/puppet-test
+++ b/ext/puppet-test
@@ -143,10 +143,6 @@ class Suite
instance_eval(&block)
end
- def prepare
- raise "Test %s did not override 'prepare'" % @name
- end
-
# Define a new type of test on this suite.
def newtest(name, doc, &block)
@tests[name] = doc
@@ -166,7 +162,8 @@ class Suite
raise "Suite %s only supports tests %s; not %s" % [@name, @tests.keys.collect { |k| k.to_s }.join(","), test]
end
puts "Running %s %s test" % [@name, test]
- prepare()
+
+ prepare() if respond_to?(:prepare)
if $options[:pause]
puts "Hit any key to continue"
@@ -210,9 +207,6 @@ class Suite
end
Suite.new :parser, "Manifest parsing" do
- def prepare
- end
-
newtest :parse, "Parsed files" do
@parser = Puppet::Parser::Parser.new(:environment => Puppet[:environment])
@parser.file = Puppet[:manifest]
@@ -220,7 +214,16 @@ Suite.new :parser, "Manifest parsing" do
end
end
-Suite.new :catalog, "Catalog handling" do
+Suite.new :local_catalog, "Local catalog handling" do
+ def prepare
+ end
+
+ newtest :compile, "Compiled catalog" do
+ Puppet::Node::Catalog.find(Puppet[:certname])
+ end
+end
+
+Suite.new :remote_catalog, "Remote catalog handling" do
def prepare
$args[:cache] = false
# Create a config client and pull the config down
@@ -232,10 +235,12 @@ Suite.new :catalog, "Catalog handling" do
# Use the facts from the cache, to skip the time it takes
# to load them.
@client.dostorage
- @facts = Puppet::Util::Storage.cache(:configuration)[:facts]
+ @facts = Puppet::Util::Storage.cache(:configuration)[:facts] || {}
if @facts.empty?
- @facts = @client.master.getfacts
+ if tmp = Puppet::Node::Facts.find("me")
+ @facts = tmp.values
+ end
end
if host = $options[:fqdn]
@@ -247,7 +252,7 @@ Suite.new :catalog, "Catalog handling" do
@facts = YAML.dump(@facts)
end
- newtest :compile, "Compiled catalog" do
+ newtest :getconfig, "Compiled catalog" do
@client.driver.getconfig(@facts, "yaml")
end
@@ -277,6 +282,21 @@ Suite.new :file, "File interactions" do
end
end
+Suite.new :filebucket, "Filebucket interactions" do
+ def prepare
+ require 'tempfile'
+ @client = Puppet::Network::Client.dipper.new($args)
+ end
+
+ newtest :backup, "Backed up file" do
+ Tempfile.open("bucket_testing") do |f|
+ f.print rand(1024)
+ f.close
+ @client.backup(f.path)
+ end
+ end
+end
+
# Note that this uses an env variable to determine how many resources per
# host to create (with a default of 10). 'repeat' determines how
# many hosts to create. You probably will get mad failures if you
@@ -445,8 +465,8 @@ Puppet.parse_config
$args[:Server] = Puppet[:server]
unless $options[:test]
- $options[:suite] = :configuration
- $options[:test] = :compile
+ $options[:suite] = :remote_catalog
+ $options[:test] = :getconfig
end
unless $options[:test]