mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
b99779fe94
* include slasher node * slasher node runtime added * added in register for beacon client * streaming blocks fixed up * all subs working * gazelle * handle errors * Merge branch 'master' into slasher-node * Update slasher/node/BUILD.bazel * x up slasher test * Merge refs/heads/master into slasher-node * Merge refs/heads/master into slasher-node * add in force clear into usage * Merge refs/heads/master into slasher-node * usage * Merge refs/heads/master into slasher-node * Fix streamblocks test * Merge refs/heads/master into slasher-node * Fix docker image compile * Merge branch 'slasher-node' of https://github.com/prysmaticlabs/Prysm into slasher-node
43 lines
900 B
Go
43 lines
900 B
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 slasher node can close.
|
|
func TestNodeClose_OK(t *testing.T) {
|
|
hook := logTest.NewGlobal()
|
|
|
|
tmp := fmt.Sprintf("%s/datadirtest2", testutil.TempDir())
|
|
if err := os.RemoveAll(tmp); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
app := cli.NewApp()
|
|
set := flag.NewFlagSet("test", 0)
|
|
set.String("beacon-rpc-provider", "localhost:4232", "beacon node RPC server")
|
|
set.String("datadir", tmp, "node data directory")
|
|
|
|
context := cli.NewContext(app, set, nil)
|
|
|
|
node, err := NewSlasherNode(context)
|
|
if err != nil {
|
|
t.Fatalf("Failed to create SlasherNode: %v", err)
|
|
}
|
|
|
|
node.Close()
|
|
|
|
testutil.AssertLogsContain(t, hook, "Stopping hash slinging slasher")
|
|
|
|
if err := os.RemoveAll(tmp); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|