skyho
skyho

Reputation: 1903

How can spring boot application instances be packaged in testcontainers

  1. there are several instances of applications that interact with each other (microservices)
  2. There are docker images of these spring boot apps
  3. Is it possible to use these docker images in test container to deploy in tests and how is it possible to do this

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

Answers (1)

Eddú Meléndez
Eddú Meléndez

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

Related Questions