github.com/ari-anchor/sei-tendermint@v0.0.0-20230519144642-dc826b7b56bb/rpc/client/main_test.go (about) 1 package client_test 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 "github.com/stretchr/testify/require" 9 10 "github.com/ari-anchor/sei-tendermint/abci/example/kvstore" 11 "github.com/ari-anchor/sei-tendermint/config" 12 "github.com/ari-anchor/sei-tendermint/libs/log" 13 "github.com/ari-anchor/sei-tendermint/libs/service" 14 rpctest "github.com/ari-anchor/sei-tendermint/rpc/test" 15 ) 16 17 func NodeSuite(ctx context.Context, t *testing.T, logger log.Logger) (service.Service, *config.Config) { 18 t.Helper() 19 20 ctx, cancel := context.WithCancel(ctx) 21 22 conf, err := rpctest.CreateConfig(t, t.Name()) 23 require.NoError(t, err) 24 25 app := kvstore.NewApplication() 26 27 // start a tendermint node in the background to test against. 28 node, closer, err := rpctest.StartTendermint(ctx, conf, app, rpctest.SuppressStdout) 29 require.NoError(t, err) 30 t.Cleanup(func() { 31 cancel() 32 assert.NoError(t, closer(ctx)) 33 assert.NoError(t, app.Close()) 34 node.Wait() 35 }) 36 return node, conf 37 }