mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-24 22:32:15 +00:00
* improve ResetTestRootWithChainID() concurrency safety Rely on ioutil.TempDir() to create test root directories and ensure multiple same-chain id test cases can run in parallel. * Update config/toml.go Co-Authored-By: alessio <quadrispro@ubuntu.com> * clean up test directories after completion Closes: #1034 * Remove redundant EnsureDir call * s/PanicSafety()/panic()/s * Put create dir functionality back in ResetTestRootWithChainID * Place test directories in OS's tempdir In modern UNIX and UNIX-like systems /tmp is very often mounted as tmpfs. This might speed test execution a bit. * Set 0700 to a const * rootsDirs -> configRootDirs * Don't double remove directories * Avoid global variables * Fix consensus tests * Reduce defer stack * Address review comments * Try to fix tests * Update CHANGELOG_PENDING.md Co-Authored-By: alessio <quadrispro@ubuntu.com> * Update consensus/common_test.go Co-Authored-By: alessio <quadrispro@ubuntu.com> * Update consensus/common_test.go Co-Authored-By: alessio <quadrispro@ubuntu.com>
35 lines
870 B
Go
35 lines
870 B
Go
package core_grpc_test
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/tendermint/tendermint/abci/example/kvstore"
|
|
core_grpc "github.com/tendermint/tendermint/rpc/grpc"
|
|
rpctest "github.com/tendermint/tendermint/rpc/test"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
// start a tendermint node in the background to test against
|
|
app := kvstore.NewKVStoreApplication()
|
|
node, cleanup := rpctest.StartTendermint(app)
|
|
code := m.Run()
|
|
|
|
// and shut down proper at the end
|
|
node.Stop()
|
|
node.Wait()
|
|
cleanup()
|
|
os.Exit(code)
|
|
}
|
|
|
|
func TestBroadcastTx(t *testing.T) {
|
|
require := require.New(t)
|
|
res, err := rpctest.GetGRPCClient().BroadcastTx(context.Background(), &core_grpc.RequestBroadcastTx{Tx: []byte("this is a tx")})
|
|
require.Nil(err, "%+v", err)
|
|
require.EqualValues(0, res.CheckTx.Code)
|
|
require.EqualValues(0, res.DeliverTx.Code)
|
|
}
|