-
Notifications
You must be signed in to change notification settings - Fork 247
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
base: main
Are you sure you want to change the base?
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 2m 12s —— View job Code Review Complete ✅This is an excellent refactoring that successfully extracts common Docker E2E test infrastructure into reusable helpers. The changes reduce code duplication, improve maintainability, and set up a solid foundation for future tests. 🎯 Overall AssessmentStrengths:
Impact: This refactoring will significantly benefit future test development by providing ready-to-use infrastructure components. 📋 Detailed Review1. Code Quality & Architecture ✅Well-Structured Helpers:
Good Design Choices:
2. Error Handling & Resilience ✅Timeout Handling:
Network Reliability:
Considerations:
3. Resource Management & Cleanup 🔍Observation - Resource Lifecycle:
Recommendation: Consider documenting the cleanup strategy, especially for future test authors. For example, in // DockerTestSuite provides shared test infrastructure for Docker E2E tests.
// Resources created by helper methods are automatically cleaned up by the
// suite teardown or the tastora framework.
type DockerTestSuite struct {
// ...
}4. Testing Patterns ✅Excellent Test Organization:
Helper Composition: s.daAddress = s.SetupCelestiaAndDABridge(ctx) // Clear intent
s.reth = s.SetupRethNode(ctx) // Clean abstraction5. Performance & Concurrency ✅Efficient Polling:
No Concurrency Issues:
6. Documentation & Developer Experience ✅Good Documentation:
Minor Enhancement Opportunity: // SetupRethNode creates and starts a Reth node, waits for it to be ready,
// and returns connection details. Fails the test if the node doesn't start
// within 60 seconds.
func (s *DockerTestSuite) SetupRethNode(ctx context.Context) RethSetup {7. Security Considerations ✅No Security Issues Detected:
🔧 Specific Code Observations
|
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 57.98% 57.98%
=======================================
Files 110 110
Lines 10522 10522
=======================================
Hits 6101 6101
Misses 3770 3770
Partials 651 651
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
This PR extracts out some common helper functionality that will be able to be used in some follow up compatibility tests.