mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-28 14:17:17 +00:00
ca90acca77
* 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
41 lines
1.1 KiB
Go
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")
|
|
}
|
|
}
|