File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,13 @@ import (
1111)
1212
1313func TestBasic (t * testing.T ) {
14- single := NewSingle [int ](time .Millisecond * 30 )
14+ t .Parallel ()
15+ single := NewSingle [int ](time .Millisecond * 200 )
1516 foo := 0
1617 shardCount := atomic .NewInt32 (0 )
1718 call := func () (int , error ) {
1819 foo ++
19- time .Sleep (time .Millisecond * 5 )
20+ time .Sleep (time .Millisecond * 20 )
2021 return 0 , nil
2122 }
2223
@@ -39,23 +40,25 @@ func TestBasic(t *testing.T) {
3940}
4041
4142func TestTimer (t * testing.T ) {
42- single := NewSingle [int ](time .Millisecond * 30 )
43+ t .Parallel ()
44+ single := NewSingle [int ](time .Millisecond * 200 )
4345 foo := 0
4446 callM := func () (int , error ) {
4547 foo ++
4648 return 0 , nil
4749 }
4850
4951 _ , _ , _ = single .Do (callM )
50- time .Sleep (10 * time .Millisecond )
52+ time .Sleep (100 * time .Millisecond )
5153 _ , _ , shard := single .Do (callM )
5254
5355 assert .Equal (t , 1 , foo )
5456 assert .True (t , shard )
5557}
5658
5759func TestReset (t * testing.T ) {
58- single := NewSingle [int ](time .Millisecond * 30 )
60+ t .Parallel ()
61+ single := NewSingle [int ](time .Millisecond * 200 )
5962 foo := 0
6063 callM := func () (int , error ) {
6164 foo ++
You can’t perform that action at this time.
0 commit comments