diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-06-28 19:47:36 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-06-28 19:47:36 +0000 |
| commit | e8c57ae6decdd5409c102f23488a18022f80836d (patch) | |
| tree | ea02d9b8bd5144262704e9fb734d812e43754d50 /test | |
| parent | d98ab112a6ed5cd84d4e8b2e9c349283923ecc29 (diff) | |
Cleaning up plugin handling a bit -- they can now be colon-separated paths, and I added a separate "plugindest" setting for determining where plugins are synchronized to. The major feature I added, though, is that Puppet::Type now knows how to load plugins, and treats :pluginpath as a search path for plugins.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1330 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rw-r--r-- | test/client/master.rb | 9 | ||||
| -rwxr-xr-x | test/types/filesources.rb | 6 | ||||
| -rw-r--r-- | test/types/type.rb | 48 |
3 files changed, 61 insertions, 2 deletions
diff --git a/test/client/master.rb b/test/client/master.rb index a2dbad22d..0a35a78c3 100644 --- a/test/client/master.rb +++ b/test/client/master.rb @@ -154,7 +154,7 @@ end client.send(:getplugins) } - destfile = File.join(Puppet[:pluginpath], "myplugin.rb") + destfile = File.join(Puppet[:plugindest], "myplugin.rb") assert(File.exists?(destfile), "Did not get plugin") @@ -196,5 +196,12 @@ end assert(! obj.validattr?(:argument), "Old namevar is still valid") + + # Now make sure it works with multiple paths specified. + newdir = tempfile() + Dir.mkdir(newdir) + Puppet[:pluginpath] = [Puppet[:pluginpath], newdir].join(":") + + client.send(:getplugins) end end diff --git a/test/types/filesources.rb b/test/types/filesources.rb index b9f3a7fdb..b69e83008 100755 --- a/test/types/filesources.rb +++ b/test/types/filesources.rb @@ -541,12 +541,16 @@ class TestFileSources < Test::Unit::TestCase assert(FileTest.file?(dest), "Destination is not a file") # Now copy the links - assert_raise(Puppet::FileServerError) { + #assert_raise(Puppet::FileServerError) { + trans = nil + assert_nothing_raised { file[:links] = :manage comp = newcomp(file) trans = comp.evaluate trans.evaluate } + + assert(trans.failed?(file), "Object did not fail to copy links") end def test_changes diff --git a/test/types/type.rb b/test/types/type.rb index d9e5d7577..287d02be6 100644 --- a/test/types/type.rb +++ b/test/types/type.rb @@ -320,6 +320,54 @@ class TestType < Test::Unit::TestCase comp.parent = file end end + + def test_loadplugins + names = %w{loadedplugin1 loadplugin2 loadplugin3} + dirs = [] + 3.times { dirs << tempfile() } + # Set plugindest to something random + Puppet[:plugindest] = tempfile() + + Puppet[:pluginpath] = dirs.join(":") + + names.each do |name| + dir = dirs.shift + Dir.mkdir(dir) + + # Create an extra file for later + [name, name + "2ness"].each do |n| + file = File.join(dir, n + ".rb") + File.open(file, "w") do |f| + f.puts %{Puppet::Type.newtype('#{n}') do + newparam(:argument) do + isnamevar + end +end +} + end + end + + assert(Puppet::Type.type(name), + "Did not get loaded plugin") + + assert_nothing_raised { + Puppet::Type.type(name).create( + :name => "myname" + ) + } + end + + # Now make sure the plugindest got added to our pluginpath + assert(Puppet[:pluginpath].split(":").include?(Puppet[:plugindest]), + "Plugin dest did not get added to plugin path") + + # Now make sure it works with just a single path, using the extra files + # created above. + Puppet[:pluginpath] = Puppet[:pluginpath].split(":")[0] + assert(Puppet::Type.type("loadedplugin12ness"), + "Did not get loaded plugin") + + end end # $Id$ |
