2018-06-06 02:38:16 +00:00
|
|
|
package node
|
|
|
|
|
2018-06-17 02:26:03 +00:00
|
|
|
import (
|
|
|
|
"flag"
|
2019-02-13 23:49:06 +00:00
|
|
|
"os"
|
2018-06-17 02:26:03 +00:00
|
|
|
"testing"
|
|
|
|
|
2019-02-13 23:49:06 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
|
|
"github.com/prysmaticlabs/prysm/validator/accounts"
|
2018-07-09 02:40:34 +00:00
|
|
|
"github.com/urfave/cli"
|
2018-06-17 02:26:03 +00:00
|
|
|
)
|
2018-06-06 02:38:16 +00:00
|
|
|
|
2018-06-17 02:26:03 +00:00
|
|
|
// Test that the sharding node can build with default flag values.
|
|
|
|
func TestNode_Builds(t *testing.T) {
|
|
|
|
app := cli.NewApp()
|
|
|
|
set := flag.NewFlagSet("test", 0)
|
2019-02-13 23:49:06 +00:00
|
|
|
set.String("datadir", testutil.TempDir()+"/datadir", "the node data directory")
|
|
|
|
dir := testutil.TempDir() + "/keystore1"
|
|
|
|
defer os.RemoveAll(dir)
|
|
|
|
defer os.RemoveAll(testutil.TempDir() + "/datadir")
|
|
|
|
set.String("keystore-path", dir, "path to keystore")
|
|
|
|
set.String("password", "1234", "validator account password")
|
2019-09-26 18:23:25 +00:00
|
|
|
set.String("verbosity", "debug", "log verbosity")
|
2018-06-17 02:26:03 +00:00
|
|
|
context := cli.NewContext(app, set, nil)
|
|
|
|
|
2019-02-13 23:49:06 +00:00
|
|
|
if err := accounts.NewValidatorAccount(dir, "1234"); err != nil {
|
|
|
|
t.Fatalf("Could not create validator account: %v", err)
|
|
|
|
}
|
2019-09-26 18:23:25 +00:00
|
|
|
_, err := NewValidatorClient(context)
|
2018-06-17 02:26:03 +00:00
|
|
|
if err != nil {
|
2018-10-18 17:33:38 +00:00
|
|
|
t.Fatalf("Failed to create ValidatorClient: %v", err)
|
2018-06-17 02:26:03 +00:00
|
|
|
}
|
|
|
|
}
|