summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-07-24 00:27:44 -0700
committerLuke Kanies <luke@madstop.com>2009-08-01 12:50:42 -0700
commitac58e274c409b69073e304a8355bbe4ccb37350a (patch)
treeb256ad839bcc4c75a34af0260cb7ff5c18625748 /spec
parent6ed01037ad8b6d8d5ff7158ef6e09c785ed8b9fe (diff)
downloadpuppet-ac58e274c409b69073e304a8355bbe4ccb37350a.tar.gz
puppet-ac58e274c409b69073e304a8355bbe4ccb37350a.tar.xz
puppet-ac58e274c409b69073e304a8355bbe4ccb37350a.zip
Configuration version information is now in logs
The log instances have file, line, and config version information, although it's not currently printed. It's available in the reports, and you can strip it out with your own processors. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/type.rb13
-rwxr-xr-xspec/unit/util/log.rb29
2 files changed, 42 insertions, 0 deletions
diff --git a/spec/unit/type.rb b/spec/unit/type.rb
index 2bcac7aec..b179677f9 100755
--- a/spec/unit/type.rb
+++ b/spec/unit/type.rb
@@ -72,6 +72,19 @@ describe Puppet::Type do
Puppet::Type.type(:mount).new(:name => "foo").should respond_to(:exported?)
end
+ it "should consider its version to be its catalog version" do
+ resource = Puppet::Type.type(:mount).new(:name => "foo")
+ catalog = Puppet::Resource::Catalog.new
+ catalog.version = 50
+ catalog.add_resource resource
+
+ resource.version.should == 50
+ end
+
+ it "should consider its version to be zero if it has no catalog" do
+ Puppet::Type.type(:mount).new(:name => "foo").version.should == 0
+ end
+
describe "when choosing a default provider" do
it "should choose the provider with the highest specificity" do
# Make a fake type
diff --git a/spec/unit/util/log.rb b/spec/unit/util/log.rb
index b996f17a0..9d1b4108e 100755
--- a/spec/unit/util/log.rb
+++ b/spec/unit/util/log.rb
@@ -111,5 +111,34 @@ describe Puppet::Util::Log do
report.should be_include(log.source)
report.should be_include(log.time.to_s)
end
+
+ describe "when setting the source" do
+ it "should tag itself with any tags the source has" do
+ source = Puppet::Type.type(:file).new :path => "/foo/bar"
+ log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => source)
+ source.tags.each do |tag|
+ log.tags.should be_include(tag)
+ end
+ end
+
+ it "should copy over any file and line information" do
+ source = Puppet::Type.type(:file).new :path => "/foo/bar"
+ source.file = "/my/file"
+ source.line = 50
+ log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => source)
+ log.file.should == "/my/file"
+ log.line.should == 50
+ end
+
+ it "should copy over any version information" do
+ catalog = Puppet::Resource::Catalog.new
+ catalog.version = 25
+ source = Puppet::Type.type(:file).new :path => "/foo/bar"
+ catalog.add_resource source
+
+ log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => source)
+ log.version.should == 25
+ end
+ end
end
end