-
Notifications
You must be signed in to change notification settings - Fork 246
refactor(e2e): extract shared test helpers to DockerTestSuite #3017
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
Conversation
Extract common EVM test infrastructure to reusable helpers: - RethSetup struct and SetupRethNode() for Reth node setup - SetupCelestiaAndDABridge() returns DA address - WaitForEVMHealthy() for evmsingle health checks - SetupEthClient() creates and verifies eth client - WaitForTxIncluded() waits for transaction inclusion Refactor EVMSingleUpgradeTestSuite to use the shared helpers, reducing code duplication and enabling future test reuse.
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
|
Claude finished @chatton's task in 1m 39s —— View job Code Review CompleteI've performed a comprehensive review of this refactoring PR. Overall, this is excellent work that significantly improves code organization and reusability. The extraction of common test infrastructure into SummaryChanges:
Net Impact: +135 additions, -138 deletions across 2 files Detailed Review🟢 Strengths1. Excellent Abstraction DesignThe new helpers follow the single responsibility principle perfectly:
Each function is focused, testable, and reusable. 2. Strong Return Value DesignThe type RethSetup struct {
Node *reth.Node
EngineURL string // internal container-to-container URL
EthURL string // internal container-to-container URL
EthURLExternal string // host-accessible URL
JWTSecret string
GenesisHash string
}
3. Improved Test ReadabilityThe refactored test (upgrade_test.go:55-98) reads like documentation: s.Run("setup_celestia_and_DA_bridge", func() {
s.daAddress = s.SetupCelestiaAndDABridge(ctx)
s.T().Log("DA bridge node started and funded")
})Before: 20+ lines of setup code 4. Proper Resource Management
5. Good Go Idioms
🟡 Minor Issues & Suggestions1. Unhandled Error in
|
| Aspect | Rating | Notes |
|---|---|---|
| Architecture | ⭐⭐⭐⭐⭐ | Excellent abstraction and separation of concerns |
| Error Handling | ⭐⭐⭐⭐ | Very good, one minor unhandled error |
| Reusability | ⭐⭐⭐⭐⭐ | Perfect for future compatibility tests |
| Readability | ⭐⭐⭐⭐⭐ | Significantly improved test clarity |
| Go Idioms | ⭐⭐⭐⭐⭐ | Follows community best practices |
| Documentation | ⭐⭐⭐⭐ | Good inline comments, could add godoc |
Recommendation
✅ APPROVE - This refactoring achieves its goal and sets up the codebase well for future compatibility tests. The single minor issue with error handling is not blocking and can be addressed in a follow-up if desired.
The code quality is high, the abstraction choices are sound, and the implementation follows Go best practices. This is exactly the kind of refactoring that makes a codebase more maintainable.
Summary of ChangesHello @chatton, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on refactoring the end-to-end (e2e) tests by extracting common infrastructure setup and utility functions into reusable helpers within the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively refactors common test helper functionality into the DockerTestSuite, which significantly cleans up the EVMSingleUpgradeTestSuite and improves code reuse. The extraction of setup logic for Reth, Celestia, and DA bridges into shared helpers is well-executed. I have one minor suggestion to improve error handling in one of the new helper functions.
| req, _ := http.NewRequestWithContext(ctx, http.MethodGet, healthURL, nil) | ||
| resp, err := http.DefaultClient.Do(req) | ||
| if err != nil { | ||
| return false | ||
| } | ||
| defer resp.Body.Close() | ||
| return resp.StatusCode == http.StatusOK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good practice to handle all errors, even those that seem unlikely. The error from http.NewRequestWithContext is currently ignored. Checking it would make the code more robust. The suggested change also renames an error variable to avoid a redeclaration conflict that would arise from handling this new error.
req, reqErr := http.NewRequestWithContext(ctx, http.MethodGet, healthURL, nil)
if reqErr != nil {
return false
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return false
}
defer resp.Body.Close()
return resp.StatusCode == http.StatusOK
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3017 +/- ##
==========================================
- Coverage 55.66% 55.55% -0.12%
==========================================
Files 116 116
Lines 11477 11477
==========================================
- Hits 6389 6376 -13
- Misses 4389 4401 +12
- Partials 699 700 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Overview
part of #3019
This PR extracts out some common helper functionality that will be able to be used in some follow up compatibility tests.