testcontainers / testcontainers/testcontainers-java
Add int Testcontainers.exposeHostPort(int)
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
Chaining allows us to use a lambda without a body, currently we can't..
.withDockerfileFromBuilder(builder -> {
// TODO: would be nicer if Testcontainers.exposeHostPort(int) and returned the input
Testcontainers.exposeHostPorts(zipkin.httpPort());
builder.from(CassandraRule.IMAGE_NAME.asCanonicalNameString())
--snip--
// Overwrite JAVA_OPTS to enable tracing and point it at the test Zipkin endpoint
.env("JAVA_OPTS", "-XX:+ExitOnOutOfMemoryError"
--snip--
+ " -Dzipkin.http_endpoint=http://host.testcontainers.internal:"
+ zipkin.httpPort() + "/api/v2/spans");
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 locating the Testcontainers.exposeHostPorts(int) entry point referenced in the issue and inspect how it is used in the Dockerfile builder chain. Add the singular overload so the supplied port can be used in a bodyless lambda, then verify that the existing chaining example compiles and behaves as shown.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100