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(tests/systemtests): remove v2 checks #23098

Merged
merged 13 commits into from
Jan 9, 2025
Merged

test(tests/systemtests): remove v2 checks #23098

merged 13 commits into from
Jan 9, 2025

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Dec 26, 2024

Description

This pr removes v2 checks in system tests as there is no more v1 in the repo


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • Documentation

    • Updated system tests README with instructions to copy a new binary file.
  • Tests

    • Simplified version-specific test logic across multiple test files.
    • Removed conditional version checks in system tests, ensuring tests run regardless of application version.
    • Standardized test execution approach for different system versions.
  • Dependencies

    • Updated go.mod with new dependency versions.
    • Added a new indirect dependency and adjusted existing ones.
    • Updated cosmossdk.io/math to version 1.5.0.

The changes primarily focus on streamlining test infrastructure and dependency management.

Copy link
Contributor

coderabbitai bot commented Dec 26, 2024

📝 Walkthrough

Walkthrough

This pull request involves simplifying system tests across multiple test files by removing version-specific conditional checks. The changes primarily focus on eliminating systest.IsV2() checks in various test files, ensuring consistent test execution regardless of the application version. The modifications span several test files including bankv2_test.go, cometbft_client_test.go, group_test.go, mint_test.go, snapshots_test.go, staking_test.go, and unordered_tx_test.go. Additionally, the go.mod file was updated with dependency version changes.

Changes

File Change Summary
tests/systemtests/README.md Updated binary copy instructions from ./build/simd to ./build/simdv2
tests/systemtests/bankv2_test.go, tests/systemtests/cometbft_client_test.go, tests/systemtests/group_test.go, tests/systemtests/mint_test.go, tests/systemtests/snapshots_test.go, tests/systemtests/staking_test.go, tests/systemtests/unordered_tx_test.go Removed version-specific conditional checks (systest.IsV2())
tests/systemtests/go.mod Updated cosmossdk.io/math to v1.5.0, added new indirect dependency github.com/cockroachdb/apd/v3 v3.2.1, downgraded github.com/creachadair/tomledit from v0.0.27 to v0.0.26

Possibly related PRs

Suggested labels

C:server/v2, C:server/v2 stf, C:Store

Suggested reviewers

  • tac0turtle
  • julienrbrt
  • sontrinh16
  • kocubinski
  • testinginprod

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e329870 and 11a76ee.

