github.com/adoriasoft/tendermint@v0.34.0-dev1.0.20200722151356-96d84601a75a/rpc/client/main_test.go (about)

     1  package client_test
     2  
     3  import (
     4  	"io/ioutil"
     5  	"os"
     6  	"testing"
     7  
     8  	"github.com/tendermint/tendermint/abci/example/kvstore"
     9  	nm "github.com/tendermint/tendermint/node"
    10  	rpctest "github.com/tendermint/tendermint/rpc/test"
    11  )
    12  
    13  var node *nm.Node
    14  
    15  func TestMain(m *testing.M) {
    16  	// start a tendermint node (and kvstore) in the background to test against
    17  	dir, err := ioutil.TempDir("/tmp", "rpc-client-test")
    18  	if err != nil {
    19  		panic(err)
    20  	}
    21  	app := kvstore.NewPersistentKVStoreApplication(dir)
    22  	node = rpctest.StartTendermint(app)
    23  
    24  	code := m.Run()
    25  
    26  	// and shut down proper at the end
    27  	rpctest.StopTendermint(node)
    28  	os.Exit(code)
    29  }