@@ -3,13 +3,17 @@ package interchaintest
33import (
44 "context"
55 "fmt"
6+ "strings"
67 "testing"
8+ "time"
79
810 "cosmossdk.io/math"
911
1012 sdk "github.com/cosmos/cosmos-sdk/types"
1113 "github.com/cosmos/interchaintest/v10"
14+ "github.com/cosmos/interchaintest/v10/chain/cosmos"
1215 "github.com/cosmos/interchaintest/v10/ibc"
16+ "github.com/cosmos/interchaintest/v10/testutil"
1317 "github.com/stretchr/testify/require"
1418
1519 "github.com/persistenceOne/persistenceCore/v17/interchaintest/helpers"
@@ -24,10 +28,8 @@ func TestTxAuthSignModesAndOrdering(t *testing.T) {
2428 t .Skip ()
2529 }
2630
27- t .Parallel ()
28-
29- ctx , cancel := context .WithCancel (context .Background ())
30- t .Cleanup (cancel )
31+ ctx := context .Background ()
32+ t .Cleanup (func () {})
3133
3234 // Single chain with 1 validator is sufficient
3335 validators := 1
@@ -36,6 +38,9 @@ func TestTxAuthSignModesAndOrdering(t *testing.T) {
3638 require .NotNil (t , chain )
3739 defer func () { _ = ic .Close () }()
3840
41+ // ensure chain has produced at least one block before first tx
42+ require .NoError (t , testutil .WaitForBlocks (ctx , 1 , chain ))
43+
3944 chainNode := chain .Nodes ()[0 ]
4045 denom := chain .Config ().Denom
4146
@@ -53,6 +58,28 @@ func TestTxAuthSignModesAndOrdering(t *testing.T) {
5358
5459 amount := sdk .NewCoin (denom , math .NewInt (100_000 ))
5560
61+ // retry wrapper to reduce flakiness due to transient RPC hiccups in CI
62+ execTxWithRetry := func (ctx context.Context , node * cosmos.ChainNode , key string , cmd ... string ) (string , error ) {
63+ var lastErr error
64+ for i := 0 ; i < i ; i ++ {
65+ t .Logf ("Exec attempt %d: %v" , i + 1 , append ([]string {"persistenceCore" , "tx" }, cmd ... ))
66+ txHash , err := node .ExecTx (ctx , key , cmd ... )
67+ if err == nil {
68+ return txHash , nil
69+ }
70+ lastErr = err
71+ emsg := err .Error ()
72+ // retry on typical transient errors observed in CI
73+ if strings .Contains (emsg , "connection refused" ) || strings .Contains (emsg , "post failed" ) || strings .Contains (emsg , "EOF" ) || strings .Contains (emsg , "i/o timeout" ) || strings .Contains (emsg , "transport is closing" ) {
74+ time .Sleep (time .Duration (i + 1 ) * 500 * time .Millisecond )
75+ continue
76+ }
77+ // non-transient
78+ return "" , err
79+ }
80+ return "" , lastErr
81+ }
82+
5683 doSend := func (sender ibc.Wallet , signMode string , unordered bool ) {
5784 cmd := []string {
5885 "bank" , "send" ,
@@ -66,7 +93,7 @@ func TestTxAuthSignModesAndOrdering(t *testing.T) {
6693 cmd = append (cmd , "--unordered" , "--timeout-duration=10s" )
6794 }
6895
69- txHash , err := chainNode . ExecTx (ctx , sender .KeyName (), cmd ... )
96+ txHash , err := execTxWithRetry (ctx , chainNode , sender .KeyName (), cmd ... )
7097 require .NoError (t , err )
7198 _ , err = helpers .QueryTx (ctx , chainNode , txHash )
7299 require .NoError (t , err )
0 commit comments