summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-11-18 11:21:22 -0600
committerLuke Kanies <luke@madstop.com>2007-11-18 11:21:22 -0600
commitc19835ce9f8a5138b30a1a32ca741c996b0916d2 (patch)
tree1a7b05839f013cc8a610f7c9493e206606fab977 /test
parent9290cc89a2206fb5204578f8e91208857a48b147 (diff)
downloadpuppet-c19835ce9f8a5138b30a1a32ca741c996b0916d2.tar.gz
puppet-c19835ce9f8a5138b30a1a32ca741c996b0916d2.tar.xz
puppet-c19835ce9f8a5138b30a1a32ca741c996b0916d2.zip
Fixed most failing tests, but there are still over thirty failing.
At this point, I'm holding the experiment until after the release, so I'm committing this for now and will take it back up after 0.24.0 is out.
Diffstat (limited to 'test')
-rwxr-xr-xtest/language/snippets.rb23
-rw-r--r--test/lib/puppettest/support/utils.rb2
-rwxr-xr-xtest/network/client/client.rb29
-rwxr-xr-xtest/network/client/master.rb51
-rwxr-xr-xtest/network/handler/fileserver.rb19
-rwxr-xr-xtest/network/handler/resource.rb5
-rwxr-xr-xtest/other/overrides.rb33
-rwxr-xr-xtest/other/relationships.rb18
-rwxr-xr-xtest/other/transactions.rb36
-rwxr-xr-xtest/ral/types/basic.rb7
-rwxr-xr-xtest/ral/types/cron.rb14
-rwxr-xr-xtest/ral/types/exec.rb13
-rwxr-xr-xtest/ral/types/file.rb130
-rwxr-xr-xtest/ral/types/file/target.rb26
-rwxr-xr-xtest/ral/types/filebucket.rb24
-rwxr-xr-xtest/ral/types/fileignoresource.rb7
-rwxr-xr-xtest/ral/types/filesources.rb10
-rwxr-xr-xtest/ral/types/host.rb4
-rwxr-xr-xtest/ral/types/package.rb1
-rwxr-xr-xtest/ral/types/parameter.rb5
-rwxr-xr-xtest/ral/types/schedule.rb39
-rwxr-xr-xtest/ral/types/sshkey.rb18
-rwxr-xr-xtest/ral/types/tidy.rb14
-rwxr-xr-xtest/util/filetype.rb3
24 files changed, 203 insertions, 328 deletions
diff --git a/test/language/snippets.rb b/test/language/snippets.rb
index 0806a40b4..05597cdec 100755
--- a/test/language/snippets.rb
+++ b/test/language/snippets.rb
@@ -22,14 +22,14 @@ class TestSnippets < Test::Unit::TestCase
end
def assert_file(path, msg = nil)
- unless file = @file[path]
+ unless file = @configuration.resource(:file, path)
msg ||= "Could not find file %s" % path
raise msg
end
end
def assert_mode_equal(mode, path)
- unless file = @file[path]
+ unless file = @configuration.resource(:file, path)
raise "Could not find file %s" % path
end
@@ -211,8 +211,8 @@ class TestSnippets < Test::Unit::TestCase
path1 = "/tmp/argumenttest1"
path2 = "/tmp/argumenttest2"
- file1 = @file[path1]
- file2 = @file[path2]
+ file1 = @configuration.resource(:file, path1)
+ file2 = @configuration.resource(:file, path2)
assert_file(path1)
assert_mode_equal(0755, path1)
@@ -231,7 +231,7 @@ class TestSnippets < Test::Unit::TestCase
}
paths.each { |path|
- file = @file[path]
+ file = @configuration.resource(:file, path)
assert(file, "File %s is missing" % path)
assert_mode_equal(0755, path)
}
@@ -241,7 +241,7 @@ class TestSnippets < Test::Unit::TestCase
paths = %w{a b c d e f g h}.collect { |l| "/tmp/iteration%stest" % l }
paths.each { |path|
- file = @file[path]
+ file = @configuration.resource(:file, path)
assert_file(path)
assert_mode_equal(0755, path)
}
@@ -262,7 +262,7 @@ class TestSnippets < Test::Unit::TestCase
dir = "/tmp/testdirtest"
assert_file(file)
assert_file(dir)
- assert_equal(:directory, @file[dir].should(:ensure), "Directory is not set to be a directory")
+ assert_equal(:directory, @configuration.resource(:file, dir).should(:ensure), "Directory is not set to be a directory")
end
def snippet_scopetest
@@ -349,7 +349,7 @@ class TestSnippets < Test::Unit::TestCase
}.each { |count, str|
path = "/tmp/singlequote%s" % count
assert_file(path)
- assert_equal(str, @file[path].should(:content))
+ assert_equal(str, @configuration.resource(:file, path).should(:content))
}
end
@@ -387,21 +387,20 @@ class TestSnippets < Test::Unit::TestCase
end
def snippet_emptyexec
- assert(Puppet::Type.type(:exec)["touch /tmp/emptyexectest"],
- "Did not create exec")
+ assert(@configuration.resource(:exec, "touch /tmp/emptyexectest"), "Did not create exec")
end
def snippet_multisubs
path = "/tmp/multisubtest"
assert_file(path)
- file = @file[path]
+ file = @configuration.resource(:file, path)
assert_equal("sub2", file.should(:content), "sub2 did not override content")
assert_mode_equal(0755, path)
end
def snippet_collection
assert_file("/tmp/colltest1")
- assert_nil(@file["/tmp/colltest2"], "Incorrectly collected file")
+ assert_nil(@configuration.resource(:file, "/tmp/colltest2"), "Incorrectly collected file")
end
def snippet_virtualresources
diff --git a/test/lib/puppettest/support/utils.rb b/test/lib/puppettest/support/utils.rb
index d9bd6b2b6..83509733e 100644
--- a/test/lib/puppettest/support/utils.rb
+++ b/test/lib/puppettest/support/utils.rb
@@ -27,7 +27,7 @@ module PuppetTest::Support::Utils
if resources[0].is_a?(Puppet::Node::Configuration)
config = resources.shift
unless resources.empty?
- resources.each { |r| config.add_resource r }
+ resources.each { |r| config.add_resource(r) unless config.resource(r.class.name, r.title) }
end
elsif resources[0].is_a?(Puppet.type(:component))
raise ArgumentError, "resource2config() no longer accpts components"
diff --git a/test/network/client/client.rb b/test/network/client/client.rb
index 4a7e9cdb6..8d08bd3d7 100755
--- a/test/network/client/client.rb
+++ b/test/network/client/client.rb
@@ -140,35 +140,6 @@ class TestClient < Test::Unit::TestCase
}
end
- def test_classfile
- Puppet[:code] = "class yaytest {}\n class bootest {}\n include yaytest, bootest"
-
- Puppet::Node::Facts.indirection.stubs(:save)
-
- master = client = nil
- assert_nothing_raised() {
- master = Puppet::Network::Handler.master.new(
- :Local => false
- )
- }
- assert_nothing_raised() {
- client = Puppet::Network::Client.master.new(
- :Master => master
- )
- }
-
- # Fake that it's local, so it creates the class file
- client.local = false
-
- # We can't guarantee class ordering
- client.expects(:setclasses).with do |array|
- array.length == 2 and array.include?("yaytest") and array.include?("bootest")
- end
- assert_nothing_raised {
- client.getconfig
- }
- end
-
def test_client_loading
# Make sure we don't get a failure but that we also get nothing back
assert_nothing_raised do
diff --git a/test/network/client/master.rb b/test/network/client/master.rb
index 7216af936..0caba4bd2 100755
--- a/test/network/client/master.rb
+++ b/test/network/client/master.rb
@@ -332,39 +332,6 @@ end
assert(FileTest.exists?(file), "file was not created on second run")
end
- def test_default_objects
- # Make sure they start out missing
- assert_nil(Puppet::Type.type(:filebucket)["puppet"],
- "default filebucket already exists")
- assert_nil(Puppet::Type.type(:schedule)["daily"],
- "default schedules already exists")
-
- master = mkclient()
-
- # Now make sure they got created
- assert(Puppet::Type.type(:filebucket)["puppet"],
- "default filebucket not found")
- assert(Puppet::Type.type(:schedule)["daily"],
- "default schedules not found")
-
- # clear everything, and make sure we can recreate them
- Puppet::Type.allclear
- assert_nil(Puppet::Type.type(:filebucket)["puppet"],
- "default filebucket not removed")
- assert_nil(Puppet::Type.type(:schedule)["daily"],
- "default schedules not removed")
- assert_nothing_raised { master.mkdefault_objects }
- assert(Puppet::Type.type(:filebucket)["puppet"],
- "default filebucket not found")
- assert(Puppet::Type.type(:schedule)["daily"],
- "default schedules not found")
-
-
- # Make sure we've got schedules
- assert(Puppet::Type.type(:schedule)["hourly"], "Could not retrieve hourly schedule")
- assert(Puppet::Type.type(:filebucket)["puppet"], "Could not retrieve default bucket")
- end
-
# #540 - make sure downloads aren't affected by noop
def test_download_in_noop
source = tempfile
@@ -550,24 +517,6 @@ end
assert_equal(facts["environment"], Puppet[:environment], "Did not add environment to client facts")
end
- # This is partially to fix #532, but also to save on memory.
- def test_remove_objects_after_every_run
- client = mkclient
-
- ftype = Puppet::Type.type(:file)
- file = ftype.create :title => "/what/ever", :ensure => :present
- config = Puppet::Node::Configuration.new
- config.add_resource(file)
-
- config.expects :apply
-
- client.configuration = config
- client.expects(:getconfig)
- client.run
-
- assert_nil(ftype[@createdfile], "file object was not removed from memory")
- end
-
# #685
def test_http_failures_do_not_kill_puppetd
client = mkclient
diff --git a/test/network/handler/fileserver.rb b/test/network/handler/fileserver.rb
index 3539169dc..8703700ea 100755
--- a/test/network/handler/fileserver.rb
+++ b/test/network/handler/fileserver.rb
@@ -8,6 +8,11 @@ require 'puppet/network/handler/fileserver'
class TestFileServer < Test::Unit::TestCase
include PuppetTest
+ def setup
+ super
+ Facter.stubs(:to_hash).returns({})
+ end
+
def mkmount(path = nil)
mount = nil
name = "yaytest"
@@ -146,10 +151,6 @@ class TestFileServer < Test::Unit::TestCase
list = server.list(sfile, :ignore, true, false)
}
- assert_nothing_raised {
- file = Puppet.type(:file)[tmpfile]
- }
-
output = "/\tfile"
# verify it got listed as a file
@@ -943,10 +944,11 @@ allow *
end
# Now, check that they use Facter info
- Puppet.notice "The following messages are normal"
+ Facter.stubs(:value).with("hostname").returns("myhost")
+ Facter.stubs(:value).with("domain").returns("mydomain")
+ local = "myhost"
+ domain = "mydomain"
client = nil
- local = Facter["hostname"].value
- domain = Facter["domain"].value
fqdn = [local, domain].join(".")
{"%h" => local, # Short name
"%H" => fqdn, # Full name
@@ -954,6 +956,7 @@ allow *
"%%" => "%", # escape
"%o" => "%o" # other
}.each do |pat, repl|
+ Puppet.expects(:notice)
check.call(client, pat, repl)
end
@@ -1132,6 +1135,8 @@ allow *
def test_failures
# create a server with the file
server = nil
+ Facter.stubs(:[]).with("hostname").returns("myhost")
+ Facter.stubs(:[]).with("domain").returns("mydomain")
config = tempfile
[
diff --git a/test/network/handler/resource.rb b/test/network/handler/resource.rb
index 0d6373160..247014a47 100755
--- a/test/network/handler/resource.rb
+++ b/test/network/handler/resource.rb
@@ -3,10 +3,12 @@
require File.dirname(__FILE__) + '/../../lib/puppettest'
require 'puppettest'
+require 'puppettest/support/utils'
require 'base64'
require 'cgi'
class TestResourceServer < Test::Unit::TestCase
+ include PuppetTest
include PuppetTest::ServerTest
def verify_described(type, described)
@@ -179,9 +181,6 @@ class TestResourceServer < Test::Unit::TestCase
require 'etc'
- # Make the example schedules, for testing
- Puppet::Type.type(:schedule).mkdefaultschedules
-
Puppet::Type.eachtype do |type|
unless type.respond_to? :instances
Puppet.warning "%s does not respond to :instances" % type.name
diff --git a/test/other/overrides.rb b/test/other/overrides.rb
index 272f78e30..800eab1b7 100755
--- a/test/other/overrides.rb
+++ b/test/other/overrides.rb
@@ -25,28 +25,27 @@ class TestOverrides < Test::Unit::TestCase
baseobj = nil
basefile = File.join(basedir, "file")
- assert_nothing_raised("Could not create base obj") {
- baseobj = Puppet.type(:file).create(
- :title => "base",
- :path => basedir,
- :recurse => true,
- :mode => "755"
- )
- }
+ config = mk_configuration
+
+ baseobj = config.create_resource(:file,
+ :title => "base",
+ :path => basedir,
+ :recurse => true,
+ :mode => "755"
+ )
subobj = nil
subdir = File.join(basedir, "0")
subfile = File.join(subdir, "file")
- assert_nothing_raised("Could not create sub obj") {
- subobj = Puppet.type(:file).create(
- :title => "sub",
- :path => subdir,
- :recurse => true,
- :mode => "644"
- )
- }
- assert_apply(baseobj, subobj)
+ subobj = config.create_resource(:file,
+ :title => "sub",
+ :path => subdir,
+ :recurse => true,
+ :mode => "644"
+ )
+
+ config.apply
assert(File.stat(basefile).mode & 007777 == 0755)
assert(File.stat(subfile).mode & 007777 == 0644)
diff --git a/test/other/relationships.rb b/test/other/relationships.rb
index 0f2a103fe..fe1ae1ac4 100755
--- a/test/other/relationships.rb
+++ b/test/other/relationships.rb
@@ -61,19 +61,20 @@ class TestRelationships < Test::Unit::TestCase
:notify => true, :before => true}
refreshers = [:subscribe, :notify]
[:require, :subscribe, :notify, :before].each do |param|
+ config = mk_configuration
# Create three files to generate our events and three
# execs to receive them
files = []
execs = []
3.times do |i|
- files << Puppet::Type.newfile(
+ files << config.create_resource(:file,
:title => "file#{i}",
:path => tempfile(),
:ensure => :file
)
path = tempfile()
- execs << Puppet::Type.newexec(
+ execs << config.create_resource(:exec,
:title => "notifytest#{i}",
:path => "/usr/bin:/bin",
:command => "touch #{path}",
@@ -165,7 +166,9 @@ class TestRelationships < Test::Unit::TestCase
:ensure => :directory)
exec = Puppet::Type.newexec(:title => "myexec", :cwd => path,
:command => "/bin/echo")
-
+
+ config = mk_configuration(file, exec)
+
reqs = nil
assert_nothing_raised do
reqs = exec.autorequire
@@ -173,13 +176,10 @@ class TestRelationships < Test::Unit::TestCase
assert_instance_of(Puppet::Relationship, reqs[0], "Did not return a relationship edge")
assert_equal(file, reqs[0].source, "Did not set the autorequire source correctly")
assert_equal(exec, reqs[0].target, "Did not set the autorequire target correctly")
-
+
# Now make sure that these relationships are added to the
# relationship graph
- config = mk_configuration(file, exec)
- config.apply do |trans|
- assert(config.relationship_graph.edge?(file, exec), "autorequire edge was not created")
- end
+ assert(config.relationship_graph.edge?(file, exec), "autorequire edge was not created")
end
def test_requires?
@@ -210,7 +210,7 @@ class TestRelationships < Test::Unit::TestCase
file = Puppet::Type.newfile :path => tempfile, :require => ["file", "/no/such/file"]
assert_raise(Puppet::Error) do
- file.builddepends
+ config = mk_configuration(file)
end
end
end
diff --git a/test/other/transactions.rb b/test/other/transactions.rb
index 8156ba478..2498cc014 100755
--- a/test/other/transactions.rb
+++ b/test/other/transactions.rb
@@ -6,8 +6,10 @@ require 'puppet'
require 'puppettest'
require 'mocha'
require 'puppettest/support/resources'
+require 'puppettest/support/utils'
class TestTransactions < Test::Unit::TestCase
+ include PuppetTest
include PuppetTest::FileTesting
include PuppetTest::Support::Resources
class Fakeprop <Puppet::Property
@@ -429,26 +431,25 @@ class TestTransactions < Test::Unit::TestCase
# Make sure that unscheduled and untagged objects still respond to events
def test_unscheduled_and_untagged_response
- Puppet::Type.type(:schedule).mkdefaultschedules
+ config = mk_configuration
+ config.add_resource(*(Puppet::Type.type(:schedule).create_default_resources))
Puppet[:ignoreschedules] = false
- file = Puppet.type(:file).create(
+ file = config.create_resource(:file,
:name => tempfile(),
:ensure => "file",
:backup => false
)
fname = tempfile()
- exec = Puppet.type(:exec).create(
+ exec = config.create_resource(:exec,
:name => "touch %s" % fname,
:path => "/usr/bin:/bin",
:schedule => "monthly",
:subscribe => ["file", file.name]
)
- config = mk_configuration(file, exec)
-
# Run it once
- assert_apply(config)
+ config.apply
assert(FileTest.exists?(fname), "File did not get created")
assert(!exec.scheduled?, "Exec is somehow scheduled")
@@ -604,8 +605,7 @@ class TestTransactions < Test::Unit::TestCase
end
%w{ya ra y r}.each do |name|
- assert(trans.configuration.vertex?(Puppet::Type.type(:generator)[name]),
- "Generated %s was not a vertex" % name)
+ assert(trans.configuration.vertex?(config.resource(:generator, name)), "Generated %s was not a vertex" % name)
assert($finished.include?(name), "%s was not finished" % name)
end
@@ -615,10 +615,8 @@ class TestTransactions < Test::Unit::TestCase
end
%w{ya ra y r}.each do |name|
- assert(!trans.configuration.vertex?(Puppet::Type.type(:generator)[name]),
- "Generated vertex %s was not removed from graph" % name)
- assert_nil(Puppet::Type.type(:generator)[name],
- "Generated vertex %s was not removed from class" % name)
+ assert(!trans.configuration.vertex?(config.resource(:generator, name)), "Generated vertex %s was not removed from graph" % name)
+ assert_nil(config.resource(:generator, name), "Generated vertex %s was not removed from class" % name)
end
end
@@ -645,7 +643,7 @@ class TestTransactions < Test::Unit::TestCase
assert_nothing_raised("failed to apply yay") do
trans.eval_resource(yay)
end
- ya = type["ya"]
+ ya = config.resource(:generator, "ya")
assert(ya, "Did not generate ya")
assert(trans.relationship_graph.vertex?(ya),
"Did not add ya to rel_graph")
@@ -658,11 +656,11 @@ class TestTransactions < Test::Unit::TestCase
# Now make sure it in turn eval_generates appropriately
assert_nothing_raised("failed to apply yay") do
- trans.eval_resource(type["ya"])
+ trans.eval_resource(config.resource(:generator, "ya"))
end
%w{y}.each do |name|
- res = type[name]
+ res = config.resource(:generator, name)
assert(res, "Did not generate %s" % name)
assert(trans.relationship_graph.vertex?(res),
"Did not add %s to rel_graph" % name)
@@ -670,7 +668,7 @@ class TestTransactions < Test::Unit::TestCase
end
assert_nothing_raised("failed to eval_generate with nil response") do
- trans.eval_resource(type["y"])
+ trans.eval_resource(config.resource(:generator, "y"))
end
assert(trans.relationship_graph.edge?(yay, ya), "no edge was created for ya => yay")
@@ -678,7 +676,7 @@ class TestTransactions < Test::Unit::TestCase
trans.eval_resource(rah)
end
- ra = type["ra"]
+ ra = config.resource(:generator, "ra")
assert(ra, "Did not generate ra")
assert(trans.relationship_graph.vertex?(ra),
"Did not add ra to rel_graph" % name)
@@ -697,9 +695,9 @@ class TestTransactions < Test::Unit::TestCase
end
%w{ya ra y r}.each do |name|
- assert(!trans.relationship_graph.vertex?(type[name]),
+ assert(!trans.relationship_graph.vertex?(config.resource(:generator, name)),
"Generated vertex %s was not removed from graph" % name)
- assert_nil(type[name],
+ assert_nil(config.resource(:generator, name),
"Generated vertex %s was not removed from class" % name)
end
diff --git a/test/ral/types/basic.rb b/test/ral/types/basic.rb
index 4427238bf..862beeadc 100755
--- a/test/ral/types/basic.rb
+++ b/test/ral/types/basic.rb
@@ -68,13 +68,6 @@ class TestBasic < Test::Unit::TestCase
assert_equal("echo", @command.title)
end
- def test_object_retrieval
- [@command, @configfile].each { |obj|
- assert_equal(obj.class[obj.name].object_id, obj.object_id,
- "%s did not match class version" % obj.ref)
- }
- end
-
def test_paths
[@configfile, @command, @component].each { |obj|
assert_nothing_raised {
diff --git a/test/ral/types/cron.rb b/test/ral/types/cron.rb
index a9a00240c..d6f29efe4 100755
--- a/test/ral/types/cron.rb
+++ b/test/ral/types/cron.rb
@@ -150,20 +150,6 @@ class TestCron < Test::Unit::TestCase
end
end
- def test_makeandretrievecron
- %w{storeandretrieve a-name another-name more_naming SomeName}.each do |name|
- cron = mkcron(name)
- comp = mk_configuration(name, cron)
- trans = assert_events([:cron_created], comp, name)
-
- cron.provider.class.prefetch
- cron = nil
-
- assert(cron = Puppet.type(:cron)[name], "Could not retrieve named cron")
- assert_instance_of(Puppet.type(:cron), cron)
- end
- end
-
# Do input validation testing on all of the parameters.
def test_arguments
values = {
diff --git a/test/ral/types/exec.rb b/test/ral/types/exec.rb
index 11a6d4055..ed0ea9980 100755
--- a/test/ral/types/exec.rb
+++ b/test/ral/types/exec.rb
@@ -203,42 +203,45 @@ class TestExec < Test::Unit::TestCase
)
comp = mk_configuration("Testing", file, exec)
+ Puppet::Node::Facts.indirection.stubs(:terminus_class).returns(:memory)
assert_events([:file_created, :executed_command], comp)
end
# Verify that we auto-require any managed scripts.
def test_autorequire_files
+ config = mk_configuration
+
exe = tempfile()
oexe = tempfile()
sh = %x{which sh}
File.open(exe, "w") { |f| f.puts "#!#{sh}\necho yup" }
- file = Puppet.type(:file).create(
+ file = config.create_resource(:file,
:path => oexe,
:source => exe,
:mode => 755
)
basedir = File.dirname(oexe)
- baseobj = Puppet.type(:file).create(
+ baseobj = config.create_resource(:file,
:path => basedir,
:source => exe,
:mode => 755
)
- ofile = Puppet.type(:file).create(
+ ofile = config.create_resource(:file,
:path => exe,
:mode => 755
)
- exec = Puppet.type(:exec).create(
+ exec = config.create_resource(:exec,
:command => oexe,
:path => ENV["PATH"],
:cwd => basedir
)
- cat = Puppet.type(:exec).create(
+ cat = config.create_resource(:exec,
:command => "cat %s %s" % [exe, oexe],
:path => ENV["PATH"]
)
diff --git a/test/ral/types/file.rb b/test/ral/types/file.rb
index 73095a783..8435855e6 100755
--- a/test/ral/types/file.rb
+++ b/test/ral/types/file.rb
@@ -3,10 +3,12 @@
require File.dirname(__FILE__) + '/../../lib/puppettest'
require 'puppettest'
+require 'puppettest/support/utils'
require 'fileutils'
class TestFile < Test::Unit::TestCase
include PuppetTest::FileTesting
+ include PuppetTest::Support::Utils
# hmmm
# this is complicated, because we store references to the created
# objects in a central store
@@ -32,6 +34,8 @@ class TestFile < Test::Unit::TestCase
@file = Puppet::Type.type(:file)
$method = @method_name
Puppet[:filetimeout] = -1
+ Facter.stubs(:each)
+ Facter.stubs(:to_hash).returns({})
end
def teardown
@@ -514,7 +518,7 @@ class TestFile < Test::Unit::TestCase
test = File.join(path, "file")
File.open(test, "w") { |f| f.puts "yay" }
assert_nothing_raised() { ret = dir.localrecurse(true) }
- fileobj = @file[test]
+ fileobj = config.resource(:file, test)
assert(fileobj, "child object was not created")
assert_equal([fileobj], ret, "child object was not returned")
@@ -558,7 +562,7 @@ class TestFile < Test::Unit::TestCase
assert_nothing_raised() { ret = dir.localrecurse(true) }
assert_equal([bad], ret.collect { |f| f.title }, "purge failed")
- badobj = @file[bad]
+ badobj = config.resource(:file, bad)
assert(badobj, "did not create bad object")
end
@@ -754,43 +758,6 @@ class TestFile < Test::Unit::TestCase
assert(file.insync?(currentvalues))
end
- def test_remove
- basedir = tempfile()
- subdir = File.join(basedir, "this")
- FileUtils.mkdir_p(subdir)
-
- dir = nil
- assert_nothing_raised {
- dir = Puppet.type(:file).create(
- :path => basedir,
- :recurse => true,
- :check => %w{owner mode group}
- )
- }
- mk_configuration dir
-
- assert_nothing_raised {
- dir.eval_generate
- }
-
- obj = nil
- assert_nothing_raised {
- obj = Puppet.type(:file)[subdir]
- }
-
- assert(obj, "Could not retrieve subdir object")
-
- assert_nothing_raised {
- obj.remove(true)
- }
-
- assert_nothing_raised {
- obj = Puppet.type(:file)[subdir]
- }
-
- assert_nil(obj, "Retrieved removed object")
- end
-
def test_path
dir = tempfile()
@@ -810,14 +777,14 @@ class TestFile < Test::Unit::TestCase
:check => %w{mode owner group}
)
}
- mk_configuration dirobj
+ config = mk_configuration dirobj
assert_nothing_raised {
dirobj.eval_generate
}
assert_nothing_raised {
- file = dirobj.class[path]
+ file = config.resource(:file, path)
}
assert(file, "Could not retrieve file object")
@@ -829,12 +796,14 @@ class TestFile < Test::Unit::TestCase
basedir = tempfile()
subfile = File.join(basedir, "subfile")
- baseobj = Puppet.type(:file).create(
+ config = Puppet::Node::Configuration.new
+
+ baseobj = config.create_resource(:file,
:name => basedir,
:ensure => "directory"
)
- subobj = Puppet.type(:file).create(
+ subobj = config.create_resource(:file,
:name => subfile,
:ensure => "file"
)
@@ -1129,18 +1098,17 @@ class TestFile < Test::Unit::TestCase
file = tempfile()
newfile = tempfile()
+ config = mk_configuration
+
File.open(file, "w", 0411) { |f| f.puts "yayness" }
- obj = nil
- assert_nothing_raised {
- obj = Puppet::Type.type(:file).create(
- :path => file, :content => "rahness\n", :backup => ".puppet-bak"
- )
- }
+ resource = config.create_resource(:file,
+ :path => file, :content => "rahness\n", :backup => ".puppet-bak"
+ )
- assert_apply(obj)
+ assert_apply(config)
- backupfile = file + obj[:backup]
+ backupfile = file + resource[:backup]
@@tmpfiles << backupfile
assert(FileTest.exists?(backupfile),
"Backup file %s does not exist" % backupfile)
@@ -1151,13 +1119,15 @@ class TestFile < Test::Unit::TestCase
bucket = "bucket"
bpath = tempfile()
Dir.mkdir(bpath)
- Puppet::Type.type(:filebucket).create(
+ config.create_resource(:filebucket,
:title => bucket, :path => bpath
)
- obj[:backup] = bucket
- obj[:content] = "New content"
- assert_apply(obj)
+ resource[:backup] = bucket
+ resource[:content] = "New content"
+
+ resource.finish
+ assert_apply(config)
md5 = "18cc17fa3047fcc691fdf49c0a7f539a"
dir, file, pathfile = Puppet::Network::Handler.filebucket.paths(bpath, md5)
@@ -1286,19 +1256,20 @@ class TestFile < Test::Unit::TestCase
# this file should get removed
File.open(purgee, "w") { |f| f.puts "footest" }
- lfobj = Puppet::Type.newfile(
+ config = mk_configuration
+
+ lfobj = config.create_resource(:file,
:title => "localfile",
:path => localfile,
:content => "rahtest",
:backup => false
)
- destobj = Puppet::Type.newfile(:title => "destdir", :path => destdir,
+ destobj = config.create_resource(:file, :title => "destdir", :path => destdir,
:source => sourcedir,
:backup => false,
:recurse => true)
- config = mk_configuration(lfobj, destobj)
config.apply
assert(FileTest.exists?(dsourcefile), "File did not get copied")
@@ -1431,10 +1402,11 @@ class TestFile < Test::Unit::TestCase
:link => proc { File.symlink(linkdest, path) }
}
- bucket = Puppet::Type.newfilebucket :name => "main", :path => tempfile()
+ config = mk_configuration
+
+ bucket = config.create_resource :filebucket, :name => "main", :path => tempfile()
- obj = Puppet::Type.newfile :path => path, :force => true,
- :links => :manage
+ obj = config.create_resource :file, :path => path, :force => true, :links => :manage
Puppet[:trace] = true
["main", false].each do |backup|
@@ -1557,15 +1529,17 @@ class TestFile < Test::Unit::TestCase
dfiles = [File.join(dest, "1"), File.join(dest, "dir", "2")]
bpath = tempfile
- bucket = Puppet::Type.type(:filebucket).create :name => "rtest", :path => bpath
+
+ config = mk_configuration
+ bucket = config.create_resource :filebucket, :name => "rtest", :path => bpath
dipper = bucket.bucket
dipper = Puppet::Network::Handler.filebucket.new(
:Path => bpath
)
assert(dipper, "did not receive bucket client")
- file = Puppet::Type.newfile :path => dest, :source => source, :recurse => true, :backup => "rtest"
+ file = config.create_resource :file, :path => dest, :source => source, :recurse => true, :backup => "rtest"
- assert_apply(file)
+ config.apply
dfiles.each do |f|
assert(FileTest.exists?(f), "destfile %s was not created" % f)
end
@@ -1575,7 +1549,7 @@ class TestFile < Test::Unit::TestCase
f.puts "boo: %s" % File.basename(sf)
} }
- assert_apply(file)
+ config.apply
dfiles.each do |f|
assert_equal("boo: %s\n" % File.basename(f), File.read(f),
"file was not copied correctly")
@@ -1600,7 +1574,8 @@ class TestFile < Test::Unit::TestCase
def test_backup
path = tempfile()
- file = Puppet::Type.newfile :path => path, :content => "yay"
+ config = Puppet::Node::Configuration.new
+ file = config.create_resource :file, :path => path, :content => "yay"
[false, :false, "false"].each do |val|
assert_nothing_raised do
@@ -1629,7 +1604,7 @@ class TestFile < Test::Unit::TestCase
assert_equal("main", file.bucket, "file's bucket was not set")
# And then an existing bucket
- obj = Puppet::Type.type(:filebucket).create :name => "testing"
+ obj = config.create_resource :filebucket, :name => "testing"
bucket = obj.bucket
assert_nothing_raised do
@@ -1645,12 +1620,12 @@ class TestFile < Test::Unit::TestCase
file = File.join(dir, "file")
File.open(file, "w") { |f| f.puts "" }
obj = Puppet::Type.newfile :path => dir, :recurse => true, :mode => 0755
- mk_configuration obj
+ config = mk_configuration obj
assert_equal("/%s" % obj.ref, obj.path)
list = obj.eval_generate
- fileobj = obj.class[file]
+ fileobj = config.resource(:file, file)
assert(fileobj, "did not generate file object")
assert_equal("/%s" % fileobj.ref, fileobj.path, "did not generate correct subfile path")
end
@@ -1667,7 +1642,8 @@ class TestFile < Test::Unit::TestCase
# Testing #434
def test_stripping_extra_slashes_during_lookup
- file = Puppet::Type.newfile(:path => "/one/two")
+ config = mk_configuration
+ file = config.create_resource(:file, :path => "/one/two")
%w{/one/two/ /one/two /one//two //one//two//}.each do |path|
assert(Puppet::Type.type(:file)[path], "could not look up file via path %s" % path)
end
@@ -1762,14 +1738,14 @@ class TestFile < Test::Unit::TestCase
assert_nothing_raised("Failure when recursing") do
children = obj.eval_generate
end
- assert(obj.class[subdir], "did not create subdir object")
+ assert(config.resource(:file, subdir), "did not create subdir object")
children.each do |c|
assert_nothing_raised("Failure when recursing on %s" % c) do
c.configuration = config
others = c.eval_generate
end
end
- oobj = obj.class[other]
+ oobj = config.resource(:file, other)
assert(oobj, "did not create other object")
assert_nothing_raised do
@@ -1780,12 +1756,14 @@ class TestFile < Test::Unit::TestCase
# Make sure we default to the "puppet" filebucket, rather than a string
def test_backup_defaults_to_bucket
path = tempfile
- file = Puppet::Type.newfile(:path => path, :content => 'some content')
+ config = Puppet::Node::Configuration.new
+ config.add_resource(Puppet::Type.type(:filebucket).create_default_resources)
+ file = config.create_resource :file, :path => path, :content => 'some content'
file.finish
- assert_instance_of(Puppet::Network::Client::Dipper, file.bucket,
+ assert_instance_of(Puppet::Network::Client.dipper, file.bucket,
"did not default to a filebucket for backups")
- assert_equal(Puppet::Type.type(:filebucket)["puppet"].bucket, file.bucket,
+ assert_equal(config.resource(:filebucket, "puppet").bucket, file.bucket,
"did not default to the 'puppet' filebucket")
end
@@ -1804,7 +1782,7 @@ class TestFile < Test::Unit::TestCase
assert_nothing_raised do
children = obj.eval_generate
end
- fobj = obj.class[file]
+ fobj = config.resource(:file,file)
assert(fobj, "did not create file object")
assert(fobj.should(:ensure) != :directory, "ensure was passed to child")
end
diff --git a/test/ral/types/file/target.rb b/test/ral/types/file/target.rb
index f5cbe4a45..cc53e2645 100755
--- a/test/ral/types/file/target.rb
+++ b/test/ral/types/file/target.rb
@@ -3,9 +3,11 @@
require File.dirname(__FILE__) + '/../../../lib/puppettest'
require 'puppettest'
+require 'puppettest/support/assertions'
require 'fileutils'
class TestFileTarget < Test::Unit::TestCase
+ include PuppetTest
include PuppetTest::FileTesting
def setup
@@ -44,7 +46,7 @@ class TestFileTarget < Test::Unit::TestCase
def test_linkrecurse
dest = tempfile()
link = @file.create :path => tempfile(), :recurse => true, :ensure => dest
- mk_configuration link
+ config = mk_configuration link
ret = nil
@@ -62,7 +64,8 @@ class TestFileTarget < Test::Unit::TestCase
assert_equal(:directory, link.should(:ensure), "ensure was not set to directory")
assert_equal([File.join(link.title, "one")], ret.collect { |f| f.title },
"Did not get linked file")
- oneobj = @file[File.join(link.title, "one")]
+ oneobj = config.resource(:file, File.join(link.title, "one"))
+
assert_equal(one, oneobj.should(:target), "target was not set correctly")
oneobj.remove
@@ -81,7 +84,7 @@ class TestFileTarget < Test::Unit::TestCase
"Did not get links back")
returns.each do |path|
- obj = @file[path]
+ obj = config.resource(:file, path)
assert(path, "did not get obj for %s" % path)
sdest = File.join(dest, File.basename(path))
assert_equal(sdest, obj.should(:target),
@@ -99,15 +102,14 @@ class TestFileTarget < Test::Unit::TestCase
system("touch %s" % file)
link = nil
- assert_nothing_raised {
- link = Puppet.type(:file).create(
- :ensure => source,
- :path => path,
- :recurse => true
- )
- }
+ config = mk_configuration
+ link = config.create_resource(:file,
+ :ensure => source,
+ :path => path,
+ :recurse => true
+ )
- assert_apply(link)
+ config.apply
sublink = File.join(path, "subdir")
linkpath = File.join(sublink, "file")
@@ -116,7 +118,7 @@ class TestFileTarget < Test::Unit::TestCase
assert(File.symlink?(linkpath), "path is not a link")
assert_equal(file, File.readlink(linkpath))
- assert_nil(@file[sublink], "objects were not removed")
+ assert_nil(config.resource(:file, sublink), "objects were not removed")
assert_equal([], link.evaluate, "Link is not in sync")
end
diff --git a/test/ral/types/filebucket.rb b/test/ral/types/filebucket.rb
index ecfe0e167..3681febf4 100755
--- a/test/ral/types/filebucket.rb
+++ b/test/ral/types/filebucket.rb
@@ -3,10 +3,12 @@
require File.dirname(__FILE__) + '/../../lib/puppettest'
require 'puppettest'
+require 'puppettest/support/utils'
require 'fileutils'
class TestFileBucket < Test::Unit::TestCase
include PuppetTest::FileTesting
+ include PuppetTest::Support::Utils
# hmmm
# this is complicated, because we store references to the created
# objects in a central store
@@ -63,14 +65,9 @@ class TestFileBucket < Test::Unit::TestCase
def test_simplebucket
name = "yayness"
bucketpath = tempfile()
- mkbucket(name, bucketpath)
+ bucket_resource = mkbucket(name, bucketpath)
- bucket = nil
- assert_nothing_raised {
- bucket = Puppet.type(:filebucket).bucket(name)
- }
-
- assert_instance_of(Puppet::Network::Client.dipper, bucket)
+ bucket = bucket_resource.bucket
md5 = nil
newpath = tempfile()
@@ -109,15 +106,16 @@ class TestFileBucket < Test::Unit::TestCase
end
def test_fileswithbuckets
+ Facter.stubs(:to_hash).returns({})
name = "yayness"
- mkbucket(name, tempfile())
+ resource = mkbucket(name, tempfile())
- bucket = nil
- assert_nothing_raised {
- bucket = Puppet.type(:filebucket).bucket(name)
- }
+ config = mk_configuration resource
+
+ bucket = resource.bucket
file = mktestfile()
+ config.add_resource(file)
assert_nothing_raised {
file[:backup] = name
}
@@ -133,7 +131,7 @@ class TestFileBucket < Test::Unit::TestCase
# file[:backup] = true
#}
- assert_apply(file)
+ config.apply
# so, we've now replaced the file with the opath file
assert_equal(
diff --git a/test/ral/types/fileignoresource.rb b/test/ral/types/fileignoresource.rb
index 5c7536453..501672ab7 100755
--- a/test/ral/types/fileignoresource.rb
+++ b/test/ral/types/fileignoresource.rb
@@ -3,11 +3,13 @@
require File.dirname(__FILE__) + '/../../lib/puppettest'
require 'puppettest'
+require 'puppettest/support/utils'
require 'cgi'
require 'fileutils'
class TestFileIgnoreSources < Test::Unit::TestCase
include PuppetTest::FileTesting
+ include PuppetTest::Support::Utils
def setup
super
@@ -18,7 +20,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase
end
end
-#This is not needed unless using md5 (correct me if I'm wrong)
+ #This is not needed unless using md5 (correct me if I'm wrong)
def initstorage
Puppet::Util::Storage.init
Puppet::Util::Storage.load
@@ -30,6 +32,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase
end
def test_ignore_simple_source
+ Facter.stubs(:to_hash).returns({})
#Temp directory to run tests in
path = tempfile()
@@ -89,6 +92,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase
end
def test_ignore_with_wildcard
+ Facter.stubs(:to_hash).returns({})
#Temp directory to run tests in
path = tempfile()
@@tmpfiles.push path
@@ -158,6 +162,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase
end
def test_ignore_array
+ Facter.stubs(:to_hash).returns({})
#Temp directory to run tests in
path = tempfile()
@@tmpfiles.push path
diff --git a/test/ral/types/filesources.rb b/test/ral/types/filesources.rb
index 1f22fc9e0..bfbc185e3 100755
--- a/test/ral/types/filesources.rb
+++ b/test/ral/types/filesources.rb
@@ -3,11 +3,13 @@
require File.dirname(__FILE__) + '/../../lib/puppettest'
require 'puppettest'
+require 'puppettest/support/assertions'
require 'cgi'
require 'fileutils'
require 'mocha'
class TestFileSources < Test::Unit::TestCase
+ include PuppetTest
include PuppetTest::FileTesting
def setup
super
@@ -285,7 +287,7 @@ class TestFileSources < Test::Unit::TestCase
end
assert_equal([destfile], sourced, "Did not get correct list of sourced objects")
- dfileobj = @file[destfile]
+ dfileobj = config.resource(:file, destfile)
assert(dfileobj, "Did not create destfile object")
assert_equal([dfileobj], result)
@@ -301,7 +303,7 @@ class TestFileSources < Test::Unit::TestCase
result, sourced = obj.sourcerecurse(true)
end
assert_equal([destfile], sourced, "Did not get correct list of sourced objects")
- dfileobj = @file[destfile]
+ dfileobj = config.resource(:file, destfile)
assert(dfileobj, "Did not create destfile object with a missing source")
assert_equal([dfileobj], result)
dfileobj.remove
@@ -415,9 +417,6 @@ class TestFileSources < Test::Unit::TestCase
def test_sources_with_deleted_destfiles
fromdir, todir, one, two = run_complex_sources
assert(FileTest.exists?(todir))
-
- # We shouldn't have a 'two' file object in memory
- assert_nil(@file[two], "object for 'two' is still in memory")
# then delete a file
File.unlink(two)
@@ -939,7 +938,6 @@ class TestFileSources < Test::Unit::TestCase
end
File.unlink(file1)
File.unlink(file3)
- Puppet.err :yay
assert_apply(obj)
assert(FileTest.exists?(file1), "File from source 1 was not copied")
diff --git a/test/ral/types/host.rb b/test/ral/types/host.rb
index 1013651c5..5e91a8c58 100755
--- a/test/ral/types/host.rb
+++ b/test/ral/types/host.rb
@@ -154,11 +154,13 @@ class TestHost < Test::Unit::TestCase
def test_puppetalias
host = mkhost()
+ config = mk_configuration(host)
+
assert_nothing_raised {
host[:alias] = "testing"
}
- same = host.class["testing"]
+ same = config.resource(:host, "testing")
assert(same, "Could not retrieve by alias")
end
end
diff --git a/test/ral/types/package.rb b/test/ral/types/package.rb
index 7d0caa0ba..d09f7d9b7 100755
--- a/test/ral/types/package.rb
+++ b/test/ral/types/package.rb
@@ -9,6 +9,7 @@ require 'mocha'
$platform = Facter["operatingsystem"].value
class TestPackages < Test::Unit::TestCase
+ include PuppetTest
include PuppetTest::FileTesting
def setup
super
diff --git a/test/ral/types/parameter.rb b/test/ral/types/parameter.rb
index 1d402cb85..7eda05bb5 100755
--- a/test/ral/types/parameter.rb
+++ b/test/ral/types/parameter.rb
@@ -113,8 +113,7 @@ class TestParameter < Test::Unit::TestCase
inst = type.create(:name => "test")
- config = mk_configuration
- inst.configuration = config
+ config = mk_configuration(inst)
assert_nothing_raised("Could not create shadowed param") {
inst[:alias] = "foo"
@@ -131,7 +130,7 @@ class TestParameter < Test::Unit::TestCase
assert_instance_of(param, obj, "alias is an instance of the wrong class")
# Make sure the alias got created
- assert(type["foo"], "Did not retrieve object by its alias")
+ assert(config.resource(inst.class.name, "foo"), "Did not retrieve object by its alias")
# Now try it during initialization
other = nil
diff --git a/test/ral/types/schedule.rb b/test/ral/types/schedule.rb
index 2870b8db6..06698f288 100755
--- a/test/ral/types/schedule.rb
+++ b/test/ral/types/schedule.rb
@@ -242,24 +242,23 @@ class TestSchedule < Test::Unit::TestCase
s = mksched
s[:period] = :hourly
- f = nil
path = tempfile()
- assert_nothing_raised {
- f = Puppet.type(:file).create(
- :name => path,
- :schedule => s.name,
- :ensure => "file"
- )
- }
+ f = Puppet.type(:file).create(
+ :name => path,
+ :schedule => s.name,
+ :ensure => "file"
+ )
+
+ config = mk_configuration(s, f)
assert(f.scheduled?, "File is not scheduled to run")
- assert_apply(f)
+ config.apply
assert(! f.scheduled?, "File is scheduled to run already")
File.unlink(path)
- assert_apply(f)
+ config.apply
assert(! FileTest.exists?(path), "File was created when not scheduled")
end
@@ -287,25 +286,17 @@ class TestSchedule < Test::Unit::TestCase
# Verify that each of our default schedules exist
def test_defaultschedules
- assert_nothing_raised do
- Puppet.type(:schedule).mkdefaultschedules
+ defaults = nil
+ assert_nothing_raised("Could not create default schedules") do
+ defaults = Puppet.type(:schedule).create_default_resources
end
s = {}
%w{puppet hourly daily weekly monthly}.each { |period|
- obj = Puppet.type(:schedule)[period]
- assert(obj, "Could not find %s schedule" %
+ schedule = defaults.find { |r| r.title == period }
+ assert(schedule, "Could not find %s schedule" %
period)
- s[period] = obj
+ s[period] = schedule
}
- assert_nothing_raised("Could not rerun mkdefaultschedules") do
- Puppet.type(:schedule).mkdefaultschedules
- end
- s.each do |period, obj|
- newobj = Puppet.type(:schedule)[period]
- assert(newobj, "somehow lost schedule for %s" % period)
- assert_equal(obj.object_id, newobj.object_id,
- "created a new schedule instead of reusing existing one")
- end
end
def test_period_with_repeat
diff --git a/test/ral/types/sshkey.rb b/test/ral/types/sshkey.rb
index c99f7562a..a2daf6cfb 100755
--- a/test/ral/types/sshkey.rb
+++ b/test/ral/types/sshkey.rb
@@ -102,6 +102,8 @@ class TestSSHKey < Test::Unit::TestCase
def test_moddingkey
key = mkkey()
+ config = mk_configuration(key)
+
assert_events([:sshkey_created], key)
key.retrieve
@@ -113,7 +115,7 @@ class TestSSHKey < Test::Unit::TestCase
assert_events([:sshkey_changed], key)
aliases.each do |name|
- assert_equal(key, key.class[name],
+ assert_equal(key, config.resource(:sshkey, name),
"alias was not set")
end
end
@@ -131,12 +133,13 @@ class TestSSHKey < Test::Unit::TestCase
def test_puppetalias
key = mkkey()
+ config = mk_configuration(key)
assert_nothing_raised {
key[:alias] = "testing"
}
- same = key.class["testing"]
+ same = config.resource(:sshkey, "testing")
assert(same, "Could not retrieve by alias")
end
@@ -168,13 +171,14 @@ class TestSSHKey < Test::Unit::TestCase
keys << k
names << k.name
}
- assert_apply(*keys)
- keys.clear
- Puppet.type(:sshkey).clear
+ config = mk_configuration(*keys)
+ config.apply
+
newkey = mkkey()
- #newkey[:ensure] = :present
+ config = mk_configuration(newkey)
names << newkey.name
- assert_apply(newkey)
+
+ config.apply
# Verify we can retrieve that info
assert_nothing_raised("Could not retrieve after second write") {
diff --git a/test/ral/types/tidy.rb b/test/ral/types/tidy.rb
index e95f26b95..6cdf0f050 100755
--- a/test/ral/types/tidy.rb
+++ b/test/ral/types/tidy.rb
@@ -3,8 +3,10 @@
require File.dirname(__FILE__) + '/../../lib/puppettest'
require 'puppettest'
+require 'puppettest/support/utils'
class TestTidy < Test::Unit::TestCase
+ include PuppetTest
include PuppetTest::FileTesting
def mktmpfile
# because luke's home directory is on nfs, it can't be used for testing
@@ -201,16 +203,10 @@ class TestTidy < Test::Unit::TestCase
path = tempfile()
File.open(path, "w") { |f| 10.times { f.puts "yayness " } }
tidy = Puppet::Type.type(:tidy).create :path => path, :size => "1b"
-
- assert_apply(tidy)
- assert(! FileTest.exists?(path), "file did not get tidied")
-
- # Now try one with just an age attribute.
- File.open(path, "w") { |f| 10.times { f.puts "yayness " } }
- tidy = Puppet::Type.type(:tidy).create :path => path, :age => "5s"
-
+ config = mk_configuration(tidy)
+
+ config.apply
- assert_apply(tidy)
assert(! FileTest.exists?(path), "file did not get tidied")
end
diff --git a/test/util/filetype.rb b/test/util/filetype.rb
index 6c7ede07b..a53fb385f 100755
--- a/test/util/filetype.rb
+++ b/test/util/filetype.rb
@@ -85,8 +85,7 @@ class TestFileType < Test::Unit::TestCase
assert_nothing_raised("Could not call backup with no buckets") do
obj.backup
end
- puppet = type["puppet"]
- assert(puppet, "Did not create default filebucket")
+ puppet = Puppet::Type.type(:filebucket).create_default_resources
assert_equal("one", puppet.bucket.getfile(Digest::MD5.hexdigest(File.read(path))), "Could not get file from backup")