diff options
author | Luke Kanies <luke@madstop.com> | 2008-03-31 23:56:09 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-03-31 23:56:09 -0500 |
commit | 88dc49cb7b0efe757c92ce28c807b91335acb07a (patch) | |
tree | 13fe4561f1f524f97a8bb2c1ff84c1ef981d0241 /test/util/autoload.rb | |
parent | 4165edaeb71ee2883b1bb85ff39a52d5628b259f (diff) | |
parent | a8592f1009040ebf30a98268610915cc33bb3f63 (diff) | |
download | puppet-88dc49cb7b0efe757c92ce28c807b91335acb07a.tar.gz puppet-88dc49cb7b0efe757c92ce28c807b91335acb07a.tar.xz puppet-88dc49cb7b0efe757c92ce28c807b91335acb07a.zip |
Merge branch 'master' into master_no_global_resources
Conflicts:
lib/puppet/node/catalog.rb
lib/puppet/type/pfile.rb
lib/puppet/type/pfilebucket.rb
lib/puppet/util/filetype.rb
spec/unit/node/catalog.rb
spec/unit/other/transbucket.rb
spec/unit/ral/provider/mount/parsed.rb
spec/unit/ral/types/file.rb
spec/unit/ral/types/interface.rb
spec/unit/ral/types/mount.rb
spec/unit/ral/types/package.rb
spec/unit/ral/types/schedule.rb
spec/unit/ral/types/service.rb
test/language/compile.rb
test/language/lexer.rb
test/language/snippets.rb
test/lib/puppettest.rb
test/ral/types/basic.rb
test/ral/types/cron.rb
test/ral/types/exec.rb
test/ral/types/file.rb
test/ral/types/file/target.rb
test/ral/types/filebucket.rb
test/ral/types/fileignoresource.rb
test/ral/types/filesources.rb
test/ral/types/group.rb
test/ral/types/host.rb
test/ral/types/parameter.rb
test/ral/types/sshkey.rb
test/ral/types/tidy.rb
test/ral/types/user.rb
test/ral/types/yumrepo.rb
Diffstat (limited to 'test/util/autoload.rb')
-rwxr-xr-x | test/util/autoload.rb | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/test/util/autoload.rb b/test/util/autoload.rb index 6babed774..de503ab99 100755 --- a/test/util/autoload.rb +++ b/test/util/autoload.rb @@ -103,10 +103,10 @@ TestAutoload.newthing(:#{name.to_s}) assert(loader.send(:searchpath).include?(dir), "searchpath does not include the libdir") end - # This causes very strange behaviour in the tests. We need to make sure we - # require the same path that a user would use, otherwise we'll result in - # a reload of the - def test_require_does_not_cause_reload + # This tests #1027, which was caused by using the unqualified + # path for requires, which was initially done so that the kernel + # would keep track of which files got loaded. + def test_require_uses_full_path loadname = "testing" loader = Puppet::Util::Autoload.new(self.class, loadname) @@ -120,7 +120,26 @@ TestAutoload.newthing(:#{name.to_s}) Dir.expects(:glob).with("#{dir}/*.rb").returns(file) - Kernel.expects(:require).with(File.join(loadname, subname)) + Kernel.expects(:require).with(file) loader.loadall end + + def test_searchpath_includes_plugin_dirs + moddir = "/what/ever" + libdir = "/other/dir" + Puppet.settings.stubs(:value).with(:modulepath).returns(moddir) + Puppet.settings.stubs(:value).with(:libdir).returns(libdir) + + loadname = "testing" + loader = Puppet::Util::Autoload.new(self.class, loadname) + + # Currently, include both plugins and libs. + paths = %w{plugins lib}.inject({}) { |hash, d| hash[d] = File.join(moddir, "testing", d); FileTest.stubs(:directory?).with(hash[d]).returns(true); hash } + Dir.expects(:glob).with("#{moddir}/*/{plugins,lib}").returns(paths.values) + + searchpath = loader.searchpath + paths.each do |dir, path| + assert(searchpath.include?(path), "search path did not include path for %s" % dir) + end + end end |