summaryrefslogtreecommitdiff
path: root/test/client
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-20 00:25:35 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-20 00:25:35 +0000
commit0a1e847961977221b36d7d6c8babffe6fa69c4b6 (patch)
tree643b1f62852be92a6d03270c47135bff795e4fbf /test/client
parentedabf9e4938b06d2c03117e4812749fb7779bce7 (diff)
downloadpuppet-0a1e847961977221b36d7d6c8babffe6fa69c4b6.tar.gz
Adding plugins and plugin management. The Master Client will now automatically download plugins if pluginsync is enabled, and they will be automatically sourced.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1302 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/client')
-rw-r--r--test/client/master.rb64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/client/master.rb b/test/client/master.rb
index 24cc195e6..a2dbad22d 100644
--- a/test/client/master.rb
+++ b/test/client/master.rb
@@ -133,4 +133,68 @@ class TestMasterClient < Test::Unit::TestCase
client.run
}
end
+
+ def test_getplugins
+ Puppet[:pluginsource] = tempfile()
+ Dir.mkdir(Puppet[:pluginsource])
+
+ myplugin = File.join(Puppet[:pluginsource], "myplugin.rb")
+ File.open(myplugin, "w") do |f|
+ f.puts %{Puppet::Type.newtype(:myplugin) do
+ newparam(:argument) do
+ isnamevar
+ end
+end
+}
+ end
+
+ client = mkclient()
+
+ assert_nothing_raised {
+ client.send(:getplugins)
+ }
+
+ destfile = File.join(Puppet[:pluginpath], "myplugin.rb")
+
+ assert(File.exists?(destfile), "Did not get plugin")
+
+ obj = Puppet::Type.type(:myplugin)
+
+ assert(obj, "Did not define type")
+
+ assert(obj.validattr?(:argument),
+ "Did not get namevar")
+
+ # 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
+}
+ end
+
+ assert_nothing_raised {
+ client.send(: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")
+ end
end