prysm-pulse/beacon-chain/sync/service_test.go
Nishant Das b6353da793
Add Block Batch Limit Flag (#5646)
* add flag

* add flag

* gaz

* fix lint

* fix build issues

* revert initial sync changes

* fix tests

* Update beacon-chain/sync/service.go

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-04-27 09:35:40 -05:00

39 lines
946 B
Go

package sync
import (
"testing"
"time"
mockChain "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing"
stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state"
mockSync "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync/testing"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
)
func init() {
allowedBlocksPerSecond = 64
allowedBlocksBurst = int64(10 * allowedBlocksPerSecond)
}
func TestService_StatusZeroEpoch(t *testing.T) {
bState, err := stateTrie.InitializeFromProto(&pb.BeaconState{Slot: 0})
if err != nil {
t.Fatal(err)
}
r := &Service{
p2p: p2ptest.NewTestP2P(t),
initialSync: new(mockSync.Sync),
chain: &mockChain.ChainService{
Genesis: time.Now(),
State: bState,
},
}
r.chainStarted = true
err = r.Status()
if err != nil {
t.Errorf("Wanted non failing status but got: %v", err)
}
}