3291 follow-up (#3323)

* changelog: use issue number instead of PR number

* follow up to #3291

- rpc/test/helpers.go add StopTendermint(node) func
- remove ensureDir(filepath.Dir(walFile), 0700)
- mempool/mempool_test.go add type cleanupFunc func()

* cmd/show_validator: wrap err to make it more clear
This commit is contained in:
Anton Kaliaev
2019-02-18 13:23:40 +04:00
committed by GitHub
parent 59cc6d36c9
commit 8283ca7ddb
12 changed files with 45 additions and 35 deletions

View File

@ -100,8 +100,8 @@ func GetGRPCClient() core_grpc.BroadcastAPIClient {
}
// StartTendermint starts a test tendermint server in a go routine and returns when it is initialized
func StartTendermint(app abci.Application) (*nm.Node, func()) {
node, cleanup := NewTendermint(app)
func StartTendermint(app abci.Application) *nm.Node {
node := NewTendermint(app)
err := node.Start()
if err != nil {
panic(err)
@ -113,11 +113,19 @@ func StartTendermint(app abci.Application) (*nm.Node, func()) {
fmt.Println("Tendermint running!")
return node, cleanup
return node
}
// StopTendermint stops a test tendermint server, waits until it's stopped and
// cleans up test/config files.
func StopTendermint(node *nm.Node) {
node.Stop()
node.Wait()
os.RemoveAll(node.Config().RootDir)
}
// NewTendermint creates a new tendermint server and sleeps forever
func NewTendermint(app abci.Application) (*nm.Node, func()) {
func NewTendermint(app abci.Application) *nm.Node {
// Create & start node
config := GetConfig()
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
@ -138,5 +146,5 @@ func NewTendermint(app abci.Application) (*nm.Node, func()) {
if err != nil {
panic(err)
}
return node, func() { os.RemoveAll(config.RootDir) }
return node
}