github.com/DFWallet/tendermint-cosmos@v0.0.2/rpc/client/main_test.go (about)

     1  package client_test
     2  
     3  import (
     4  	"io/ioutil"
     5  	"os"
     6  	"testing"
     7  
     8  	"github.com/DFWallet/tendermint-cosmos/abci/example/kvstore"
     9  	nm "github.com/DFWallet/tendermint-cosmos/node"
    10  	rpctest "github.com/DFWallet/tendermint-cosmos/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  
    22  	app := kvstore.NewPersistentKVStoreApplication(dir)
    23  	node = rpctest.StartTendermint(app)
    24  
    25  	code := m.Run()
    26  
    27  	// and shut down proper at the end
    28  	rpctest.StopTendermint(node)
    29  	_ = os.RemoveAll(dir)
    30  	os.Exit(code)
    31  }