summaryrefslogtreecommitdiff
path: root/spec/unit/node
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2012-10-25 14:17:59 -0700
committerdanielsdeleo <dan@opscode.com>2012-11-02 09:26:30 -0700
commit9aebc51a4e836bc7f993dca16dd5f926570ec86e (patch)
tree430270b02a10a6806914d80ff89bd46cccd4b9a3 /spec/unit/node
parent7d109ade7745863616cc3f4b4222592adcbb7539 (diff)
downloadchef-9aebc51a4e836bc7f993dca16dd5f926570ec86e.tar.gz
[CHEF-2936] ensure all default and override attrs go in node json
default and override attributes are now split into components, so all the components need to be merged together to generate the serialized representation of a node. Unfortunately, this means that serializing a node is now lossy because the information about which component default and override attributes belong to is lost. In practice, this is not a major issue, since automatic, override, and default attributes are cleared by chef for each run.
Diffstat (limited to 'spec/unit/node')
-rw-r--r--spec/unit/node/attribute_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb
index bba3078d7c..d20b52b779 100644
--- a/spec/unit/node/attribute_spec.rb
+++ b/spec/unit/node/attribute_spec.rb
@@ -272,6 +272,30 @@ describe Chef::Node::Attribute do
end
+ describe "when reading combined default or override values" do
+ before do
+ @attributes.default["cd"] = "cookbook default"
+ @attributes.role_default["rd"] = "role default"
+ @attributes.env_default["ed"] = "env default"
+ @attributes.override["co"] = "cookbook override"
+ @attributes.role_override["ro"] = "role override"
+ @attributes.env_override["eo"] = "env override"
+ end
+
+ it "merges all types of overrides into a combined override" do
+ @attributes.combined_override["co"].should == "cookbook override"
+ @attributes.combined_override["ro"].should == "role override"
+ @attributes.combined_override["eo"].should == "env override"
+ end
+
+ it "merges all types of defaults into a combined default" do
+ @attributes.combined_default["cd"].should == "cookbook default"
+ @attributes.combined_default["rd"].should == "role default"
+ @attributes.combined_default["ed"].should == "env default"
+ end
+
+ end
+
describe "[]" do
it "should return override data if it exists" do
@attributes["macaddress"].should == "00:00:00:00:00:00"