Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix flaky tests + new method RetryForBlocks (backport #14609) #15469

Merged
merged 4 commits into from
Mar 20, 2023

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Mar 20, 2023

This is an automatic backport of pull request #14609 done by Mergify.
Cherry-pick of 7505c18 has failed:

On branch mergify/bp/release/v0.47.x/pr-14609
Your branch is up to date with 'origin/release/v0.47.x'.

You are currently cherry-picking commit 7505c18e2.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   client/rpc/rpc_test.go
	modified:   tests/e2e/auth/suite.go
	modified:   tests/e2e/distribution/withdraw_all_suite.go
	modified:   tests/e2e/feegrant/suite.go
	modified:   tests/e2e/gov/deposits.go
	modified:   tests/e2e/staking/suite.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   CHANGELOG.md
	both modified:   testutil/network/network.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com

Co-authored-by: Marko <[email protected]>
(cherry picked from commit 7505c18)

# Conflicts:
#	CHANGELOG.md
#	testutil/network/network.go
@mergify mergify bot requested a review from a team as a code owner March 20, 2023 14:23
@mergify mergify bot added the conflicts label Mar 20, 2023
@github-actions github-actions bot added the C:CLI label Mar 20, 2023
@github-advanced-security
Copy link

You have successfully added a new gosec configuration .github/workflows/gosec.yml:Gosec. As part of the setup process, we have scanned this repository and found 224 existing alerts. Please check the repository Security tab to see all alerts.

Comment on lines +1481 to +1501
s.network.RetryForBlocks(func() error {
latestHeight, err := s.network.LatestHeight()
require.NoError(err)

// Wait maximum 10 blocks, or else fail test.
if latestHeight > delHeight+10 {
s.Fail("timeout reached")
res, err := rpcClient.BlockResults(context.Background(), &latestHeight)
if err != nil {
return err
}

res, err := rpcClient.BlockResults(context.Background(), &latestHeight)
require.NoError(err)
if len(res.ValidatorUpdates) == 0 {
return errors.New("validator update not found yet")
}

if len(res.ValidatorUpdates) > 0 {
valUpdate := res.ValidatorUpdates[0]
require.Equal(
valUpdate.GetPubKey().Sum.(*crypto.PublicKey_Ed25519).Ed25519,
val.PubKey.Bytes(),
)
valUpdate := res.ValidatorUpdates[0]
require.Equal(
valUpdate.GetPubKey().Sum.(*crypto.PublicKey_Ed25519).Ed25519,
val.PubKey.Bytes(),
)

// We got our validator update, test passed.
break
}
return nil

s.network.WaitForNextBlock()
}
}, 10)

Check warning

Code scanning / gosec

Errors unhandled.

Errors unhandled.
@tac0turtle tac0turtle self-assigned this Mar 20, 2023
// blocks has been reached.
func (n *Network) RetryForBlocks(retryFunc func() error, blocks int) error {
for i := 0; i < blocks; i++ {
n.WaitForNextBlock()

Check warning

Code scanning / gosec

Errors unhandled.

Errors unhandled.
@facundomedica facundomedica enabled auto-merge (squash) March 20, 2023 15:16
@facundomedica facundomedica merged commit e350809 into release/v0.47.x Mar 20, 2023
@facundomedica facundomedica deleted the mergify/bp/release/v0.47.x/pr-14609 branch March 20, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants