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

fix(e2e): tolerate revert message in both error and status message #2983

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Oct 8, 2024

Description

Fix the upgrade tests.

Closes #2982

E2E is failing with:

setup      | ❌ zeta tests failed: Post "http://zetacore0:8545": dial tcp 172.20.0.11:8545: connect: connection refused
setup      | ❌ e2e tests failed after 6m25.624286441s

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced error handling for cross-chain calls and Solana deposit transactions to accommodate a wider range of error messages.
  • Tests

    • Improved robustness of error checking in Ether and Solana deposit tests.

@gartnera gartnera added no-changelog Skip changelog CI check UPGRADE_TESTS Run make start-upgrade-tests labels Oct 8, 2024
@gartnera gartnera force-pushed the e2e-revert-status-error branch from 248e9f8 to 749c2ec Compare October 9, 2024 16:46
@gartnera gartnera marked this pull request as ready for review October 9, 2024 17:09
Copy link
Contributor

coderabbitai bot commented Oct 9, 2024

📝 Walkthrough

Walkthrough

The changes in this pull request enhance the error handling logic within two end-to-end test functions: TestEtherDepositAndCall and TestSolanaDepositAndCallRefund. The updates allow these functions to check for a broader range of error messages related to revert conditions after cross-chain calls and Solana deposit transactions, thereby improving the robustness of the tests.

Changes

Files Change Summary
e2e/e2etests/test_eth_deposit_call.go, Enhanced error handling in TestEtherDepositAndCall to check for "revert executed" and
e2e/e2etests/test_solana_deposit_refund.go utils.ErrHashRevertFoo in CctxStatus. Similar updates made in TestSolanaDepositAndCallRefund.

Assessment against linked issues

Objective Addressed Explanation
Enhance error handling in tests (#2982)

Possibly related PRs

  • test: add bitcoin e2e test deposit_call #2895: This PR adds an end-to-end test for Bitcoin deposit and call functionality, which is related to the enhancements made in the error handling logic for cross-chain calls in the main PR.

Suggested labels

E2E, breaking:cli

Suggested reviewers

  • fbac
  • kingpinXD
  • swift1337
  • ws4charlie
  • lumtis
  • skosito
  • brewmaster012

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@gartnera gartnera enabled auto-merge October 9, 2024 17:10
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
e2e/e2etests/test_solana_deposit_refund.go (1)

35-40: Approve changes with suggestions for improvement

The modifications effectively address the PR objective by introducing more flexible error message validation. The code now tolerates revert messages in both the ErrorMessage and StatusMessage fields, which aligns with the goal of improving the robustness of the upgrade tests.

However, there are two areas where the implementation could be further enhanced:

  1. Consistency in error messages: The code checks for different error messages in ErrorMessage ("revert executed") and StatusMessage (utils.ErrHashRevertFoo). Consider standardizing these messages for better maintainability.

  2. Debugging information: To facilitate easier troubleshooting, consider adding logging statements to indicate which condition was met.

Here's a suggested refactoring that addresses these points:

const revertMessage = "revert executed"

if cctx.CctxStatus.ErrorMessage != "" {
    r.Logger.Debug("Revert found in ErrorMessage")
    require.Contains(r, cctx.CctxStatus.ErrorMessage, revertMessage)
} else {
    r.Logger.Debug("Revert found in StatusMessage")
    require.Contains(r, cctx.CctxStatus.StatusMessage, revertMessage)
}

This refactoring introduces a constant for the revert message, ensuring consistency across both checks, and adds logging statements to aid in debugging.

e2e/e2etests/test_eth_deposit_call.go (1)

91-96: Approve changes with minor improvement suggestions.

The modifications effectively address the PR objective of tolerating revert messages in both error and status messages, enhancing the test's robustness. However, I propose the following refinements:

  1. For consistency, consider using the same error message check for both fields:
revertMessage := "revert executed"
if cctx.CctxStatus.ErrorMessage != "" {
    require.Contains(r, cctx.CctxStatus.ErrorMessage, revertMessage)
} else {
    require.Contains(r, cctx.CctxStatus.StatusMessage, revertMessage)
}
  1. Add a comment explaining the rationale behind checking two different fields:
// Check for revert message in ErrorMessage first, then in StatusMessage
// This accommodates potential differences in error reporting between versions

These suggestions aim to improve code consistency and clarity while maintaining the intended functionality.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1470fdc and 749c2ec.

📒 Files selected for processing (2)
  • e2e/e2etests/test_eth_deposit_call.go (1 hunks)
  • e2e/e2etests/test_solana_deposit_refund.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
e2e/e2etests/test_eth_deposit_call.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

e2e/e2etests/test_solana_deposit_refund.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

@gartnera gartnera added this pull request to the merge queue Oct 10, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 10, 2024
@lumtis lumtis added this pull request to the merge queue Oct 10, 2024
Merged via the queue into develop with commit 81fc485 Oct 10, 2024
38 checks passed
@lumtis lumtis deleted the e2e-revert-status-error branch October 10, 2024 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Skip changelog CI check UPGRADE_TESTS Run make start-upgrade-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade tests broken
3 participants