mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 12:27:18 +00:00
87ca73d605
* added in logic * latest countdown * fixed up formatting and add tests * ready for review * Merge branch 'master' into countdown-genesis * no log if after genesis * Merge branch 'countdown-genesis' of github.com:prysmaticlabs/prysm into countdown-genesis * countdown * smarter logging * added buffer period for countdown * Merge refs/heads/master into countdown-genesis
31 lines
843 B
Go
31 lines
843 B
Go
package slotutil
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
"github.com/prysmaticlabs/prysm/shared/roughtime"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
logTest "github.com/sirupsen/logrus/hooks/test"
|
|
)
|
|
|
|
func TestCountdownToGenesis(t *testing.T) {
|
|
hook := logTest.NewGlobal()
|
|
params.SetupTestConfigCleanup(t)
|
|
config := params.BeaconConfig()
|
|
config.GenesisCountdownInterval = time.Millisecond * 500
|
|
params.OverrideBeaconConfig(config)
|
|
|
|
firstStringResult := "1s until chain genesis"
|
|
genesisReached := "Chain genesis time reached"
|
|
CountdownToGenesis(
|
|
context.Background(),
|
|
roughtime.Now().Add(2*time.Second),
|
|
params.BeaconConfig().MinGenesisActiveValidatorCount,
|
|
)
|
|
testutil.AssertLogsContain(t, hook, firstStringResult)
|
|
testutil.AssertLogsContain(t, hook, genesisReached)
|
|
}
|