diff options
Diffstat (limited to 'spec/unit/indirector/node')
-rwxr-xr-x | spec/unit/indirector/node/external.rb | 22 | ||||
-rwxr-xr-x | spec/unit/indirector/node/ldap.rb | 16 | ||||
-rwxr-xr-x | spec/unit/indirector/node/none.rb | 8 |
3 files changed, 23 insertions, 23 deletions
diff --git a/spec/unit/indirector/node/external.rb b/spec/unit/indirector/node/external.rb index 30b2f74c2..c64a6f6e2 100755 --- a/spec/unit/indirector/node/external.rb +++ b/spec/unit/indirector/node/external.rb @@ -32,32 +32,32 @@ describe Puppet::Indirector.terminus(:node, :external), " when searching for nod it "should throw an exception if the node_source is external but no external node command is set" do Puppet[:external_nodes] = "none" - proc { @searcher.get("foo") }.should raise_error(ArgumentError) + proc { @searcher.find("foo") }.should raise_error(ArgumentError) end it "should throw an exception if the external node source is not fully qualified" do Puppet[:external_nodes] = "mycommand" - proc { @searcher.get("foo") }.should raise_error(ArgumentError) + proc { @searcher.find("foo") }.should raise_error(ArgumentError) end it "should execute the command with the node name as the only argument" do command = [Puppet[:external_nodes], "yay"] @searcher.expects(:execute).with(command).returns("") - @searcher.get("yay") + @searcher.find("yay") end it "should return a node object" do - @searcher.get("apple").should be_instance_of(Puppet::Node) + @searcher.find("apple").should be_instance_of(Puppet::Node) end it "should set the node's name" do - @searcher.get("apple").name.should == "apple" + @searcher.find("apple").name.should == "apple" end # If we use a name that has a 'p' but no 'a', then our test generator # will return classes but no parameters. it "should be able to configure a node's classes" do - node = @searcher.get("plum") + node = @searcher.find("plum") node.classes.should == %w{plum1 plum2 plum3} node.parameters.should == {} end @@ -65,26 +65,26 @@ describe Puppet::Indirector.terminus(:node, :external), " when searching for nod # If we use a name that has an 'a' but no 'p', then our test generator # will return parameters but no classes. it "should be able to configure a node's parameters" do - node = @searcher.get("guava") + node = @searcher.find("guava") node.classes.should == [] node.parameters.should == {"one" => "guava1", "two" => "guava2"} end it "should be able to configure a node's classes and parameters" do - node = @searcher.get("apple") + node = @searcher.find("apple") node.classes.should == %w{apple1 apple2 apple3} node.parameters.should == {"one" => "apple1", "two" => "apple2"} end it "should merge node facts with returned parameters" do facts = Puppet::Node::Facts.new("apple", "three" => "four") - Puppet::Node::Facts.expects(:get).with("apple").returns(facts) - node = @searcher.get("apple") + Puppet::Node::Facts.expects(:find).with("apple").returns(facts) + node = @searcher.find("apple") node.parameters["three"].should == "four" end it "should return nil when it cannot find the node" do - @searcher.get("honeydew").should be_nil + @searcher.find("honeydew").should be_nil end # Make sure a nodesearch with arguments works diff --git a/spec/unit/indirector/node/ldap.rb b/spec/unit/indirector/node/ldap.rb index c6eb45ffc..e4b0cd7d4 100755 --- a/spec/unit/indirector/node/ldap.rb +++ b/spec/unit/indirector/node/ldap.rb @@ -20,33 +20,33 @@ describe Puppet::Indirector.terminus(:node, :ldap), " when searching for nodes" end it "should return nil for hosts that cannot be found" do - @searcher.get("foo").should be_nil + @searcher.find("foo").should be_nil end it "should return Puppet::Node instances" do @nodetable["foo"] = [nil, %w{}, {}] - @searcher.get("foo").should be_instance_of(Puppet::Node) + @searcher.find("foo").should be_instance_of(Puppet::Node) end it "should set the node name" do @nodetable["foo"] = [nil, %w{}, {}] - @searcher.get("foo").name.should == "foo" + @searcher.find("foo").name.should == "foo" end it "should set the classes" do @nodetable["foo"] = [nil, %w{one two}, {}] - @searcher.get("foo").classes.should == %w{one two} + @searcher.find("foo").classes.should == %w{one two} end it "should set the parameters" do @nodetable["foo"] = [nil, %w{}, {"one" => "two"}] - @searcher.get("foo").parameters.should == {"one" => "two"} + @searcher.find("foo").parameters.should == {"one" => "two"} end it "should set classes and parameters from the parent node" do @nodetable["foo"] = ["middle", %w{one two}, {"one" => "two"}] @nodetable["middle"] = [nil, %w{three four}, {"three" => "four"}] - node = @searcher.get("foo") + node = @searcher.find("foo") node.classes.sort.should == %w{one two three four}.sort node.parameters.should == {"one" => "two", "three" => "four"} end @@ -54,14 +54,14 @@ describe Puppet::Indirector.terminus(:node, :ldap), " when searching for nodes" it "should prefer child parameters to parent parameters" do @nodetable["foo"] = ["middle", %w{}, {"one" => "two"}] @nodetable["middle"] = [nil, %w{}, {"one" => "four"}] - @searcher.get("foo").parameters["one"].should == "two" + @searcher.find("foo").parameters["one"].should == "two" end it "should recurse indefinitely through parent relationships" do @nodetable["foo"] = ["middle", %w{one two}, {"one" => "two"}] @nodetable["middle"] = ["top", %w{three four}, {"three" => "four"}] @nodetable["top"] = [nil, %w{five six}, {"five" => "six"}] - node = @searcher.get("foo") + node = @searcher.find("foo") node.parameters.should == {"one" => "two", "three" => "four", "five" => "six"} node.classes.sort.should == %w{one two three four five six}.sort end diff --git a/spec/unit/indirector/node/none.rb b/spec/unit/indirector/node/none.rb index d52d7ca83..2329cdfbb 100755 --- a/spec/unit/indirector/node/none.rb +++ b/spec/unit/indirector/node/none.rb @@ -11,17 +11,17 @@ describe Puppet::Indirector.terminus(:node, :none), " when searching for nodes" end it "should create a node instance" do - @searcher.get("yay").should be_instance_of(Puppet::Node) + @searcher.find("yay").should be_instance_of(Puppet::Node) end it "should create a new node with the correct name" do - @searcher.get("yay").name.should == "yay" + @searcher.find("yay").name.should == "yay" end it "should merge the node's facts" do facts = Puppet::Node::Facts.new("yay", "one" => "two", "three" => "four") - Puppet::Node::Facts.expects(:get).with("yay").returns(facts) - node = @searcher.get("yay") + Puppet::Node::Facts.expects(:find).with("yay").returns(facts) + node = @searcher.find("yay") node.parameters["one"].should == "two" node.parameters["three"].should == "four" end |