prysm-pulse/cmd/config_test.go
kasey 588dea83b7
Config registry (#10683)
* test coverage and updates to config twiddlers

* LoadChainConfigFile error if SetActive conflicts

* lint

* wip working around test issues

* more fixes, mass test updates

* lint

* linting

* thanks deepsource!

* fix undeclared vars

* fixing more undefined

* fix a bug, make a bug, repeat

* gaz

* use stock mainnet in case fork schedule matters

* remove unused KnownConfigs

* post-merge cleanup

* eliminating OverrideBeaconConfig outside tests

* more cleanup of OverrideBeaconConfig outside tests

* config for interop w/ genesis gen support

* improve var name

* API on package instead of exported value

* cleanup remainders of "registry" naming

* Nishant feedback

* add ropstein to configset

* lint

* lint #2

* ✂️

* revert accidental commented line

* check if active is nil (replace called on empty)

* Nishant feedback

* replace OverrideBeaconConfig call

* update interop instructions w/ new flag

* don't let interop replace config set via cli flags

Co-authored-by: kasey <kasey@users.noreply.github.com>
2022-05-20 07:16:53 +00:00

45 lines
941 B
Go

package cmd
import (
"flag"
"testing"
"github.com/prysmaticlabs/prysm/config/params"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
"github.com/urfave/cli/v2"
)
func TestOverrideConfig(t *testing.T) {
cfg := &Flags{
MinimalConfig: true,
}
reset := InitWithReset(cfg)
defer reset()
c := Get()
assert.Equal(t, true, c.MinimalConfig)
}
func TestDefaultConfig(t *testing.T) {
cfg := &Flags{
MaxRPCPageSize: params.BeaconConfig().DefaultPageSize,
}
c := Get()
assert.DeepEqual(t, c, cfg)
reset := InitWithReset(cfg)
defer reset()
c = Get()
assert.DeepEqual(t, c, cfg)
}
func TestConfigureBeaconConfig(t *testing.T) {
app := cli.App{}
set := flag.NewFlagSet("test", 0)
set.Bool(MinimalConfigFlag.Name, true, "test")
context := cli.NewContext(&app, set, nil)
require.NoError(t, ConfigureBeaconChain(context))
c := Get()
assert.Equal(t, true, c.MinimalConfig)
}