Switch plugin API to use an accumulator

This commit is contained in:
Evan Phoenix
2015-04-06 09:32:10 -07:00
parent f9250e8e39
commit d1cc82653a
12 changed files with 295 additions and 184 deletions

25
testutil/accumulator.go Normal file
View File

@@ -0,0 +1,25 @@
package testutil
type Point struct {
Name string
Value interface{}
Tags map[string]string
}
type Accumulator struct {
Points []*Point
}
func (a *Accumulator) Add(name string, value interface{}, tags map[string]string) {
a.Points = append(a.Points, &Point{name, value, tags})
}
func (a *Accumulator) CheckValue(name string, val interface{}) bool {
for _, p := range a.Points {
if p.Name == name {
return p.Value == val
}
}
return false
}