plugin/pkg/uniq: add (#1733)
Spin this out the metrics package so we can use it in the health one of well to fix some reload bugs.
This commit is contained in:
parent
ce084012df
commit
5e6114b797
6 changed files with 77 additions and 75 deletions
17
plugin/pkg/uniq/uniq_test.go
Normal file
17
plugin/pkg/uniq/uniq_test.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package uniq
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestForEach(t *testing.T) {
|
||||
u, i := New(), 0
|
||||
u.Set("test", func() error { i++; return nil })
|
||||
|
||||
u.ForEach()
|
||||
if i != 1 {
|
||||
t.Errorf("Failed to executed f for %s", "test")
|
||||
}
|
||||
u.ForEach()
|
||||
if i != 1 {
|
||||
t.Errorf("Executed f twice instead of once")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue