-
Notifications
You must be signed in to change notification settings - Fork 21
Refactor test infrastructure to use centralized container management #245
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
|
🤖 Claude Code Review Status: Complete No critical issues found. The refactoring successfully centralizes container management and eliminates substantial boilerplate code. Minor Observation: Positive Changes:
|
| containerManager, err = containers.NewContainerManager(containers.UTXOStoreType(opts.UTXOStoreType)) | ||
| require.NoError(t, err, "Failed to create container manager") | ||
|
|
||
| utxoStoreURL, err := containerManager.Initialize(ctx) |
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.
Resource leak: If daemon initialization fails after this point, the container won't be cleaned up because td.Stop() is never called. Register cleanup with t.Cleanup() immediately after container initialization to prevent leaks.
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.
✅ Fixed: Cleanup is now registered with t.Cleanup() immediately after container initialization (line 332-336).
|
|
||
| cm.postgresContainer = postgresC | ||
|
|
||
| connStr, err := postgresC.ConnectionString(ctx) |
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.
Potential resource leak: If ConnectionString() (line 157) or url.Parse() (line 185) fails after the container is successfully created, the PostgreSQL container will not be terminated. Consider assigning cm.cleanupFunc immediately after line 155 (before operations that might fail) to ensure the container is cleaned up on all error paths.
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.
Still an issue in current code. The cleanupFunc should be moved to line 156 (right after cm.postgresContainer assignment) to ensure cleanup happens on all error paths, including the ConnectionString() failure at line 158.
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.
✅ Fixed in current code: The cleanupFunc is now correctly set at line 158, immediately after the container assignment (line 155), which ensures cleanup happens even if ConnectionString() or url.Parse() fails. The issue is resolved.
|



No description provided.