github.com/badrootd/celestia-core@v0.0.0-20240305091328-aa4207a4b25d/rpc/client/main_test.go (about) 1 package client_test 2 3 import ( 4 "os" 5 "testing" 6 7 "github.com/badrootd/celestia-core/abci/example/kvstore" 8 nm "github.com/badrootd/celestia-core/node" 9 rpctest "github.com/badrootd/celestia-core/rpc/test" 10 ) 11 12 var node *nm.Node 13 14 func TestMain(m *testing.M) { 15 // start a CometBFT 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 // If testing block event generation 23 // app.SetGenBlockEvents() needs to be called here 24 node = rpctest.StartTendermint(app) 25 26 code := m.Run() 27 28 // and shut down proper at the end 29 rpctest.StopTendermint(node) 30 _ = os.RemoveAll(dir) 31 os.Exit(code) 32 }