Reputation: 1903
There is no need to take into account the time to work and initialization of such tests, this is not the main thing in this situation.
Upvotes: 2
Views: 119
Reputation: 6530
Testcontainers offers GenericContainer which allow you to use images in the registry. For example, let's say you have a image for your service called myorganization/greetings-service:2.0.0
which listen request in the port 8080. Then you can use:
GenericContainer container = new GenericContainer("myorganization/greetings-service:2.0.0")
.withExposedPort(8080)
.waitingFor(Wait.forHttp("/"));
and later you can get the host and port using container.getHost()
and container.getMappedPort(8080)
.
Hope this can help you
Upvotes: 2