tendermint/rpc/client/main_test.go
2018-11-06 18:11:10 +01:00

32 lines
649 B
Go

package client_test
import (
"fmt"
"io/ioutil"
"os"
"testing"
"github.com/tendermint/tendermint/abci/example/kvstore"
nm "github.com/tendermint/tendermint/node"
rpctest "github.com/tendermint/tendermint/rpc/test"
)
var node *nm.Node
func TestMain(m *testing.M) {
// start a tendermint node (and kvstore) in the background to test against
dir, err := ioutil.TempDir("/tmp", "abci-rpc-client-test")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
app := kvstore.NewPersistentKVStoreApplication(dir)
node = rpctest.StartTendermint(app)
code := m.Run()
// and shut down proper at the end
node.Stop()
node.Wait()
os.Exit(code)
}