mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-10 03:31:20 +00:00
1a0e16a48b
* define engine caller * gaz * Update cmd/beacon-chain/flags/base.go Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package powchaincmd
|
|
|
|
import (
|
|
"flag"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/cmd/beacon-chain/flags"
|
|
"github.com/prysmaticlabs/prysm/testing/assert"
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
logTest "github.com/sirupsen/logrus/hooks/test"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
func TestPowchainCmd(t *testing.T) {
|
|
app := cli.App{}
|
|
set := flag.NewFlagSet("test", 0)
|
|
set.String(flags.HTTPWeb3ProviderFlag.Name, "primary", "")
|
|
fallback := cli.StringSlice{}
|
|
err := fallback.Set("fallback1")
|
|
require.NoError(t, err)
|
|
err = fallback.Set("fallback2")
|
|
require.NoError(t, err)
|
|
set.Var(&fallback, flags.FallbackWeb3ProviderFlag.Name, "")
|
|
ctx := cli.NewContext(&app, set, nil)
|
|
|
|
endpoints := parsePowchainEndpoints(ctx)
|
|
assert.DeepEqual(t, []string{"primary", "fallback1", "fallback2"}, endpoints)
|
|
}
|
|
|
|
func TestPowchainPreregistration_EmptyWeb3Provider(t *testing.T) {
|
|
hook := logTest.NewGlobal()
|
|
app := cli.App{}
|
|
set := flag.NewFlagSet("test", 0)
|
|
set.String(flags.HTTPWeb3ProviderFlag.Name, "", "")
|
|
fallback := cli.StringSlice{}
|
|
set.Var(&fallback, flags.FallbackWeb3ProviderFlag.Name, "")
|
|
ctx := cli.NewContext(&app, set, nil)
|
|
parsePowchainEndpoints(ctx)
|
|
assert.LogsContain(t, hook, "No ETH1 node specified to run with the beacon node")
|
|
}
|