mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 16:37:39 +00:00
run e2e for 12 epochs (#10717)
* run for the original number of epochs * to avoid race, wait 1/2 epoch after 1st ready node * Update testing/endtoend/minimal_e2e_test.go * Update testing/endtoend/minimal_e2e_test.go Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com> Co-authored-by: Nishant Das <nishdas93@gmail.com>
This commit is contained in:
parent
092e9e1d19
commit
e3f69e4fad
@ -272,9 +272,7 @@ func (r *testRunner) run() {
|
||||
}
|
||||
|
||||
if config.ExtraEpochs > 0 {
|
||||
secondsPerEpoch := uint64(params.BeaconConfig().SlotsPerEpoch.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
dl := time.Now().Add(time.Second * time.Duration(config.ExtraEpochs*secondsPerEpoch))
|
||||
if err := r.waitUntilEpoch(ctx, types.Epoch(config.EpochsToRun+config.ExtraEpochs), conns[0], dl); err != nil {
|
||||
if err := r.waitExtra(ctx, types.Epoch(config.EpochsToRun+config.ExtraEpochs), conns[0], types.Epoch(config.ExtraEpochs)); err != nil {
|
||||
return errors.Wrap(err, "error while waiting for ExtraEpochs")
|
||||
}
|
||||
syncEvaluators := []e2etypes.Evaluator{ev.FinishedSyncing, ev.AllNodesHaveSameHead}
|
||||
@ -297,9 +295,12 @@ func (r *testRunner) run() {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *testRunner) waitUntilEpoch(ctx context.Context, e types.Epoch, conn *grpc.ClientConn, deadline time.Time) error {
|
||||
func (r *testRunner) waitExtra(ctx context.Context, e types.Epoch, conn *grpc.ClientConn, extra types.Epoch) error {
|
||||
spe := uint64(params.BeaconConfig().SlotsPerEpoch.Mul(params.BeaconConfig().SecondsPerSlot))
|
||||
dl := time.Now().Add(time.Second * time.Duration(uint64(extra)*spe))
|
||||
|
||||
beaconClient := eth.NewBeaconChainClient(conn)
|
||||
ctx, cancel := context.WithDeadline(ctx, deadline)
|
||||
ctx, cancel := context.WithDeadline(ctx, dl)
|
||||
defer cancel()
|
||||
for {
|
||||
select {
|
||||
@ -308,9 +309,15 @@ func (r *testRunner) waitUntilEpoch(ctx context.Context, e types.Epoch, conn *gr
|
||||
default:
|
||||
chainHead, err := beaconClient.GetChainHead(ctx, &emptypb.Empty{})
|
||||
if err != nil {
|
||||
return err
|
||||
log.Warnf("while querying connection %s for chain head got error=%s", conn.Target(), err.Error())
|
||||
}
|
||||
if chainHead.HeadEpoch >= e {
|
||||
if chainHead.HeadEpoch > e {
|
||||
// no need to wait, other nodes should be caught up
|
||||
return nil
|
||||
}
|
||||
if chainHead.HeadEpoch == e {
|
||||
// wait until halfway into the epoch to give other nodes time to catch up
|
||||
time.Sleep(time.Second * time.Duration(spe/2))
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user