-
-
Notifications
You must be signed in to change notification settings - Fork 511
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
bug: fix leaking logs #2912
base: main
Are you sure you want to change the base?
bug: fix leaking logs #2912
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hi @KenxinKun thanks for the fix. I'd go with the default |
I'm wondering if this is another case for where having the default |
Indeed, that's what I think too. @KenxinKun if we change this PR to avoid a custom logger for the wait strategy, using the library's built-in (and to be changed soon) logging infra, then this would be ready to merge. Thanks! |
Sure no problem it makes sense, I'll try to change it tomorrow. I'm not at my laptop to check now, but I recall having an import circular dependency importing from the parent |
Yeah as I suspected the |
Morning! So I just tried briefly to untangle this but there's a significant number of uses of the Thoughts:
Let me know your thoughts @mdelapenya and @stevenh before I make further changes |
@KenxinKun sorry for making you going in circles with the wait and core packages 🤦 Indeed, the core uses wait so not possible. What you suggested about having a logger makes sense, and we do have it in our backlog for an eventual v1 work, please see https://github.com/orgs/testcontainers/projects/13/views/1?filterQuery=log&pane=issue&itemId=87805987. If you're interested in helping out with that, please let us know, as @stevenh would like to tackle the work on a more consistent logger, and you could collaborate in doing that. |
Sure happy to help, we use this library so much! |
What does this PR do?
Adds a new non-breaking option
func (hp *HostPortStrategy) WithLogger(logger Logging) *HostPortStrategy
.Why is it important?
The linked issue identified leaking logs when waiting for exposed/listening ports. The proposed implementation preserves the current behaviour when not providing the option.
Related issues
How to test this PR
New unit tests are included using mock implementations of the logger interface.
Follow-ups
Consider if the proposed implementation aligns well with the current designs for a centralised logger. I could not import the
testcontainers.Logging
interface due to circular import dependencies, so I had to define a local targeted interface.