0.3.0 unit tests: procstat, prometheus, puppetagent

This commit is contained in:
Cameron Sparr
2016-01-06 17:56:30 -07:00
parent 6eb49dee5d
commit ccbd7bb785
5 changed files with 41 additions and 64 deletions

View File

@@ -77,7 +77,8 @@ func (g *Prometheus) gatherURL(url string, acc plugins.Accumulator) error {
if err == io.EOF {
break
} else if err != nil {
return fmt.Errorf("error getting processing samples for %s: %s", url, err)
return fmt.Errorf("error getting processing samples for %s: %s",
url, err)
}
for _, sample := range samples {
tags := make(map[string]string)

View File

@@ -45,11 +45,11 @@ func TestPrometheusGeneratesMetrics(t *testing.T) {
value float64
tags map[string]string
}{
{"go_gc_duration_seconds_count", 7, map[string]string{}},
{"go_goroutines", 15, map[string]string{}},
{"prometheus_go_gc_duration_seconds_count", 7, map[string]string{}},
{"prometheus_go_goroutines", 15, map[string]string{}},
}
for _, e := range expected {
assert.NoError(t, acc.ValidateValue(e.name, e.value))
assert.True(t, acc.HasFloatField(e.name, "value"))
}
}