diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2018-03-02 01:55:31 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-03-02 01:55:31 +0800 |
commit | 3ca3fffdf01b94244ef6c2d93ed38a30da9fcb0a (patch) | |
tree | 54b0c90df29bcb1a4e864285a21415211bd4b113 /metrics/metrics_test.go | |
parent | 5a150e1b7724c91009a237ab0879cd64844b390d (diff) | |
download | dexon-3ca3fffdf01b94244ef6c2d93ed38a30da9fcb0a.tar.gz dexon-3ca3fffdf01b94244ef6c2d93ed38a30da9fcb0a.tar.zst dexon-3ca3fffdf01b94244ef6c2d93ed38a30da9fcb0a.zip |
metrics: fix flaky Example metrics test (#16222)
* metrics: add sleep to test in order to get predictable output
* metrics: relax constraints on timer test
Diffstat (limited to 'metrics/metrics_test.go')
-rw-r--r-- | metrics/metrics_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/metrics/metrics_test.go b/metrics/metrics_test.go index 726fba347..df36da0ad 100644 --- a/metrics/metrics_test.go +++ b/metrics/metrics_test.go @@ -6,6 +6,7 @@ import ( "log" "sync" "testing" + "time" ) const FANOUT = 128 @@ -114,7 +115,7 @@ func Example() { // Threadsafe registration t := GetOrRegisterTimer("db.get.latency", nil) - t.Time(func() {}) + t.Time(func() { time.Sleep(10 * time.Millisecond) }) t.Update(1) fmt.Println(c.Count()) |