@@ -29,9 +29,9 @@ import (
29
29
)
30
30
31
31
func init () {
32
- requestWaitTime = time .Duration (50 ) * time .Millisecond
33
- digestWaitTime = time .Duration (20 ) * time .Millisecond
34
- responseWaitTime = time .Duration (50 ) * time .Millisecond
32
+ requestWaitTime = time .Duration (200 ) * time .Millisecond
33
+ digestWaitTime = time .Duration (100 ) * time .Millisecond
34
+ responseWaitTime = time .Duration (200 ) * time .Millisecond
35
35
}
36
36
37
37
type messageHook func (interface {})
@@ -79,7 +79,7 @@ func newPushPullTestInstance(name string, peers map[string]*pullTestInstance) *p
79
79
name : name ,
80
80
}
81
81
82
- inst .PullEngine = NewPullEngine (inst , time .Duration (100 )* time .Millisecond )
82
+ inst .PullEngine = NewPullEngine (inst , time .Duration (500 )* time .Millisecond )
83
83
84
84
peers [name ] = inst
85
85
go func () {
@@ -224,7 +224,7 @@ func TestPullEngineAll2AllWithIncrementalSpawning(t *testing.T) {
224
224
pID := fmt .Sprintf ("p%d" , i + 1 )
225
225
peers [pID ].setNextPeerSelection (keySet (pID , peers ))
226
226
}
227
- time .Sleep (time .Duration (500 ) * time .Millisecond )
227
+ time .Sleep (time .Duration (4000 ) * time .Millisecond )
228
228
229
229
for i := 0 ; i < instanceCount ; i ++ {
230
230
pID := fmt .Sprintf ("p%d" , i + 1 )
@@ -279,7 +279,7 @@ func TestPullEngineSelectiveUpdates(t *testing.T) {
279
279
280
280
inst1 .setNextPeerSelection ([]string {"p2" })
281
281
282
- time .Sleep (time .Duration (200 ) * time .Millisecond )
282
+ time .Sleep (time .Duration (2000 ) * time .Millisecond )
283
283
assert .Equal (t , len (inst2 .state .ToArray ()), len (inst1 .state .ToArray ()))
284
284
}
285
285
@@ -309,7 +309,7 @@ func TestByzantineResponder(t *testing.T) {
309
309
if dig , isDig := m .(* digestMsg ); isDig {
310
310
if dig .source == "p3" {
311
311
atomic .StoreInt32 (& receivedDigestFromInst3 , int32 (1 ))
312
- time .AfterFunc (time .Duration (25 )* time .Millisecond , func () {
312
+ time .AfterFunc (time .Duration (150 )* time .Millisecond , func () {
313
313
inst3 .SendRes ([]uint64 {uint64 (5 ), uint64 (6 ), uint64 (7 )}, "p1" , 0 )
314
314
})
315
315
}
@@ -319,14 +319,14 @@ func TestByzantineResponder(t *testing.T) {
319
319
// the response is from p3
320
320
if util .IndexInSlice (res .items , uint64 (6 ), numericCompare ) != - 1 {
321
321
// inst1 is currently accepting responses
322
- assert .Equal (t , int32 (1 ), atomic .LoadInt32 (& (inst1 .acceptingResponses )))
322
+ assert .Equal (t , int32 (1 ), atomic .LoadInt32 (& (inst1 .acceptingResponses )), "inst1 is not accepting digests" )
323
323
}
324
324
}
325
325
})
326
326
327
327
inst1 .setNextPeerSelection ([]string {"p2" })
328
328
329
- time .Sleep (time .Duration (200 ) * time .Millisecond )
329
+ time .Sleep (time .Duration (1000 ) * time .Millisecond )
330
330
331
331
assert .Equal (t , int32 (1 ), atomic .LoadInt32 (& receivedDigestFromInst3 ), "inst1 hasn't received a digest from inst3" )
332
332
@@ -358,7 +358,7 @@ func TestMultipleInitiators(t *testing.T) {
358
358
inst2 .setNextPeerSelection ([]string {"p4" })
359
359
inst3 .setNextPeerSelection ([]string {"p4" })
360
360
361
- time .Sleep (time .Duration (200 ) * time .Millisecond )
361
+ time .Sleep (time .Duration (2000 ) * time .Millisecond )
362
362
363
363
for _ , inst := range []* pullTestInstance {inst1 , inst2 , inst3 } {
364
364
assert .True (t , util .IndexInSlice (inst .state .ToArray (), uint64 (1 ), numericCompare ) != - 1 )
@@ -383,11 +383,11 @@ func TestLatePeers(t *testing.T) {
383
383
inst2 .Add (uint64 (1 ), uint64 (2 ), uint64 (3 ), uint64 (4 ))
384
384
inst3 .Add (uint64 (5 ), uint64 (6 ), uint64 (7 ), uint64 (8 ))
385
385
inst2 .hook (func (m interface {}) {
386
- time .Sleep (time .Duration (60 ) * time .Millisecond )
386
+ time .Sleep (time .Duration (600 ) * time .Millisecond )
387
387
})
388
388
inst1 .setNextPeerSelection ([]string {"p2" , "p3" })
389
389
390
- time .Sleep (time .Duration (200 ) * time .Millisecond )
390
+ time .Sleep (time .Duration (2000 ) * time .Millisecond )
391
391
392
392
assert .True (t , util .IndexInSlice (inst1 .state .ToArray (), uint64 (1 ), numericCompare ) == - 1 )
393
393
assert .True (t , util .IndexInSlice (inst1 .state .ToArray (), uint64 (2 ), numericCompare ) == - 1 )
@@ -416,7 +416,7 @@ func TestBiDiUpdates(t *testing.T) {
416
416
inst1 .setNextPeerSelection ([]string {"p2" })
417
417
inst2 .setNextPeerSelection ([]string {"p1" })
418
418
419
- time .Sleep (time .Duration (200 ) * time .Millisecond )
419
+ time .Sleep (time .Duration (2000 ) * time .Millisecond )
420
420
421
421
assert .True (t , util .IndexInSlice (inst1 .state .ToArray (), uint64 (0 ), numericCompare ) != - 1 )
422
422
assert .True (t , util .IndexInSlice (inst1 .state .ToArray (), uint64 (1 ), numericCompare ) != - 1 )
@@ -478,7 +478,7 @@ func TestSpread(t *testing.T) {
478
478
479
479
inst1 .setNextPeerSelection ([]string {"p2" , "p3" , "p4" })
480
480
481
- time .Sleep (time .Duration (200 ) * time .Millisecond )
481
+ time .Sleep (time .Duration (2000 ) * time .Millisecond )
482
482
483
483
lock .Lock ()
484
484
for pI , counter := range chooseCounters {
0 commit comments