mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
* fixing stringslice issue and adding one more filter * fixing linting and improving function based on feedback * rolling back generic function to check ci * adding function back in * testing printing error * reverting change * Added gofmt detail flag * temporary change * Another flag added * Revert changes * Modifed entrypoint * Another change * Revert * Change go image * Added -e flag * Switched to alpine image * Switched go to strech * Fix typo * Yet another image added * Added go alpine * rolling back generic * reverting version * Update go.sum reverting * Update go.mod reverting * Update Dockerfile rolling back * Update entrypoint.sh rolling back * Update go.yml reverting changes * fixing flag for config * reverting changes and moving change to another PR * Update validator/node/node.go Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * updating based on review * Update container/slice/slice.go Co-authored-by: Taranpreet26311 <taran@prysmaticlabs.com> Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
53 lines
1.6 KiB
Go
53 lines
1.6 KiB
Go
package flags
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/cmd"
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
func TestLoadFlagsFromConfig_PreProcessing_Web3signer(t *testing.T) {
|
|
app := cli.App{}
|
|
set := flag.NewFlagSet("test", 0)
|
|
context := cli.NewContext(&app, set, nil)
|
|
|
|
pubkey1 := "0xbd36226746676565cd40141a7f0fe1445b9a3fbeb222288b226392c4b230ed0b"
|
|
pubkey2 := "0xbd36226746676565cd40141a7f0fe1445b9a3fbeb222288b226392c4b230ed0a"
|
|
|
|
require.NoError(t, os.WriteFile("flags_test.yaml", []byte(fmt.Sprintf("%s:\n - %s\n - %s\n", Web3SignerPublicValidatorKeysFlag.Name,
|
|
pubkey1,
|
|
pubkey2)), 0666))
|
|
|
|
require.NoError(t, set.Parse([]string{"test-command", "--" + cmd.ConfigFileFlag.Name, "flags_test.yaml"}))
|
|
command := &cli.Command{
|
|
Name: "test-command",
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: cmd.ConfigFileFlag.Name,
|
|
},
|
|
&cli.StringSliceFlag{
|
|
Name: Web3SignerPublicValidatorKeysFlag.Name,
|
|
},
|
|
}),
|
|
Before: func(cliCtx *cli.Context) error {
|
|
return cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags)
|
|
},
|
|
Action: func(cliCtx *cli.Context) error {
|
|
//TODO: https://github.com/urfave/cli/issues/1197 right now does not set flag
|
|
require.Equal(t, false, cliCtx.IsSet(Web3SignerPublicValidatorKeysFlag.Name))
|
|
|
|
require.Equal(t, strings.Join([]string{pubkey1, pubkey2}, ","),
|
|
strings.Join(cliCtx.StringSlice(Web3SignerPublicValidatorKeysFlag.Name), ","))
|
|
return nil
|
|
},
|
|
}
|
|
require.NoError(t, command.Run(context))
|
|
require.NoError(t, os.Remove("flags_test.yaml"))
|
|
}
|