diff options
| author | Luke Kanies <luke@madstop.com> | 2009-08-18 15:58:38 -0700 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-08-18 15:58:38 -0700 |
| commit | 796ba5c4ccec117bbc4dec69c670337e70b48634 (patch) | |
| tree | 549f59c2202da84a3c0d527f4df964bc61c1b6b4 /spec/integration/node | |
| parent | 6bd3627d606cde4bea9293b855be0dd2b1170a92 (diff) | |
| download | puppet-796ba5c4ccec117bbc4dec69c670337e70b48634.tar.gz puppet-796ba5c4ccec117bbc4dec69c670337e70b48634.tar.xz puppet-796ba5c4ccec117bbc4dec69c670337e70b48634.zip | |
Fixing #1544 - plugins in modules now works again
We had to fix the fileserving plumbing to use the request
environment instead of trying to use the node environment.
This was apparently never fixed after we added the environment
to the URI in REST calls.
There's still a bit of refactoring left to clean up the APIs used
in some of this code.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/integration/node')
| -rwxr-xr-x | spec/integration/node/environment.rb | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/integration/node/environment.rb b/spec/integration/node/environment.rb new file mode 100755 index 000000000..68dfd93a3 --- /dev/null +++ b/spec/integration/node/environment.rb @@ -0,0 +1,58 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' + +require 'puppet_spec/files' + +describe Puppet::Node::Environment do + include PuppetSpec::Files + + it "should be able to return each module from its environment with the environment, name, and path set correctly" do + base = tmpfile("env_modules") + Dir.mkdir(base) + + dirs = [] + mods = {} + %w{1 2}.each do |num| + dir = File.join(base, "dir#{num}") + dirs << dir + Dir.mkdir(dir) + mod = "mod#{num}" + moddir = File.join(dir, mod) + mods[mod] = moddir + Dir.mkdir(moddir) + end + + environment = Puppet::Node::Environment.new("foo") + environment.stubs(:modulepath).returns dirs + + environment.modules.each do |mod| + mod.environment.should == environment + mod.path.should == mods[mod.name] + end + end + + it "should not yield the same module from different module paths" do + base = tmpfile("env_modules") + Dir.mkdir(base) + + dirs = [] + mods = {} + %w{1 2}.each do |num| + dir = File.join(base, "dir#{num}") + dirs << dir + Dir.mkdir(dir) + mod = "mod" + moddir = File.join(dir, mod) + mods[mod] = moddir + Dir.mkdir(moddir) + end + + environment = Puppet::Node::Environment.new("foo") + environment.stubs(:modulepath).returns dirs + + mods = environment.modules + mods.length.should == 1 + mods[0].path.should == File.join(base, "dir1", "mod") + end +end |
