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(e2e): run solana tests when testing upgrades #3601

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

kingpinXD
Copy link
Contributor

@kingpinXD kingpinXD commented Feb 26, 2025

Description

Closes #3598

The pr also adds some checks to successfully run runner version of solana tests on v28

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

  • New Features

    • Introduced a new test flag to enable Solana-specific scenarios during upgrade tests.
    • Added an upgrade profile for the Solana service, expanding configuration options for upgrade deployments.
  • Tests

    • Enhanced testing workflows to conditionally execute select Solana and SPL tests based on deployment state.
    • Adjusted chain parameter settings during upgrades to optimize test behavior.
    • Updated release notes to reflect that Solana tests are now part of the upgrade testing process.

@kingpinXD kingpinXD requested a review from a team as a code owner February 26, 2025 22:54
@kingpinXD kingpinXD marked this pull request as draft February 26, 2025 22:54
Copy link
Contributor

coderabbitai bot commented Feb 26, 2025

📝 Walkthrough

Walkthrough

This pull request updates multiple components to refine the testing process for Solana upgrades. The changes include adding an environment variable in the Makefile and updating the changelog, modifying the test execution flow in the local end-to-end test file, adding an upgrade profile in the Docker Compose configuration, and adjusting both a variable declaration and chain parameter setup in the E2E runner. These modifications conditionally control which tests are run and how chain parameters are configured during upgrades.

Changes

File(s) Change Summary
Makefile, changelog.md Added E2E_ARGS="--test-solana" in the start-upgrade-test target; added a changelog entry noting that Solana tests will run during upgrades.
cmd/zetae2e/local/local.go Removed specific Solana and SPL test cases from the static test slice and conditionally appended them only when not in an upgrade state.
contrib/localnet/docker-compose.yml Introduced a new upgrade profile for the solana service to enable its inclusion during upgrade scenarios.
e2e/runner/contract_upgrade_solana.go, e2e/runner/setup_solana.go Changed variable initialization in the VerifyUpgradedInstruction method and added a conditional block in ensureSolanaChainParams to omit ConfirmationParams when an upgrade is running.

Sequence Diagram(s)

sequenceDiagram
  participant Runner as E2ERunner
  participant Local as localE2ETest
  participant Deployer as deployerRunner

  Runner->>Local: Call localE2ETest()
  Local->>Deployer: Check upgrade state (IsUpgrade)
  alt Not in upgrade
      Local->>Local: Append Solana & SPL tests
  else In upgrade
      Local->>Local: Skip appending Solana & SPL tests
  end
  Local->>Runner: Return test list
Loading
sequenceDiagram
  participant Runner as E2ERunner
  participant Setup as ensureSolanaChainParams()
  participant UpgradeChk as IsRunningUpgrade

  Runner->>Setup: Invoke ensureSolanaChainParams()
  Setup->>UpgradeChk: Evaluate upgrade state
  alt Running upgrade
      Setup->>Setup: Create chainParams without ConfirmationParams
  else Normal operation
      Setup->>Setup: Use chainParams with ConfirmationParams
  end
  Setup->>Runner: Return updated chainParams
Loading

Possibly related PRs

Suggested labels

no-changelog, SOLANA_TESTS, UPGRADE_TESTS, UPGRADE_IMPORT_MAINNET_TESTS

Suggested reviewers

  • ws4charlie
  • gartnera
  • lumtis
✨ Finishing Touches
  • 📝 Generate Docstrings

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 generate docstrings to generate docstrings for this 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.

@kingpinXD kingpinXD marked this pull request as ready for review February 26, 2025 22:57
@kingpinXD kingpinXD added the UPGRADE_TESTS Run make start-upgrade-tests label Feb 26, 2025
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

🧹 Nitpick comments (2)
e2e/runner/setup_solana.go (1)

183-202: Added compatibility for v28 during upgrade tests.

The conditional logic handles the difference in chain parameter structure for version 28, which does not support ConfirmationParams. However, there's significant code duplication here.

Consider refactoring to reduce duplication by using a common structure and only modifying the necessary fields:

