You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RedpandaContainer.withListener accepts a Supplier<String> and parses it in order to create a Supplier<Listener> to be added to listenersValueSupplier, which is used later in configure and containerIsStarting.
The parsing is happening across three operations -
The string is split with the colon character into its two parts (host:port)
The port is converted into an int
A Listener object is constructed from the host and converted port
The problem is that the first operations happens outside of the Supplier lambda added to listenersValueSupplier, which effectively means the Supplier<String> passed to withListener isn't really lazy as it is meant to be.
Hi @YanivKunda, the ideal workflow would be to raise an issue or discussion, triage it and then raise the PR. Since the PR was raised first then there is no need to raise the issue later. I'm closing it in favor of #9173
Module
Redpanda
Testcontainers version
1.20.1
Using the latest Testcontainers version?
Yes
Host OS
Mac
Host Arch
ARM
Docker version
Client: Version: 27.1.1 API version: 1.46 Go version: go1.21.12 Git commit: 6312585 Built: Tue Jul 23 19:54:12 2024 OS/Arch: darwin/arm64 Context: desktop-linux Server: Docker Desktop 4.33.0 (160616) Engine: Version: 27.1.1 API version: 1.46 (minimum version 1.24) Go version: go1.21.12 Git commit: cc13f95 Built: Tue Jul 23 19:57:14 2024 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.7.19 GitCommit: 2bf793ef6dc9a18e00cb12efb64355c2c9d5eb41 runc: Version: 1.7.19 GitCommit: v1.1.13-0-g58aa920 docker-init: Version: 0.19.0 GitCommit: de40ad0
What happened?
RedpandaContainer.withListener
accepts aSupplier<String>
and parses it in order to create aSupplier<Listener>
to be added tolistenersValueSupplier
, which is used later inconfigure
andcontainerIsStarting
.The parsing is happening across three operations -
Listener
object is constructed from the host and converted portThe problem is that the first operations happens outside of the
Supplier
lambda added to listenersValueSupplier, which effectively means theSupplier<String>
passed towithListener
isn't really lazy as it is meant to be.Relevant log output
No response
Additional Information
A fix is available in #9173
The text was updated successfully, but these errors were encountered: