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

Add a getter for Toxiproxy exposed port #2513

Merged
merged 4 commits into from
May 1, 2020

Conversation

lutovich
Copy link
Contributor

@lutovich lutovich commented Apr 2, 2020

Hello!
I used Toxiproxy container to simulate a connection cut between two different Docker containers. It was a bit hard to determine what exposed port of the proxy corresponds to the exposed port of the target container. The code I ended up with did toxiproxy.getExposedPorts().get(1) which is not very intuitive because toxiproxy.getExposedPorts().get(0) is the proxy control port. Thus this PR. Hope it makes sense :)

Before this change, there only existed a getter for the mapped port which is useful for accessing the container from the host. A new getter can be useful when a Toxiproxy is setup between two different Docker containers to simulate network instabilities.

@bsideup bsideup added this to the next milestone Apr 3, 2020
@rnorth rnorth self-assigned this Apr 4, 2020
@rnorth
Copy link
Member

rnorth commented Apr 4, 2020

This is a good idea, but I just want to have a think about naming - I think that getExposedProxyPort() could be improved upon. It definitely deserves some inline Javadocs and a general documentation update to explain what this is for and when to use it 😄

@lutovich
Copy link
Contributor Author

lutovich commented Apr 5, 2020

Hi @rnorth, I agree, the name could be improved. What do you think about getDockerProxyPort or getContainerProxyPort?

@bsideup
Copy link
Member

bsideup commented Apr 12, 2020

@rnorth soft ping :)

@rnorth
Copy link
Member

rnorth commented Apr 12, 2020

Sorry - naming this is hard! I think personally I'd prefer getOriginalProxyPort or getDirectProxyPort. We should also have really solid documentation for when you should and shouldn't use this, both in the form of Javadocs and in the published markdown docs.

I think we should probably skip this for today's release - sorry that my delay in getting back slowed things down.

@rnorth rnorth removed this from the next milestone Apr 12, 2020
@lutovich
Copy link
Contributor Author

Thanks, getOriginalProxyPort sounds good to me. I'll change the PR and add docs this week.

@lutovich lutovich force-pushed the toxiproxy-exposed-port branch 3 times, most recently from e9641f0 to 53b4606 Compare April 19, 2020 12:16
Before this change, there only existed a getter for the mapped port which is
useful for accessing the container from the host. A new getter can be useful
when a Toxiproxy is setup between two different Docker containers to simulate
network instabilities.
Increase Jedis timeout from the default 2 seconds to 10 seconds.
This timeout value is used for both socket connect timeout and
socket read timeout. It looks like there is a delay between
creating a proxy and it being operational/accessible.
@lutovich
Copy link
Contributor Author

Hi @rnorth, this PR is now updated:

  • changed getter name from getExposedProxyPort to getOriginalProxyPort
  • added Javadocs and markdown docs for Toxyproxy port-related methods
  • attempted to fix flaky Toxiproxy tests by increasing the default Jedis timeout

Please re-review, thanks in advance :)

Copy link
Member

@rnorth rnorth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lutovich this is great. I just have a couple of tiny tweaks to suggest, then I think we're good to go 🙂

docs/modules/toxiproxy.md Outdated Show resolved Hide resolved
docs/modules/toxiproxy.md Outdated Show resolved Hide resolved
@lutovich
Copy link
Contributor Author

@rnorth thanks a lot! I committed all suggestions and squashed them into one commit

Copy link
Member

@rnorth rnorth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great - thanks for the contribution @lutovich!

@rnorth rnorth merged commit 6fb689f into testcontainers:master May 1, 2020
@lutovich lutovich deleted the toxiproxy-exposed-port branch May 2, 2020 16:50
quincy pushed a commit to quincy/testcontainers-java that referenced this pull request May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants