clean jup singleton_test

pull/139/head
Minh Doan 6 years ago committed by Minh Doan
parent 25ca704f89
commit 45abf1da35
  1. 6
      utils/singleton_test.go

@ -9,29 +9,23 @@ import (
var NumThreads = 20
func TestSingleton(t *testing.T) {
si := GetUniqueValidatorIDInstance()
var wg sync.WaitGroup
t.Log("unique ID provided by singleton instance")
for i := 0; i < NumThreads; i++ {
wg.Add(1)
go func() {
defer wg.Done()
t.Logf("id:%v\n", si.GetUniqueID())
time.Sleep(time.Millisecond)
}()
}
wg.Wait()
t.Log("non-unique ID")
n := 100
for i := 0; i < NumThreads; i++ {
wg.Add(1)
go func() {
defer wg.Done()
t.Log("num:", n)
n++
time.Sleep(time.Millisecond)
}()

Loading…
Cancel
Save