diff options
| author | lutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-09 00:47:27 +0000 |
|---|---|---|
| committer | lutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-03-09 00:47:27 +0000 |
| commit | ba6257c02ef5e4bd32d58d40087f84dda95141c3 (patch) | |
| tree | b5f4556465f7b48a2cf0858dc3c3510cf9943a33 /test/puppet | |
| parent | 10d68915c513ca9aa69862d17111acbf9ff87164 (diff) | |
| download | puppet-ba6257c02ef5e4bd32d58d40087f84dda95141c3.tar.gz puppet-ba6257c02ef5e4bd32d58d40087f84dda95141c3.tar.xz puppet-ba6257c02ef5e4bd32d58d40087f84dda95141c3.zip | |
The basic plumbing for modules: a modulepath config parameter, and a new
class Puppet::Module that will contain the module-related
functionality. The modulepath can be extended by setting the environment
variable PUPPETLIB
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2276 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/puppet')
| -rw-r--r-- | test/puppet/modules.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/puppet/modules.rb b/test/puppet/modules.rb new file mode 100644 index 000000000..f3cf3b73c --- /dev/null +++ b/test/puppet/modules.rb @@ -0,0 +1,41 @@ +#!/usr/bin/env ruby + +$:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/ + +require 'puppet' +require 'puppettest' + +class TestModules < Test::Unit::TestCase + include PuppetTest + + def setup + super + @varmods = File::join(Puppet[:vardir], "modules") + FileUtils::mkdir_p(@varmods) + end + + def test_modulepath + Puppet[:modulepath] = "$vardir/modules:/no/such/path/anywhere:.::" + assert_equal([ @varmods ], Puppet::Module.modulepath) + end + + def test_find + assert_nil(Puppet::Module::find("/tmp")) + + file = "testmod/something" + assert_nil(Puppet::Module::find(file)) + + path = File::join(@varmods, "testmod") + FileUtils::mkdir_p(path) + + mod = Puppet::Module::find("testmod") + assert_not_nil(mod) + assert_equal("testmod", mod.name) + assert_equal(path, mod.path) + + mod = Puppet::Module::find(file) + assert_not_nil(mod) + assert_equal("testmod", mod.name) + assert_equal(path, mod.path) + end +end |
