-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Use hostname instead of hardcoded "name" string #1335
Use hostname instead of hardcoded "name" string #1335
Conversation
modules/toxiproxy/src/main/java/org/testcontainers/containers/ToxiproxyContainer.java
Outdated
Show resolved
Hide resolved
Imagine creating multiple proxies for the same host, but different port
…On Sat, 23 Mar 2019 at 15:21, worldtiki ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
modules/toxiproxy/src/main/java/org/testcontainers/containers/ToxiproxyContainer.java
<#1335 (comment)>
:
> @@ -86,7 +86,7 @@ public ContainerProxy getProxy(String hostname, int port) {
throw new IllegalStateException("Maximum number of proxies exceeded");
}
- final Proxy proxy = client.createProxy("name", "0.0.0.0:" + toxiPort, upstream);
+ final Proxy proxy = client.createProxy(hostname, "0.0.0.0:" + toxiPort, upstream);
Hi @bsideup <https://github.com/bsideup>! Thanks for the suggestion.
Happy to accept it, but I'm not quite sure why we would want to have the
port as part of the name. Is the hostname not enough?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1335 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABAIit4-a0p4E8o0iJdIwh9bvRsnGdwWks5vZjh2gaJpZM4cE7tI>
.
|
…ToxiproxyContainer.java Co-Authored-By: worldtiki <worldtiki@gmail.com>
@worldtiki could you please add a test for this change? |
Damn, this is a clear bug, sorry. The Thanks for identifying, @worldtiki. |
I'll contribute a test to this, in the interests of time. |
I've added a simple test - no need for you to add one @worldtiki. |
@worldtiki thanks for spotting the bug and implementing the fix! 👍 We will release it today as a hotfix |
Proposal to use hostname instead of hardcoded string to allow for multiple proxies to be created.
In my use case I have multiple proxies: one for redis, another for a mock http server, etc.
With the current implementation, when I try to create the second proxy it fails with a "409 - proxy already exists".
This is because in the "getProxy" method we have the name of the proxy hardcoded to "name".
final Proxy proxy = client.createProxy("name", "0.0.0.0:" + toxiPort, upstream);
I am not sure if this requires a new test case with two proxies, and since it's the first time I'm contributing to this project I figured it would be better to get some feedback on the change before doing anything big.