|
@ -11,11 +11,16 @@ import ( |
|
|
"github.com/stretchr/testify/assert" |
|
|
"github.com/stretchr/testify/assert" |
|
|
"github.com/stretchr/testify/require" |
|
|
"github.com/stretchr/testify/require" |
|
|
|
|
|
|
|
|
|
|
|
tmrand "github.com/tendermint/tendermint/libs/rand" |
|
|
"github.com/tendermint/tendermint/rpc/client/http" |
|
|
"github.com/tendermint/tendermint/rpc/client/http" |
|
|
e2e "github.com/tendermint/tendermint/test/e2e/pkg" |
|
|
e2e "github.com/tendermint/tendermint/test/e2e/pkg" |
|
|
"github.com/tendermint/tendermint/types" |
|
|
"github.com/tendermint/tendermint/types" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
|
|
randomSeed = 4827085738 |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
// Tests that any initial state given in genesis has made it into the app.
|
|
|
// Tests that any initial state given in genesis has made it into the app.
|
|
|
func TestApp_InitialState(t *testing.T) { |
|
|
func TestApp_InitialState(t *testing.T) { |
|
|
testNode(t, func(ctx context.Context, t *testing.T, node e2e.Node) { |
|
|
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 { |
|
|
for idx, test := range testCases { |
|
|
if test.ShouldSkip { |
|
|
if test.ShouldSkip { |
|
|
continue |
|
|
continue |
|
|
} |
|
|
} |
|
|
t.Run(test.Name, func(t *testing.T) { |
|
|
t.Run(test.Name, func(t *testing.T) { |
|
|
test := testCases[idx] |
|
|
test := testCases[idx] |
|
|
t.Parallel() |
|
|
|
|
|
testNode(t, func(ctx context.Context, t *testing.T, node e2e.Node) { |
|
|
testNode(t, func(ctx context.Context, t *testing.T, node e2e.Node) { |
|
|
t.Parallel() |
|
|
|
|
|
client, err := node.Client() |
|
|
client, err := node.Client() |
|
|
require.NoError(t, err) |
|
|
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) |
|
|
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)) |
|
|
tx := types.Tx(fmt.Sprintf("%v=%v", key, value)) |
|
|
|
|
|
|
|
|
require.NoError(t, test.BroadcastTx(client)(ctx, tx)) |
|
|
require.NoError(t, test.BroadcastTx(client)(ctx, tx)) |
|
|