prysm-pulse/slasher/node/node_test.go
Raul Jordan b99779fe94
Implementing Slasher Node Runtime (#4856)
* 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
2020-02-14 07:09:54 +00:00

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)
}
}