chainParams := &observertypes.ChainParams{
    ChainId:                     chainID,
    ConfirmationCount:           32,
    ZetaTokenContractAddress:    constant.EVMZeroAddress,
    ConnectorContractAddress:    constant.EVMZeroAddress,
    Erc20CustodyContractAddress: constant.EVMZeroAddress,
    GasPriceTicker:              5,
    WatchUtxoTicker:             0,
    InboundTicker:               2,
    OutboundTicker:              2,
    OutboundScheduleInterval:    2,
    OutboundScheduleLookahead:   5,
    BallotThreshold:             observertypes.DefaultBallotThreshold,
    MinObserverDelegation:       observertypes.DefaultMinObserverDelegation,
    IsSupported:                 true,
    GatewayAddress:              r.GatewayProgram.String(),
}

if !r.IsRunningUpgrade() {
    chainParams.ConfirmationParams = &observertypes.ConfirmationParams{
        SafeInboundCount:  32,
        SafeOutboundCount: 32,
    }
}
cmd/zetae2e/local/local.go (1)

419-428: Well-organized conditional test inclusion.

The implementation conditionally adds Solana tests based on the upgrade state, ensuring newer functionality is only tested in non-upgrade scenarios. This approach maintains backwards compatibility during upgrades while enabling comprehensive testing in standard environments.

Consider enhancing the comment to explicitly explain why these specific tests are excluded during upgrades. For example:

-        // Add newly added tests(v29) if not running an upgrade
+        // These tests verify functionality introduced in v29 that isn't supported
+        // when upgrading from previous versions, so they're only run in non-upgrade scenarios
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e5c732 and 301d29d.

📒 Files selected for processing (6)
  • Makefile (1 hunks)
  • changelog.md (1 hunks)
  • cmd/zetae2e/local/local.go (1 hunks)
  • contrib/localnet/docker-compose.yml (1 hunks)
  • e2e/runner/contract_upgrade_solana.go (1 hunks)
  • e2e/runner/setup_solana.go (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • e2e/runner/contract_upgrade_solana.go
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.go`: Review the Go code, point out issues relative to ...

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

  • e2e/runner/setup_solana.go
  • cmd/zetae2e/local/local.go
🪛 GitHub Actions: e2e
Makefile

[error] 357-357: make: *** [Makefile:357: start-upgrade-test] Error 18

🔇 Additional comments (3)
changelog.md (1)

44-44: Accurate documentation of new testing capability.

This change correctly documents the new functionality of running Solana tests during upgrade testing, which aligns with the implementation changes in other files.

Makefile (1)

359-359:

❓ Verification inconclusive

Environment variable configuration for Solana upgrade tests.

This addition enables Solana tests during the upgrade process by setting the appropriate E2E_ARGS environment variable. Note that the pipeline failures show an error on this line, which may need investigation.


🏁 Script executed:

#!/bin/bash
# Check if the pipeline failure is due to a legitimate issue with this change
grep -B 5 -A 5 "Error 18" ../contrib/localnet/scripts/upgrade-test.sh || echo "Unable to find error context"

Length of output: 215


Action Required: Verify Pipeline Configuration for Solana Upgrade Tests

The export E2E_ARGS="--test-solana" line in the Makefile correctly sets the environment variable needed to enable Solana-specific upgrade tests. However, our investigation did not locate the expected test script at ../contrib/localnet/scripts/upgrade-test.sh—the grep command resulted in a "No such file or directory" message. This implies that the pipeline error referencing "Error 18" may stem from an outdated or misconfigured file path rather than a problem with the Makefile change itself.

  • Action Items:
    • Confirm whether the test script has been moved, renamed, or removed from the repository.
    • Review and update the pipeline configuration if necessary to ensure it is referencing the correct file path.
    • If the file should exist, investigate why it’s missing from the codebase.

The code change for enabling Solana tests appears valid, but please verify the pipeline configuration separately.

contrib/localnet/docker-compose.yml (1)

225-226: Added Solana service to upgrade profile.

The addition of the 'upgrade' profile to the Solana service is necessary to ensure the container is started during upgrade tests. This change correctly enables the infrastructure required for Solana testing in upgrade scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:cli UPGRADE_TESTS Run make start-upgrade-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for solana in e2e upgrade tests
1 participant