summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-06-29 15:36:28 +0000
committerLuke Kanies <luke@madstop.com>2005-06-29 15:36:28 +0000
commit2b2975f06f86058589d5aeff1a4d7f0a72cf5b92 (patch)
tree27bf4b9f92ed8411a3be6081b6ce0bf2cdde020c
parent0ac91efd23f25a729db0bf5b58631ae40a6b0ab2 (diff)
downloadpuppet-2b2975f06f86058589d5aeff1a4d7f0a72cf5b92.tar.gz
puppet-2b2975f06f86058589d5aeff1a4d7f0a72cf5b92.tar.xz
puppet-2b2975f06f86058589d5aeff1a4d7f0a72cf5b92.zip
fixing metrics tests to work with everything else
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@316 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/metric.rb7
-rw-r--r--test/other/tc_metrics.rb12
2 files changed, 8 insertions, 11 deletions
diff --git a/lib/puppet/metric.rb b/lib/puppet/metric.rb
index d9696b601..d66105bdf 100644
--- a/lib/puppet/metric.rb
+++ b/lib/puppet/metric.rb
@@ -18,9 +18,7 @@ module Puppet
end
def Metric.clear
- @@metrics = {}
- @@eventmetrics = nil
- @@typemetrics = nil
+ Metric.init
end
def Metric.gather
@@ -226,7 +224,6 @@ module Puppet
RRD.graph(*args)
rescue => detail
Puppet.err "Failed to graph %s: %s" % [self.name,detail]
- exit
end
end
@@ -241,12 +238,10 @@ module Puppet
args.push value[2]
}
arg = args.join(":")
- Puppet.debug "Updating %s with %s" % [self.name,arg]
begin
RRD.update(self.path,args.join(":"))
rescue => detail
Puppet.err "Failed to update %s: %s" % [self.name,detail]
- exit
end
end
end
diff --git a/test/other/tc_metrics.rb b/test/other/tc_metrics.rb
index 4617d18c9..5c0f33fd0 100644
--- a/test/other/tc_metrics.rb
+++ b/test/other/tc_metrics.rb
@@ -15,17 +15,19 @@ class TestMetric < Test::Unit::TestCase
def gendata
totalmax = 1000
- changemax = 10000
+ changemax = 1000
eventmax = 10
maxdiff = 10
types = [Puppet::Type::File, Puppet::Type::Package, Puppet::Type::Service]
data = [:total, :managed, :outofsync, :changed, :totalchanges]
- events = [:file_changed, :package_installed, :service_restarted]
+ events = [:file_changed, :package_installed, :service_started]
# if this is the first set of data points...
- typedata = {}
- eventdata = {}
+ typedata = Hash.new { |typehash,type|
+ typehash[type] = Hash.new(0)
+ }
+ eventdata = Hash.new(0)
types.each { |type|
name = type.name
typedata[type] = {}
@@ -50,7 +52,7 @@ class TestMetric < Test::Unit::TestCase
end
def teardown
- #system("rm -rf rrdtests")
+ system("rm -rf rrdtests")
end
def test_fakedata