spring-projects / spring-projects/spring-boot
Support ComposeContainer and DockerComposeContainer in Testcontainers integration
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
I'd like to define a new ConnectionDetails type for https://github.com/eclipse/kapua .
Eclipse Kapua can only be run via Docker compose. To achieve that, I run it successfully via org.testcontainers.containers.DockerComposeContainer.
I added a KapuaConnectionDetails:
public interface KapuaConnectionDetails extends ConnectionDetails {
String baseHttpUrl();
}
I would have expected to be able to plug DockerComposeContainer as source of ContainerConnectionDetailsFactory.
But the current signature of ContainerConnectionDetailsFactory is:
public abstract class ContainerConnectionDetailsFactory<C extends Container<?>, D extends ConnectionDetails>
implements ConnectionDetailsFactory<ContainerConnectionSource<C>, D> {}
Because of that, C excludes org.testcontainers.containers.DockerComposeContainer.
By looking at ContainerConnectionDetailsFactory, I didn't find a good reason for why C is restricted to Container<?>. ContainerConnectionDetailsFactory and its dependencies do not use Container<?>'s method. The only used method is from Startable, and it is only used after a cast check:
Could we relax C restriction to allow DockerComposeContainer usage?
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 in spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ContainerConnectionDetailsFactory.java, especially the cast check around lines 190–192. Trace the generic type through its dependencies and assess support for DockerComposeContainer and ComposeContainer; done means both can serve as sources for a ContainerConnectionDetailsFactory without breaking existing container support.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100