Class GenericTestContainerProvider

All Implemented Interfaces:
io.micronaut.core.order.Ordered, TestResourcesResolver, ToggableTestResourcesResolver

public class GenericTestContainerProvider extends Object implements ToggableTestResourcesResolver
A generic test containers provider. This provider is special in the sense that it requires user provided configuration in order to spawn containers. Therefore, the application configuration must contain entries under the "test-resources.containers" property prefix. A generic container is represented with a name, a container image, and exposes a number of ports. For example, imagine that a service requires an SMTP server to work property. Then it is likely that some configuration property needs to point to the server port. If that property is smtp.port, then it is possible to expose a test container which will resolve that property using the following configuration:
       image-name: ghusta/fakesmtp:2.0
         - smtp.port: 25
The mapped port from test containers will then be automatically be assigned to the smtp.port property, and the host name of the running test container will automatically be assigned to the property.