Class TestContainers

java.lang.Object
io.micronaut.testresources.testcontainers.TestContainers

public final class TestContainers extends Object
An utility class used to manage the lifecycle of test containers. We preserve the list of open containers in-memory in a static field, because we want them to live as long as the VM is live. It is possible to explicitly shutdown all containers by calling the closeAll() method.
  • Method Details

    • startingContainers

      public static List<String> startingContainers()
      Returns the list of containers which are being started.
      Returns:
      the list of containers
    • pullingContainers

      public static List<String> pullingContainers()
      Returns the list of containers which are being pulled.
      Returns:
      the list of containers
    • listAll

      public static Map<Scope,List<org.testcontainers.containers.GenericContainer<?>>> listAll()
      Lists all containers.
      Returns:
      the containers
    • listByScope

      public static Map<Scope,List<org.testcontainers.containers.GenericContainer<?>>> listByScope(String id)
    • network

      public static org.testcontainers.containers.Network network(String name)
    • closeAll

      public static boolean closeAll()
    • getNetworks

      public static Map<String,org.testcontainers.containers.Network> getNetworks()
    • closeScope

      public static boolean closeScope(String id)
    • findByRequestedProperty

      public static List<org.testcontainers.containers.GenericContainer<?>> findByRequestedProperty(Scope scope, String property)