⛔ Files ignored due to path filters (1)
  • tests/systemtests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • tests/systemtests/go.mod (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/systemtests/go.mod
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-simapp-v2
  • GitHub Check: test-system-v2
  • GitHub Check: test-integration
  • GitHub Check: build (amd64)
  • GitHub Check: Analyze
  • GitHub Check: golangci-lint
  • GitHub Check: Summary

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. (Beta)
  • @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.

@aljo242 aljo242 marked this pull request as ready for review January 8, 2025 16:51
@aljo242 aljo242 requested a review from a team as a code owner January 8, 2025 16:51
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: 1

🧹 Nitpick comments (4)
tests/systemtests/unordered_tx_test.go (1)

17-18: Consider creating a tracking issue for the skipped test

The TODO comment indicates that unordered transaction handling is not yet implemented in v2. To ensure this doesn't get overlooked, we should track this technical debt.

Would you like me to create a GitHub issue to track the implementation of unordered transaction handling in v2? This will help ensure the test doesn't remain permanently skipped.

tests/systemtests/snapshots_test.go (1)

30-31: Consider making store commands configurable

Hardcoding the command and restorable directories might make the test less maintainable. Consider making these configurable through test parameters or environment variables.

-command := "store"
-restoreableDirs := []string{fmt.Sprintf("%s/data/application.db", node0Dir), fmt.Sprintf("%s/data/ss", node0Dir)}
+const (
+    defaultStoreCommand = "store"
+    defaultAppDBDir    = "data/application.db"
+    defaultSSDir       = "data/ss"
+)
+command := os.Getenv("STORE_COMMAND", defaultStoreCommand)
+restoreableDirs := []string{
+    filepath.Join(node0Dir, defaultAppDBDir),
+    filepath.Join(node0Dir, defaultSSDir),
+}
tests/systemtests/group_test.go (2)

66-68: Extract API endpoints to constants

The API endpoint URLs are hardcoded in multiple places. Consider extracting these to constants to improve maintainability and reduce duplication.

+const (
+    groupPoliciesEndpoint = "/cosmos/group/v1/group_policies_by_group/%s"
+    voteByProposalEndpoint = "/cosmos/group/v1/vote_by_proposal_voter/%s/%s"
+)
-groupPoliciesResp := string(systest.GetRequest(t, fmt.Sprintf("%s/cosmos/group/v1/group_policies_by_group/%s", baseurl, groupId)))
+groupPoliciesResp := string(systest.GetRequest(t, fmt.Sprintf("%s%s", baseurl, fmt.Sprintf(groupPoliciesEndpoint, groupId))))

119-120: Use the extracted API endpoint constant here as well

This endpoint construction duplicates the URL pattern. Use the constant defined above to maintain consistency.

-voteResp := string(systest.GetRequest(t, fmt.Sprintf("%s/cosmos/group/v1/vote_by_proposal_voter/%s/%s", baseurl, proposalId, valAddr)))
+voteResp := string(systest.GetRequest(t, fmt.Sprintf("%s%s", baseurl, fmt.Sprintf(voteByProposalEndpoint, proposalId, valAddr))))
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d634326 and 62ec5cf.

⛔ Files ignored due to path filters (1)
  • tests/systemtests/go.sum is excluded by !**/*.sum
📒 Files selected for processing (12)
  • systemtests/system.go (1 hunks)
  • systemtests/test_runner.go (1 hunks)
  • systemtests/testnet_init.go (2 hunks)
  • tests/systemtests/README.md (1 hunks)
  • tests/systemtests/bankv2_test.go (0 hunks)
  • tests/systemtests/cometbft_client_test.go (1 hunks)
  • tests/systemtests/go.mod (2 hunks)
  • tests/systemtests/group_test.go (2 hunks)
  • tests/systemtests/mint_test.go (0 hunks)
  • tests/systemtests/snapshots_test.go (3 hunks)
  • tests/systemtests/staking_test.go (1 hunks)
  • tests/systemtests/unordered_tx_test.go (1 hunks)
💤 Files with no reviewable changes (2)
  • tests/systemtests/bankv2_test.go
  • tests/systemtests/mint_test.go
🧰 Additional context used
📓 Path-based instructions (10)
systemtests/test_runner.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

tests/systemtests/README.md (2)

Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

systemtests/system.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

tests/systemtests/staking_test.go (3)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

systemtests/testnet_init.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

tests/systemtests/unordered_tx_test.go (3)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

tests/systemtests/snapshots_test.go (3)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

tests/systemtests/cometbft_client_test.go (3)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

tests/systemtests/group_test.go (3)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

tests/systemtests/go.mod (1)

Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: Summary
🔇 Additional comments (8)
systemtests/test_runner.go (1)

26-26: Verify binary availability in CI/CD pipeline

The default binary has been changed from "simd" to "simdv2". Ensure that this binary is consistently available in all environments where tests are run.

✅ Verification successful

Binary change is properly supported

The change from "simd" to "simdv2" as the default binary is well-supported by the codebase:

  • Binary is built via tests/systemtests/Makefile and scripts/build/build.mk
  • Complete implementation exists in simapp/v2/simdv2/
  • Multiple test files already reference this binary
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if simdv2 binary exists in common build locations
echo "Checking for simdv2 binary..."
for dir in "./build" "./" "../build" "../../build"; do
  if [ -f "${dir}/simdv2" ]; then
    echo "Found simdv2 in ${dir}"
    exit 0
  fi
done
echo "simdv2 binary not found in common locations"
exit 1

Length of output: 498


Script:

#!/bin/bash
# Check for Makefile and build scripts
echo "=== Checking build configurations ==="
fd Makefile
fd "build.*\.sh"

echo -e "\n=== Checking for simdv2 references in build files ==="
rg "simdv2" -l --type make --type sh

echo -e "\n=== Checking for simdv2 references in test files ==="
rg "simdv2" --type go -l

Length of output: 1309

tests/systemtests/cometbft_client_test.go (1)

30-30: Clean and consistent query implementation!

The direct query without version checks simplifies the code while maintaining functionality.

tests/systemtests/README.md (1)

28-28: Documentation accurately reflects binary name change!

The update to use simdv2 keeps the documentation in sync with the codebase changes.

systemtests/testnet_init.go (2)

74-74: LGTM! Simplified command-line argument handling.

The removal of version-specific branching logic and consistent application of the minimum gas prices flag aligns with the PR objective.


120-120: LGTM! Consistent with previous changes.

The modification maintains consistency with SingleHostTestnetCmdInitializer and successfully removes version-specific logic.

tests/systemtests/go.mod (2)

175-175: LGTM! Appropriate module replacement.

The replace directive correctly points to the local systemtests directory, which is essential for local development and testing.


6-6: Verify compatibility with math v1.5.0.

Please ensure that the upgrade from v1.4.0 to v1.5.0 doesn't introduce any breaking changes.

✅ Verification successful

Upgrade to math v1.5.0 appears safe to proceed

The changelog shows the upgrade primarily adds a new GDA-based decimal type while maintaining backward compatibility with existing functionality. No breaking changes are documented between v1.4.0 and v1.5.0.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for breaking changes in math package
gh api repos/cosmos/cosmos-sdk/releases/tags/math/v1.5.0 --jq '.body' | grep -i "breaking changes"

Length of output: 123


Script:

#!/bin/bash
# Try to find the correct repository and check for release information
echo "Checking repository structure:"
fd -t f "CHANGELOG|BREAKING_CHANGES|RELEASES" -i

echo -e "\nChecking go.mod for repository information:"
rg "cosmossdk.io/math" -A 2 -B 2

echo -e "\nTrying to find the actual repository:"
go mod download -json cosmossdk.io/math@v1.5.0 2>/dev/null | jq .

Length of output: 66101


Script:

#!/bin/bash
# Check the math package's changelog
echo "=== Checking math package changelog ==="
if [ -f "math/CHANGELOG.md" ]; then
    cat math/CHANGELOG.md
fi

echo -e "\n=== Checking for version tags ==="
git tag | grep "math/v1." | sort -V

Length of output: 8457

systemtests/system.go (1)

Line range hint 736-744: LGTM! Removal of version check aligns with PR objective.

The unconditional configuration of app.toml for all nodes simplifies the code and aligns with the PR objective of removing version-specific checks. The configuration correctly sets up the necessary service addresses for each node.

Let's verify that there are no remaining version-specific configurations in the test files:

✅ Verification successful

Version check removal verified, no remaining conditional version checks found

The removal of the version check in app.toml configuration is safe. The remaining version-related code in the codebase serves different purposes (API imports, CLI commands, binary naming) and doesn't contain conditional logic that would affect the system's behavior based on versions.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining version-specific configurations or checks
# Test: Search for version-related conditionals. Expect: No remaining version checks.

# Look for any remaining version checks in test files
rg -g '*.go' -i '(isv2|v1|v2)\s*\(\s*\)' tests/systemtests/

Length of output: 61


Script:

#!/bin/bash
# Search for version-related patterns in the correct directory
echo "=== Searching for version checks ==="
rg -g '*.go' -i '(v1|v2|version)' systemtests/

echo -e "\n=== Searching for version-related constants and types ==="
ast-grep --pattern 'const $_Version$_ = $_'
ast-grep --pattern 'var $_Version$_ = $_'

echo -e "\n=== Checking config-related version patterns ==="
rg -g '*.go' -i '(isv[0-9]|version.*check|check.*version)' .

Length of output: 5089

Comment on lines +45 to +46
rsp = cli.CustomQuery("q", "comet", "block-results", gjson.Get(rsp, "height").String())

Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Remove unnecessary "q" prefix from query command

The "q" prefix in cli.CustomQuery("q", "comet", "block-results", ...) is inconsistent with both the official command pattern and other test files. Remove the prefix to match the standard format seen in cometbft_client_test.go.

🔗 Analysis chain

Verify query path consistency.

While removing version checks simplifies the code, the query path comet block-results differs from the pattern seen in other files (e.g., comet status in cometbft_client_test.go). Please verify if this should be standardized.

Run this script to check query path consistency across the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistency in comet query paths
# Test: Search for all comet query patterns to ensure consistency

echo "Searching for comet query patterns:"
rg -A 1 'CustomQuery\("q",\s*"comet"'

Length of output: 278


Script:

#!/bin/bash
# Search for all query patterns related to comet/cometbft
echo "Searching for all comet/cometbft related queries:"
rg -i "custom.*query.*comet|comet.*status|block.*results" -A 2

# Also search for specific file mentioned in the comment
echo -e "\nChecking cometbft_client_test.go specifically:"
fd "cometbft_client_test.go" --exec cat {}

Length of output: 29481

@aljo242
Copy link
Collaborator

aljo242 commented Jan 8, 2025

make test-system now works again locally

systemtests/system.go Outdated Show resolved Hide resolved
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

ACK

Copy link
Contributor

@alpe alpe left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup! 💪
The changes look good.

@julienrbrt julienrbrt added this pull request to the merge queue Jan 9, 2025
@julienrbrt julienrbrt changed the title chore(systemtests): remove v2 checks refactor(systemtests): remove v2 checks Jan 9, 2025
@julienrbrt julienrbrt changed the title refactor(systemtests): remove v2 checks test(tests/systemtests): remove v2 checks Jan 9, 2025
Merged via the queue into main with commit cf22169 Jan 9, 2025
81 of 82 checks passed
@julienrbrt julienrbrt deleted the marko/systemtests2 branch January 9, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants