summaryrefslogtreecommitdiffstats
path: root/test/network
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-10 04:17:07 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-10 04:17:07 +0000
commite662c869bf8b2924c12d4ff6f999f0744779257d (patch)
treeb57a7c661f3a6179c0a13b0b155142064062141a /test/network
parent7befe1bc5ac9d4524c4c43514a24f1bb19b74727 (diff)
downloadpuppet-e662c869bf8b2924c12d4ff6f999f0744779257d.tar.gz
puppet-e662c869bf8b2924c12d4ff6f999f0744779257d.tar.xz
puppet-e662c869bf8b2924c12d4ff6f999f0744779257d.zip
Fixing #621 -- plugins are now downloaded directly into the $libdir, and autoload looks for them there. You can now easily download any reloadable file to your clients.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2669 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/network')
-rwxr-xr-xtest/network/client/master.rb51
1 files changed, 13 insertions, 38 deletions
diff --git a/test/network/client/master.rb b/test/network/client/master.rb
index 89de171db..78a1a0a11 100755
--- a/test/network/client/master.rb
+++ b/test/network/client/master.rb
@@ -264,63 +264,38 @@ class TestMasterClient < Test::Unit::TestCase
Puppet[:filetimeout] = -1
Puppet[:pluginsource] = tempfile()
Dir.mkdir(Puppet[:pluginsource])
+ Dir.mkdir(File.join(Puppet[:pluginsource], "testing"))
- myplugin = File.join(Puppet[:pluginsource], "myplugin.rb")
+ $loaded = []
+ loader = Puppet::Util::Autoload.new(self, "testing")
+
+ myplugin = File.join(Puppet[:pluginsource], "testing", "myplugin.rb")
File.open(myplugin, "w") do |f|
- f.puts %{Puppet::Type.newtype(:myplugin) do
- newparam(:argument) do
- isnamevar
- end
-end
-}
+ f.puts %{$loaded << :myplugin}
end
- assert_nothing_raised {
+ assert_nothing_raised("Could not get plugins") {
Puppet::Network::Client.master.getplugins
}
- destfile = File.join(Puppet[:plugindest], "myplugin.rb")
+ destfile = File.join(Puppet[:plugindest], "testing", "myplugin.rb")
assert(File.exists?(destfile), "Did not get plugin")
- obj = Puppet::Type.type(:myplugin)
+ assert(loader.load(:myplugin), "Did not load downloaded plugin")
- assert(obj, "Did not define type")
-
- assert(obj.validattr?(:argument),
- "Did not get namevar")
+ assert($loaded.include?(:myplugin), "Downloaded code was not evaluated")
# Now modify the file and make sure the type is replaced
File.open(myplugin, "w") do |f|
- f.puts %{Puppet::Type.newtype(:myplugin) do
- newparam(:yayness) do
- isnamevar
- end
-
- newparam(:rahness) do
- end
-end
-}
+ f.puts %{$loaded << :changed}
end
- assert_nothing_raised {
+ assert_nothing_raised("Could not get plugin changes") {
Puppet::Network::Client.master.getplugins
}
- destfile = File.join(Puppet[:pluginpath], "myplugin.rb")
-
- obj = Puppet::Type.type(:myplugin)
-
- assert(obj, "Did not define type")
-
- assert(obj.validattr?(:yayness),
- "Did not get namevar")
-
- assert(obj.validattr?(:rahness),
- "Did not get other var")
-
- assert(! obj.validattr?(:argument),
- "Old namevar is still valid")
+ assert($loaded.include?(:changed), "Changed code was not evaluated")
# Now try it again, to make sure we don't have any objects lying around
assert_nothing_raised {