Patch test network setup to handle failing E2E tests in CI
All checks were successful
Build / build (pull_request) Successful in 1m56s
Integration Tests / test-integration (pull_request) Successful in 1m56s
Unit Tests / test-unit (pull_request) Successful in 1m19s
E2E Tests / test-e2e (pull_request) Successful in 3m47s
Lint / Run golangci-lint (pull_request) Successful in 4m39s

This commit is contained in:
Prathamesh Musale 2024-03-07 17:34:14 +05:30
parent 41b386d7c3
commit 436455b263
2 changed files with 12 additions and 6 deletions

View File

@ -64,3 +64,9 @@ A typical testing flow might look like the following:
} }
*/ */
package network package network
/*
NOTE:
Copied over from https://github.com/cosmos/cosmos-sdk/tree/v0.50.3/testutil/network
Patch: Skipped network.LatestHeight() call at the end of New()
*/

View File

@ -619,12 +619,12 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
l.Log("started validator", idx) l.Log("started validator", idx)
} }
height, err := network.LatestHeight() // height, err := network.LatestHeight()
if err != nil { // if err != nil {
return nil, err // return nil, err
} // }
l.Log("started test network at height:", height) // l.Log("started test network at height:", height)
// Ensure we cleanup incase any test was abruptly halted (e.g. SIGINT) as any // Ensure we cleanup incase any test was abruptly halted (e.g. SIGINT) as any
// defer in a test would not be called. // defer in a test would not be called.
@ -745,7 +745,7 @@ func (n *Network) WaitForHeightWithTimeout(h int64, t time.Duration) (int64, err
// blocks has been reached. // blocks has been reached.
func (n *Network) RetryForBlocks(retryFunc func() error, blocks int) error { func (n *Network) RetryForBlocks(retryFunc func() error, blocks int) error {
for i := 0; i < blocks; i++ { for i := 0; i < blocks; i++ {
n.WaitForNextBlock() _ = n.WaitForNextBlock()
err := retryFunc() err := retryFunc()
if err == nil { if err == nil {
return nil return nil