You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
650 B

  1. package client_test
  2. import (
  3. "fmt"
  4. "io/ioutil"
  5. "os"
  6. "testing"
  7. "github.com/stretchr/testify/require"
  8. "github.com/tendermint/tendermint/abci/example/kvstore"
  9. "github.com/tendermint/tendermint/node"
  10. rpctest "github.com/tendermint/tendermint/rpc/test"
  11. )
  12. func NodeSuite(t *testing.T) *node.Node {
  13. t.Helper()
  14. dir, err := ioutil.TempDir("/tmp", fmt.Sprint("rpc-client-test-", t.Name()))
  15. require.NoError(t, err)
  16. app := kvstore.NewPersistentKVStoreApplication(dir)
  17. n := rpctest.StartTendermint(app)
  18. t.Cleanup(func() {
  19. // and shut down proper at the end
  20. rpctest.StopTendermint(n)
  21. app.Close()
  22. _ = os.RemoveAll(dir)
  23. })
  24. return n
  25. }