prysm-pulse/cmd/config_test.go

45 lines
950 B
Go
Raw Permalink Normal View History

package cmd
import (
"flag"
"testing"
"github.com/prysmaticlabs/prysm/v5/config/params"
"github.com/prysmaticlabs/prysm/v5/testing/assert"
"github.com/prysmaticlabs/prysm/v5/testing/require"
"github.com/urfave/cli/v2"
)
Fix CMD Config and modify --historical-slasher-node (#6730) * Fix CMD config overwriting * Rename and change historical slasher node * Merge branch 'master' of github.com:prysmaticlabs/prysm into fix-cmd-config * Fix * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Add storage warning * Merge branch 'fix-cmd-config' of github.com:prysmaticlabs/prysm into fix-cmd-config * Remove period * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Add default values test * Merge branch 'fix-cmd-config' of github.com:prysmaticlabs/prysm into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Gaz * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Fix inits * Merge branch 'fix-cmd-config' of github.com:prysmaticlabs/prysm into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Fix * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge branch 'master' of github.com:prysmaticlabs/prysm into fix-cmd-config * Fix * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config
2020-08-02 22:09:10 +00:00
func TestOverrideConfig(t *testing.T) {
cfg := &Flags{
MinimalConfig: true,
}
Fix CMD Config and modify --historical-slasher-node (#6730) * Fix CMD config overwriting * Rename and change historical slasher node * Merge branch 'master' of github.com:prysmaticlabs/prysm into fix-cmd-config * Fix * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Add storage warning * Merge branch 'fix-cmd-config' of github.com:prysmaticlabs/prysm into fix-cmd-config * Remove period * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Add default values test * Merge branch 'fix-cmd-config' of github.com:prysmaticlabs/prysm into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Gaz * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Fix inits * Merge branch 'fix-cmd-config' of github.com:prysmaticlabs/prysm into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Fix * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge branch 'master' of github.com:prysmaticlabs/prysm into fix-cmd-config * Fix * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config
2020-08-02 22:09:10 +00:00
reset := InitWithReset(cfg)
defer reset()
c := Get()
assert.Equal(t, true, c.MinimalConfig)
}
Fix CMD Config and modify --historical-slasher-node (#6730) * Fix CMD config overwriting * Rename and change historical slasher node * Merge branch 'master' of github.com:prysmaticlabs/prysm into fix-cmd-config * Fix * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Add storage warning * Merge branch 'fix-cmd-config' of github.com:prysmaticlabs/prysm into fix-cmd-config * Remove period * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Add default values test * Merge branch 'fix-cmd-config' of github.com:prysmaticlabs/prysm into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Gaz * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Fix inits * Merge branch 'fix-cmd-config' of github.com:prysmaticlabs/prysm into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Fix * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config * Merge branch 'master' of github.com:prysmaticlabs/prysm into fix-cmd-config * Fix * Merge refs/heads/master into fix-cmd-config * Merge refs/heads/master into fix-cmd-config
2020-08-02 22:09:10 +00:00
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)
}