From ba6257c02ef5e4bd32d58d40087f84dda95141c3 Mon Sep 17 00:00:00 2001 From: lutter Date: Fri, 9 Mar 2007 00:47:27 +0000 Subject: 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 --- test/puppet/modules.rb | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/puppet/modules.rb (limited to 'test') 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 -- cgit