Class LocalstackDockerExtension

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.Extension

    public class LocalstackDockerExtension
    extends java.lang.Object
    implements org.junit.jupiter.api.extension.BeforeAllCallback
    JUnit test runner that automatically pulls and runs the latest localstack docker image and then terminates when tests are complete. Having docker installed is a prerequisite for this test runner to execute. If docker is not installed in one of the default locations (C:\program files\docker\docker\resources\bin\docker.exe, C:\program files\docker\docker\resources\docker.exe, usr/local/bin/docker or usr/bin/docker) then use the DOCKER_LOCATION environment variable to specify the location. Since ports are dynamically allocated, the external port needs to be resolved based on the default localstack port. The hostname defaults to localhost, but in some environments that is not sufficient, so the HostName can be specified by using the LocalstackDockerProperties annotation with an IHostNameResolver.
    Author:
    Alan Bevier, Patrick Allain, Omar Khammassi
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext context)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocalstackDockerExtension

        public LocalstackDockerExtension()
    • Method Detail

      • beforeAll

        public void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext context)
                       throws java.lang.Exception
        Specified by:
        beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback
        Throws:
        java.lang.Exception