diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2008-10-05 17:11:38 +0200 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-10-09 07:48:33 +1100 |
commit | 28534471ef91301cc6a270f826dfff0f6021f89e (patch) | |
tree | 0f40899bc4c9bf9032597d0744a257265b6eb2b9 /spec | |
parent | 2153baed8c6b99f9b77ed2f63fb24433bd72058c (diff) | |
download | puppet-28534471ef91301cc6a270f826dfff0f6021f89e.tar.gz puppet-28534471ef91301cc6a270f826dfff0f6021f89e.tar.xz puppet-28534471ef91301cc6a270f826dfff0f6021f89e.zip |
Fix several small regressions in plugins mount
Since a30ecf2aeffd71960bd806fb28cd6d1b8adc2452, reclist has one parameter
less, but Puppet::Network::Handler::PluginMount.list wasn't ported to the
new API.
While mounting plugins, reclist wasn't requiring 'file_serving/fileset',
leading to an NameError.
The change to the new API meant that we lost the existance test of plugins
mount directory. It was failing when the client was mounting module plugins that
weren't existing (like facter and no custom facts defined).
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/network/handler/fileserver.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/unit/network/handler/fileserver.rb b/spec/unit/network/handler/fileserver.rb index e548cba80..cce00d333 100644 --- a/spec/unit/network/handler/fileserver.rb +++ b/spec/unit/network/handler/fileserver.rb @@ -126,6 +126,44 @@ describe Puppet::Network::Handler::FileServer do list.sort.should == [ ["/aFile", "file"], ["/", "directory"] ].sort end + describe Puppet::Network::Handler::FileServer::PluginMount do + PLUGINS = Puppet::Network::Handler::FileServer::PLUGINS + + # create a module plugin hierarchy + def create_plugin(mod, plugin) + dirname = File.join(@basedir, mod) + Dir.mkdir(dirname) + plugins = File.join(dirname, PLUGINS) + Dir.mkdir(plugins) + facter = File.join(plugins, plugin) + Dir.mkdir(facter) + create_file(File.join(facter,"fact.rb")) + end + + before :each do + @modules = ["one","two"] + Puppet::Module.stubs(:all).returns(@modules.collect{ |p| File.join(@basedir,p)} ) + @modules.each { |m| create_plugin(m, "facter") } + + @modules.each do |p| + File.stubs(:directory?).with(File.join(@basedir,p,PLUGINS)).returns(true) + end + + @mount = Puppet::Network::Handler::FileServer::PluginMount.new(PLUGINS) + @mount.allow("*") + end + + it "should return a merged view of all plugins for all modules" do + list = @mount.list("facter",true,false) + list.should == [["/", "directory"], ["/fact.rb", "file"], ["/", "directory"], ["/fact.rb", "file"]] + end + + it "should not fail for inexistant plugins type" do + lambda { @mount.list("puppet/parser",true,false) }.should_not raise_error + end + + end + after do FileUtils.rm_rf(@basedir) end |