Browse Source

e2e: make tx test more stable (#7523)

pull/7528/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
a91d3cb894
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions
  1. +7
    -9
      test/e2e/tests/app_test.go

+ 7
- 9
test/e2e/tests/app_test.go View File

@ -11,11 +11,16 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/rpc/client/http"
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
"github.com/tendermint/tendermint/types"
)
const (
randomSeed = 4827085738
)
// Tests that any initial state given in genesis has made it into the app.
func TestApp_InitialState(t *testing.T) {
testNode(t, func(ctx context.Context, t *testing.T, node e2e.Node) {
@ -139,26 +144,19 @@ func TestApp_Tx(t *testing.T) {
},
}
r := rand.New(rand.NewSource(randomSeed))
for idx, test := range testCases {
if test.ShouldSkip {
continue
}
t.Run(test.Name, func(t *testing.T) {
test := testCases[idx]
t.Parallel()
testNode(t, func(ctx context.Context, t *testing.T, node e2e.Node) {
t.Parallel()
client, err := node.Client()
require.NoError(t, err)
// Generate a random value, to prevent duplicate tx errors when
// manually running the test multiple times for a testnet.
bz := make([]byte, 32)
_, err = rand.Read(bz)
require.NoError(t, err)
key := fmt.Sprintf("testapp-tx-%v", node.Name)
value := fmt.Sprintf("%x", bz)
value := tmrand.StrFromSource(r, 32)
tx := types.Tx(fmt.Sprintf("%v=%v", key, value))
require.NoError(t, test.BroadcastTx(client)(ctx, tx))


Loading…
Cancel
Save