github.com/vipernet-xyz/tm@v0.34.24/rpc/client/main_test.go (about)

     1  package client_test
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/vipernet-xyz/tm/abci/example/kvstore"
     8  	nm "github.com/vipernet-xyz/tm/node"
     9  	rpctest "github.com/vipernet-xyz/tm/rpc/test"
    10  )
    11  
    12  var node *nm.Node
    13  
    14  func TestMain(m *testing.M) {
    15  	// start a tendermint node (and kvstore) in the background to test against
    16  	dir, err := os.MkdirTemp("/tmp", "rpc-client-test")
    17  	if err != nil {
    18  		panic(err)
    19  	}
    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.RemoveAll(dir)
    29  	os.Exit(code)
    30  }