2019-10-04 22:46:49 +00:00
|
|
|
package featureconfig_test
|
2019-03-21 02:57:25 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"testing"
|
|
|
|
|
2019-10-04 22:46:49 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
2019-03-21 02:57:25 +00:00
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestInitFeatureConfig(t *testing.T) {
|
2019-11-20 03:03:00 +00:00
|
|
|
cfg := &featureconfig.Flags{
|
2019-10-29 14:31:10 +00:00
|
|
|
GenesisDelay: true,
|
2019-03-21 02:57:25 +00:00
|
|
|
}
|
2019-10-07 05:11:49 +00:00
|
|
|
featureconfig.Init(cfg)
|
2019-10-29 14:31:10 +00:00
|
|
|
if c := featureconfig.Get(); !c.GenesisDelay {
|
|
|
|
t.Errorf("GenesisDelay in FeatureFlags incorrect. Wanted true, got false")
|
2019-03-21 02:57:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestConfigureBeaconConfig(t *testing.T) {
|
|
|
|
app := cli.NewApp()
|
|
|
|
set := flag.NewFlagSet("test", 0)
|
2019-10-29 14:31:10 +00:00
|
|
|
set.Bool(featureconfig.GenesisDelayFlag.Name, true, "enable attestation verification")
|
2019-03-21 02:57:25 +00:00
|
|
|
context := cli.NewContext(app, set, nil)
|
2019-10-07 05:11:49 +00:00
|
|
|
featureconfig.ConfigureBeaconChain(context)
|
2019-10-29 14:31:10 +00:00
|
|
|
if c := featureconfig.Get(); !c.GenesisDelay {
|
|
|
|
t.Errorf("GenesisDelay in FeatureFlags incorrect. Wanted true, got false")
|
2019-03-21 02:57:25 +00:00
|
|
|
}
|
|
|
|
}
|