diff options
author | Nick Lewis <nick@puppetlabs.com> | 2011-03-09 13:43:57 -0800 |
---|---|---|
committer | Nick Lewis <nick@puppetlabs.com> | 2011-03-09 13:43:57 -0800 |
commit | 40e8b48eb19973ec413518be656249e134344ee0 (patch) | |
tree | 8f6a10924b74ff2b52efe992feb4be420b7ae2f7 /spec | |
parent | eae17c3cba159d895e5ec2e87e4abe8c125a9562 (diff) | |
parent | 531e25836e1313cd508ab8394e16cf438a62ac7b (diff) | |
download | puppet-40e8b48eb19973ec413518be656249e134344ee0.tar.gz puppet-40e8b48eb19973ec413518be656249e134344ee0.tar.xz puppet-40e8b48eb19973ec413518be656249e134344ee0.zip |
Merge branch 'maint/2.6.next/6338' into 2.6.next
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/indirector/facts/inventory_active_record_spec.rb | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/spec/unit/indirector/facts/inventory_active_record_spec.rb b/spec/unit/indirector/facts/inventory_active_record_spec.rb index 69d614023..c29e58400 100644 --- a/spec/unit/indirector/facts/inventory_active_record_spec.rb +++ b/spec/unit/indirector/facts/inventory_active_record_spec.rb @@ -32,23 +32,23 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r end describe "#save" do - it "should use an existing host if possible" do - host = Puppet::Rails::InventoryHost.new(:name => "foo", :timestamp => Time.now) - host.save + it "should use an existing node if possible" do + node = Puppet::Rails::InventoryNode.new(:name => "foo", :timestamp => Time.now) + node.save Puppet::Node::Facts.new("foo", "uptime_days" => "60", "kernel" => "Darwin").save - Puppet::Rails::InventoryHost.count.should == 1 - Puppet::Rails::InventoryHost.first.should == host + Puppet::Rails::InventoryNode.count.should == 1 + Puppet::Rails::InventoryNode.first.should == node end - it "should create a new host if one can't be found" do - # This test isn't valid if there are hosts to begin with - Puppet::Rails::InventoryHost.count.should == 0 + it "should create a new node if one can't be found" do + # This test isn't valid if there are nodes to begin with + Puppet::Rails::InventoryNode.count.should == 0 Puppet::Node::Facts.new("foo", "uptime_days" => "60", "kernel" => "Darwin").save - Puppet::Rails::InventoryHost.count.should == 1 - Puppet::Rails::InventoryHost.first.name.should == "foo" + Puppet::Rails::InventoryNode.count.should == 1 + Puppet::Rails::InventoryNode.first.name.should == "foo" end it "should save the facts" do @@ -57,7 +57,7 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r Puppet::Rails::InventoryFact.all.map{|f| [f.name,f.value]}.should =~ [["uptime_days","60"],["kernel","Darwin"]] end - it "should remove the previous facts for an existing host" do + it "should remove the previous facts for an existing node" do Puppet::Node::Facts.new("foo", "uptime_days" => "30", "kernel" => "Darwin").save bar_facts = Puppet::Node::Facts.new("bar", "uptime_days" => "35", "kernel" => "Linux") foo_facts = Puppet::Node::Facts.new("foo", "uptime_days" => "60", "is_virtual" => "false") @@ -81,18 +81,12 @@ describe "Puppet::Node::Facts::InventoryActiveRecord", :if => (Puppet.features.r @bar_facts.save end - it "should identify facts by host name" do + it "should identify facts by node name" do Puppet::Node::Facts.find("foo").should == @foo_facts end - it "should return nil if no host instance can be found" do - Puppet::Node::Facts.find("non-existent host").should == nil - end - - it "should convert all single-member arrays into non-arrays" do - Puppet::Node::Facts.new("array", "fact1" => ["value1"]).save - - Puppet::Node::Facts.find("array").values["fact1"].should == "value1" + it "should return nil if no node instance can be found" do + Puppet::Node::Facts.find("non-existent node").should == nil end end |