mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-27 05:38:55 +00:00
6af522986e
* enable POW chain by default * fix tests in node.go * ignore ctx
42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package node
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
logTest "github.com/sirupsen/logrus/hooks/test"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
// Test that beacon chain node can close.
|
|
func TestNodeClose_OK(t *testing.T) {
|
|
hook := logTest.NewGlobal()
|
|
|
|
tmp := fmt.Sprintf("%s/datadirtest2", testutil.TempDir())
|
|
os.RemoveAll(tmp)
|
|
|
|
app := cli.NewApp()
|
|
set := flag.NewFlagSet("test", 0)
|
|
set.String("web3provider", "ws//127.0.0.1:8546", "web3 provider ws or IPC endpoint")
|
|
set.Bool("test-skip-pow", true, "skip pow dial")
|
|
set.String("datadir", tmp, "node data directory")
|
|
set.Bool("demo-config", true, "demo configuration")
|
|
set.String("deposit-contract", "0x0000000000000000000000000000000000000000", "deposit contract address")
|
|
|
|
context := cli.NewContext(app, set, nil)
|
|
|
|
node, err := NewBeaconNode(context)
|
|
if err != nil {
|
|
t.Fatalf("Failed to create BeaconNode: %v", err)
|
|
}
|
|
|
|
node.Close()
|
|
|
|
testutil.AssertLogsContain(t, hook, "Stopping beacon node")
|
|
|
|
os.RemoveAll(tmp)
|
|
}
|