Fix test failures that fixing #4726 exposed.

The patch for #4726 causes old unit tests of the rrd reporting
infrastructure to run on my machine. These tests were calling the old
report api, which does not succeed.
Also, the rrd settings had unintentionally been moved out of the
:metrics section, making it possible that the rrd report directory would
fail to get created during testing.
This commit is contained in:
Jesse Wolfe 2010-10-04 14:01:49 -07:00
Родитель d057b90bba
Коммит 6dd1930ff6
3 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -453,6 +453,12 @@ module Puppet
:reporturl => ["http://localhost:3000/reports",
"The URL used by the http reports processor to send reports"],
:fileserverconfig => ["$confdir/fileserver.conf", "Where the fileserver configuration is stored."],
:strict_hostname_checking => [false, "Whether to only search for the complete
hostname as it is in the certificate when searching for node information
in the catalogs."]
)
setdefaults(:metrics,
:rrddir => {:default => "$vardir/rrd",
:owner => "service",
:group => "service",
@ -461,10 +467,7 @@ module Puppet
this directory."
},
:rrdinterval => ["$runinterval", "How often RRD should expect data.
This should match how often the hosts report back to the server."],
:strict_hostname_checking => [false, "Whether to only search for the complete
hostname as it is in the certificate when searching for node information
in the catalogs."]
This should match how often the hosts report back to the server."]
)
setdefaults(:agent,

Просмотреть файл

@ -35,10 +35,7 @@ class TestReports < Test::Unit::TestCase
config.retrieval_duration = 0.001
trans = config.apply
report = Puppet::Transaction::Report.new
trans.add_metrics_to_report(report)
report
trans.generate_report
end
# Make sure we can use reports as log destinations.
@ -95,7 +92,7 @@ class TestReports < Test::Unit::TestCase
assert_equal(yaml, File.read(file), "File did not get written")
end
if Puppet.features.rrd?
if Puppet.features.rrd? || Puppet.features.rrd_legacy?
def test_rrdgraph_report
Puppet.settings.use(:main, :metrics)
report = mkreport

Просмотреть файл

@ -8,7 +8,7 @@ require 'puppettest'
require 'puppet/type'
class TestMetric < PuppetTest::TestCase
confine "Missing RRDtool library" => Puppet.features.rrd?
confine "Missing RRDtool library" => (Puppet.features.rrd? || Puppet.features.rrd_legacy?)
include PuppetTest
def gendata
@ -43,7 +43,7 @@ class TestMetric < PuppetTest::TestCase
def rundata(report, time)
assert_nothing_raised {
gendata.each do |name, data|
report.newmetric(name, data)
report.add_metric(name, data)
end
report.metrics.each { |n, m| m.store(time) }
}