Skip to content
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]: RedpandaContainer.withListener calls Supplier arg's .get() immediately #9215

Closed
YanivKunda opened this issue Sep 10, 2024 · 2 comments
Labels

Comments

@YanivKunda
Copy link

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 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 -

  1. The string is split with the colon character into its two parts (host:port)
  2. The port is converted into an int
  3. 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.

Relevant log output

No response

Additional Information

A fix is available in #9173

@eddumelendez
Copy link
Member

eddumelendez commented Sep 10, 2024

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

@eddumelendez eddumelendez closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2024
@YanivKunda
Copy link
Author

Thanks @eddumelendez, please let me know if there are any clarifications or action items needed from me in #9173.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants