28
28
node1 = stub 'node1', :merge => nil
29
29
node2 = stub 'node2', :merge => nil
30
30
compiler.stubs(:compile)
31
Puppet::Node.indirection.stubs(:find).with('node1').returns(node1)
32
Puppet::Node.indirection.stubs(:find).with('node2').returns(node2)
31
Puppet::Node.indirection.stubs(:find).with('node1', anything).returns(node1)
32
Puppet::Node.indirection.stubs(:find).with('node2', anything).returns(node2)
34
compiler.find(stub('request', :key => 'node1', :node => 'node1', :options => {}))
35
compiler.find(stub('node2request', :key => 'node2', :node => 'node2', :options => {}))
34
compiler.find(Puppet::Indirector::Request.new(:catalog, :find, 'node1', nil, :node => 'node1'))
35
compiler.find(Puppet::Indirector::Request.new(:catalog, :find, 'node2', nil, :node => 'node2'))
38
38
it "should provide a method for determining if the catalog is networked" do
50
50
@node = Puppet::Node.new @name
51
51
@node.stubs(:merge)
52
52
Puppet::Node.indirection.stubs(:find).returns @node
53
@request = stub 'request', :key => @name, :node => @name, :options => {}
53
@request = Puppet::Indirector::Request.new(:catalog, :find, @name, nil, :node => @name)
56
56
it "should directly use provided nodes" do
63
63
it "should use the authenticated node name if no request key is provided" do
64
64
@request.stubs(:key).returns(nil)
65
Puppet::Node.indirection.expects(:find).with(@name).returns(@node)
65
Puppet::Node.indirection.expects(:find).with(@name, anything).returns(@node)
66
66
@compiler.expects(:compile).with(@node)
67
67
@compiler.find(@request)
70
70
it "should use the provided node name by default" do
71
71
@request.expects(:key).returns "my_node"
73
Puppet::Node.indirection.expects(:find).with("my_node").returns @node
73
Puppet::Node.indirection.expects(:find).with("my_node", anything).returns @node
74
74
@compiler.expects(:compile).with(@node)
75
75
@compiler.find(@request)
78
78
it "should fail if no node is passed and none can be found" do
79
Puppet::Node.indirection.stubs(:find).with(@name).returns(nil)
79
Puppet::Node.indirection.stubs(:find).with(@name, anything).returns(nil)
80
80
proc { @compiler.find(@request) }.should raise_error(ArgumentError)
83
83
it "should fail intelligently when searching for a node raises an exception" do
84
Puppet::Node.indirection.stubs(:find).with(@name).raises "eh"
84
Puppet::Node.indirection.stubs(:find).with(@name, anything).raises "eh"
85
85
proc { @compiler.find(@request) }.should raise_error(Puppet::Error)
88
88
it "should pass the found node to the compiler for compiling" do
89
Puppet::Node.indirection.expects(:find).with(@name).returns(@node)
89
Puppet::Node.indirection.expects(:find).with(@name, anything).returns(@node)
90
90
config = mock 'config'
91
91
Puppet::Parser::Compiler.expects(:compile).with(@node)
92
92
@compiler.find(@request)
95
95
it "should extract and save any facts from the request" do
96
Puppet::Node.indirection.expects(:find).with(@name).returns @node
96
Puppet::Node.indirection.expects(:find).with(@name, anything).returns @node
97
97
@compiler.expects(:extract_facts_from_request).with(@request)
98
98
Puppet::Parser::Compiler.stubs(:compile)
99
99
@compiler.find(@request)
184
184
@compiler = Puppet::Resource::Catalog::Compiler.new
186
186
@node = mock 'node'
187
@request = stub 'request', :key => @name, :options => {}
187
@request = Puppet::Indirector::Request.new(:catalog, :find, @name, nil)
188
188
@compiler.stubs(:compile)
191
191
it "should look node information up via the Node class with the provided key" do
192
192
@node.stubs :merge
193
Puppet::Node.indirection.expects(:find).with(@name).returns(@node)
193
Puppet::Node.indirection.expects(:find).with(@name, anything).returns(@node)
194
194
@compiler.find(@request)
203
203
@compiler = Puppet::Resource::Catalog::Compiler.new
205
205
@node = mock 'node'
206
@request = stub 'request', :key => @name, :options => {}
206
@request = Puppet::Indirector::Request.new(:catalog, :find, @name, nil)
207
207
@compiler.stubs(:compile)
208
Puppet::Node.indirection.stubs(:find).with(@name).returns(@node)
208
Puppet::Node.indirection.stubs(:find).with(@name, anything).returns(@node)
211
211
it "should add the server's Puppet version to the node's parameters as 'serverversion'" do