Logo
Explore Help
Sign In
Mirrors/coredns
1
0
Fork 0
You've already forked coredns
mirror of https://github.com/coredns/coredns.git synced 2025-10-28 08:44:17 -04:00
Code Issues Packages Projects Releases Wiki Activity
Files
3f47fc8ba4f43a074c078c71fccb8a0463d31672
coredns/plugin/pkg/uniq/uniq_test.go

18 lines
290 B
Go
Raw Normal View History

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.
2018-04-25 11:45:09 +01:00
package uniq
import "testing"
func TestForEach(t *testing.T) {
u, i := New(), 0
plugin/metrcs: fix datarace on listeners (#2835) This fixes a data race on the listener(s) that get started in the metrics plugins. It also restore pkg/uniq to its former glory and removes and state being carried in there; this means for metrics that registry.go was to replicate that behavior *with* locking (as pkg/uniq doesn't do, or need that). Also renamed uniqAddr to just u, to make it slightly shorter. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-18 18:34:46 +01:00
u.Set("test", func() error { i++; return nil })
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.
2018-04-25 11:45:09 +01:00
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")
}
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.7 Page: 35ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API