github.com/lazyledger/lazyledger-core@v0.35.0-dev.0.20210613111200-4c651f053571/rpc/client/main_test.go (about) 1 package client_test 2 3 import ( 4 "io/ioutil" 5 "os" 6 "testing" 7 8 "github.com/lazyledger/lazyledger-core/abci/example/kvstore" 9 nm "github.com/lazyledger/lazyledger-core/node" 10 rpctest "github.com/lazyledger/lazyledger-core/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 }