improve UT case for package gtimer
@@ -121,12 +121,12 @@ func TestDelayAddSingleton(t *testing.T) {
func TestDelayAddOnce(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
array := garray.New(true)
- gtimer.DelayAddOnce(ctx, 200*time.Millisecond, 200*time.Millisecond, func(ctx context.Context) {
+ gtimer.DelayAddOnce(ctx, 1000*time.Millisecond, 2000*time.Millisecond, func(ctx context.Context) {
array.Append(1)
})
- time.Sleep(300 * time.Millisecond)
+ time.Sleep(2000 * time.Millisecond)
t.Assert(array.Len(), 0)
- time.Sleep(1000 * time.Millisecond)
+ time.Sleep(2000 * time.Millisecond)
t.Assert(array.Len(), 1)
})
}
