0.3.0 unit tests: procstat, prometheus, puppetagent
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user