prysm-pulse/shared/featureconfig/config_test.go
Ivan Martinez ca90acca77 Create feature config for selective testing (#1997)
* Create a feature flagging system

* Refactor how featureflags works and improve docs

* Gazelle and final touches

* Refactor, new flags in the package

* Remove old flags since they have been moved

* Fix bazel

* Update to comments

* Full coverage

* Fix formatting

* Align code with numbers

* Run bazel and fix docs

* Fix test for flag
2019-03-20 22:57:25 -04:00

41 lines
1.1 KiB
Go

package featureconfig
import (
"flag"
"testing"
"github.com/urfave/cli"
)
func TestInitFeatureConfig(t *testing.T) {
cfg := &FeatureFlagConfig{
VerifyAttestationSigs: true,
}
InitFeatureConfig(cfg)
if c := FeatureConfig(); !c.VerifyAttestationSigs {
t.Errorf("VerifyAttestationSigs in FeatureFlags incorrect. Wanted true, got false")
}
}
func TestConfigureBeaconConfig(t *testing.T) {
app := cli.NewApp()
set := flag.NewFlagSet("test", 0)
set.Bool(VerifyAttestationSigsFlag.Name, true, "enable attestation verification")
context := cli.NewContext(app, set, nil)
ConfigureBeaconFeatures(context)
if c := FeatureConfig(); !c.VerifyAttestationSigs {
t.Errorf("VerifyAttestationSigs in FeatureFlags incorrect. Wanted true, got false")
}
}
func TestConfigureValidatorConfig(t *testing.T) {
app := cli.NewApp()
set := flag.NewFlagSet("test", 0)
set.Bool(VerifyAttestationSigsFlag.Name, true, "enable attestation verification")
context := cli.NewContext(app, set, nil)
ConfigureValidatorFeatures(context)
if c := FeatureConfig(); !c.VerifyAttestationSigs {
t.Errorf("VerifyAttestationSigs in FeatureFlags incorrect. Wanted true, got false")
}
}