2020-06-12 18:47:18 +00:00
|
|
|
package slotutil
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/roughtime"
|
2020-08-13 16:22:25 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
2020-06-12 18:47:18 +00:00
|
|
|
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,
|
|
|
|
)
|
2020-08-13 16:22:25 +00:00
|
|
|
require.LogsContain(t, hook, firstStringResult)
|
|
|
|
require.LogsContain(t, hook, genesisReached)
|
2020-06-12 18:47:18 +00:00
|
|
|
}
|