@@ -320,13 +320,10 @@ func TestViewChangeXset(t *testing.T) {
320
320
if i == 3 {
321
321
continue
322
322
}
323
- if len (a .batches ) != 2 {
324
- t .Fatal ("expected execution of 1 null request + 1 batch" )
325
- }
326
- if len (a .batches [0 ].Payloads ) != 0 {
327
- t .Error ("not a null request" )
323
+ if len (a .batches ) != 1 {
324
+ t .Fatalf ("expected execution of 1 batch: %v" , a .batches )
328
325
}
329
- if ! reflect .DeepEqual ([][]byte {r2 }, a .batches [1 ].Payloads ) {
326
+ if ! reflect .DeepEqual ([][]byte {r2 }, a .batches [0 ].Payloads ) {
330
327
t .Error ("wrong request executed" )
331
328
}
332
329
}
@@ -373,13 +370,13 @@ func TestRestart(t *testing.T) {
373
370
repls [1 ].Request (r3 )
374
371
sys .Run ()
375
372
for _ , a := range adapters {
376
- if len (a .batches ) != 3 {
377
- t .Fatalf ("expected execution of 3 batches, %d got %v" , a .id , a .batches )
373
+ if len (a .batches ) != 2 {
374
+ t .Fatalf ("expected execution of 2 batches, %d got %v" , a .id , a .batches )
378
375
}
379
- if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [1 ].Payloads ) {
376
+ if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [0 ].Payloads ) {
380
377
t .Error ("wrong request executed (1)" )
381
378
}
382
- if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [2 ].Payloads ) {
379
+ if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [1 ].Payloads ) {
383
380
t .Error ("wrong request executed (2)" )
384
381
}
385
382
}
@@ -442,13 +439,13 @@ func TestRestartAfterPrepare(t *testing.T) {
442
439
repls [1 ].Request (r3 )
443
440
sys .Run ()
444
441
for _ , a := range adapters {
445
- if len (a .batches ) != 3 {
446
- t .Fatal ("expected execution of 3 batches" )
442
+ if len (a .batches ) != 2 {
443
+ t .Fatal ("expected execution of 2 batches" )
447
444
}
448
- if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [1 ].Payloads ) {
445
+ if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [0 ].Payloads ) {
449
446
t .Error ("wrong request executed (1)" )
450
447
}
451
- if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [2 ].Payloads ) {
448
+ if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [1 ].Payloads ) {
452
449
t .Error ("wrong request executed (2)" )
453
450
}
454
451
}
@@ -511,13 +508,13 @@ func TestRestartAfterCommit(t *testing.T) {
511
508
repls [1 ].Request (r3 )
512
509
sys .Run ()
513
510
for _ , a := range adapters {
514
- if len (a .batches ) != 3 {
515
- t .Fatal ("expected execution of 3 batches" )
511
+ if len (a .batches ) != 2 {
512
+ t .Fatal ("expected execution of 2 batches" )
516
513
}
517
- if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [1 ].Payloads ) {
514
+ if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [0 ].Payloads ) {
518
515
t .Error ("wrong request executed (1)" )
519
516
}
520
- if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [2 ].Payloads ) {
517
+ if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [1 ].Payloads ) {
521
518
t .Error ("wrong request executed (2)" )
522
519
}
523
520
}
@@ -580,13 +577,13 @@ func TestRestartAfterCheckpoint(t *testing.T) {
580
577
repls [1 ].Request (r3 )
581
578
sys .Run ()
582
579
for _ , a := range adapters {
583
- if len (a .batches ) != 3 {
584
- t .Fatal ("expected execution of 3 batches" )
580
+ if len (a .batches ) != 2 {
581
+ t .Fatal ("expected execution of 2 batches" )
585
582
}
586
- if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [1 ].Payloads ) {
583
+ if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [0 ].Payloads ) {
587
584
t .Error ("wrong request executed (1)" )
588
585
}
589
- if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [2 ].Payloads ) {
586
+ if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [1 ].Payloads ) {
590
587
t .Error ("wrong request executed (2)" )
591
588
}
592
589
}
@@ -669,13 +666,13 @@ func TestErroneousViewChange(t *testing.T) {
669
666
repls [1 ].Request (r3 )
670
667
sys .Run ()
671
668
for _ , a := range adapters {
672
- if len (a .batches ) != 3 {
673
- t .Fatal ("expected execution of 3 batches" )
669
+ if len (a .batches ) != 2 {
670
+ t .Fatal ("expected execution of 2 batches" )
674
671
}
675
- if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [1 ].Payloads ) {
672
+ if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [0 ].Payloads ) {
676
673
t .Error ("wrong request executed (1)" )
677
674
}
678
- if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [2 ].Payloads ) {
675
+ if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [1 ].Payloads ) {
679
676
t .Error ("wrong request executed (2)" )
680
677
}
681
678
}
@@ -863,24 +860,15 @@ func TestViewChangeTimer(t *testing.T) {
863
860
repls [2 ].Request (r3 )
864
861
sys .Run ()
865
862
for _ , a := range adapters {
866
- offs := 0
863
+ if len (a .batches ) != 2 {
864
+ t .Fatalf ("%d: expected execution of 2 batches: %v" , a .id , a .batches )
865
+ }
867
866
if a .id != 3 {
868
- if len (a .batches ) != 3 {
869
- t .Fatalf ("%d: expected execution of 3 batches: %v" , a .id , a .batches )
870
- }
871
867
if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [0 ].Payloads ) {
872
868
t .Errorf ("%d: wrong request executed (1): %v" , a .id , a .batches )
873
869
}
874
- } else {
875
- offs = - 1
876
- if len (a .batches ) != 2 {
877
- t .Fatalf ("%d: expected execution of 3 batches: %v" , a .id , a .batches )
878
- }
879
- }
880
- if len (a .batches [1 + offs ].Payloads ) != 0 {
881
- t .Errorf ("%d: not a null request: %v" , a .id , a .batches [1 ])
882
870
}
883
- if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [2 + offs ].Payloads ) {
871
+ if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [1 ].Payloads ) {
884
872
t .Errorf ("%d: wrong request executed (2): %v" , a .id , a .batches )
885
873
}
886
874
}
@@ -933,13 +921,13 @@ func TestResendViewChange(t *testing.T) {
933
921
repls [1 ].Request (r3 )
934
922
sys .Run ()
935
923
for _ , a := range adapters {
936
- if len (a .batches ) != 3 {
924
+ if len (a .batches ) != 2 {
937
925
t .Fatal ("expected execution of 2 batches" )
938
926
}
939
- if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [1 ].Payloads ) {
927
+ if ! reflect .DeepEqual ([][]byte {r1 }, a .batches [0 ].Payloads ) {
940
928
t .Error ("wrong request executed (1)" )
941
929
}
942
- if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [2 ].Payloads ) {
930
+ if ! reflect .DeepEqual ([][]byte {r2 , r3 }, a .batches [1 ].Payloads ) {
943
931
t .Error ("wrong request executed (2)" )
944
932
}
945
933
}
0 commit comments