testcontainers / testcontainers/testcontainers-java
Add getMappedPort(Integer originalPort, InternetProtocol protocol)
Open
Beginner friendly
Nobody has claimed this yet.
good first issue
resolution/acknowledged
type/feature
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
It will just look so much nicer in my test than
genericContainer.getContainerInfo().getNetworkSettings().getPorts().getBindings().get(new ExposedPort(originalPort, protocol))[0].getHostPortSpec()
I think it has something to do with the law of demeter.
But in all fairness root cause is https://github.com/moby/moby/issues/4635
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the GenericContainer API around getContainerInfo(), NetworkSettings, bindings, and ExposedPort. Add the requested getMappedPort(Integer originalPort, InternetProtocol protocol) entry point so callers can obtain the mapped host port without navigating the nested network objects, then verify the behavior with the relevant container networking tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100