summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-09 17:41:21 -0700
committerJames Turnbull <james@lovedthanlost.net>2008-07-10 19:57:25 +1000
commit80436550a1e3040399e410be3edf7c44d29fc320 (patch)
treee4a5dab3a6fe51fa634c43d41142d4dc231b7373 /spec
parent605d760dd72b7b6bd3fd54e9f6c3ffacb1b9ee52 (diff)
downloadpuppet-80436550a1e3040399e410be3edf7c44d29fc320.tar.gz
puppet-80436550a1e3040399e410be3edf7c44d29fc320.tar.xz
puppet-80436550a1e3040399e410be3edf7c44d29fc320.zip
Fixing #1408 - --loadclasses works again.
The problem was that the mechanism I was using for passing the node to the compiler was conflicting with the Indirector::Request's method of handling node authentication. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/integration/node/catalog.rb10
-rwxr-xr-xspec/unit/indirector/catalog/compiler.rb8
2 files changed, 15 insertions, 3 deletions
diff --git a/spec/integration/node/catalog.rb b/spec/integration/node/catalog.rb
index 1fa2afbb0..ed38ae987 100755
--- a/spec/integration/node/catalog.rb
+++ b/spec/integration/node/catalog.rb
@@ -40,5 +40,15 @@ describe Puppet::Node::Catalog do
Puppet::Node::Catalog.find("me").should be_nil
end
+
+ it "should pass provided node information directly to the terminus" do
+ terminus = mock 'terminus'
+
+ Puppet::Node::Catalog.indirection.stubs(:terminus).returns terminus
+
+ node = mock 'node'
+ terminus.expects(:find).with { |request| request.options[:use_node] == node }
+ Puppet::Node::Catalog.find("me", :use_node => node)
+ end
end
end
diff --git a/spec/unit/indirector/catalog/compiler.rb b/spec/unit/indirector/catalog/compiler.rb
index cf7186a5a..8cd3c72f4 100755
--- a/spec/unit/indirector/catalog/compiler.rb
+++ b/spec/unit/indirector/catalog/compiler.rb
@@ -114,13 +114,12 @@ describe Puppet::Node::Catalog::Compiler, " when creating catalogs" do
@node = Puppet::Node.new @name
@node.stubs(:merge)
@request = stub 'request', :key => @name, :options => {}
- Puppet::Node.stubs(:find).with(@name).returns(@node)
end
it "should directly use provided nodes" do
Puppet::Node.expects(:find).never
- @compiler.interpreter.expects(:compile).with(@node)
- @request.stubs(:options).returns(:node => @node)
+ @compiler.expects(:compile).with(@node)
+ @request.stubs(:options).returns(:use_node => @node)
@compiler.find(@request)
end
@@ -130,12 +129,14 @@ describe Puppet::Node::Catalog::Compiler, " when creating catalogs" do
end
it "should pass the found node to the interpreter for compiling" do
+ Puppet::Node.expects(:find).with(@name).returns(@node)
config = mock 'config'
@compiler.interpreter.expects(:compile).with(@node)
@compiler.find(@request)
end
it "should return the results of compiling as the catalog" do
+ Puppet::Node.stubs(:find).returns(@node)
config = mock 'config'
result = mock 'result'
@@ -144,6 +145,7 @@ describe Puppet::Node::Catalog::Compiler, " when creating catalogs" do
end
it "should benchmark the compile process" do
+ Puppet::Node.stubs(:find).returns(@node)
@compiler.stubs(:networked?).returns(true)
@compiler.expects(:benchmark).with do |level, message|
level == :notice and message =~ /^Compiled catalog/