1111import io .eigr .spawn .test .actors .JoeActor ;
1212import io .eigr .spawn .test .actors .StatelessNamedActor ;
1313import io .eigr .spawn .test .actors .UnNamedActor ;
14- import org .junit .jupiter .api .AfterAll ;
15- import org .junit .jupiter .api .BeforeAll ;
1614import org .slf4j .Logger ;
1715import org .slf4j .LoggerFactory ;
1816import org .testcontainers .Testcontainers ;
1917import org .testcontainers .containers .GenericContainer ;
18+ import org .testcontainers .containers .wait .strategy .LogMessageWaitStrategy ;
2019import org .testcontainers .utility .DockerImageName ;
2120
22- abstract class AbstractContainerBaseTest {
21+ public abstract class AbstractContainerBaseTest {
2322
2423 private static final Logger log = LoggerFactory .getLogger (AbstractContainerBaseTest .class );
2524 private static GenericContainer <?> SPAWN_CONTAINER ;
@@ -29,13 +28,14 @@ abstract class AbstractContainerBaseTest {
2928 protected static Spawn spawnSystem ;
3029 protected static final String spawnSystemName = "spawn-system-test" ;
3130
32- @ BeforeAll
33- public static void setup () {
31+ static {
3432 Testcontainers .exposeHostPorts (8091 );
3533
3634 SPAWN_CONTAINER = new GenericContainer <>(DockerImageName .parse (spawnProxyImage ))
3735 .withCreateContainerCmdModifier (e -> e .withHostConfig (HostConfig .newHostConfig ()
3836 .withPortBindings (PortBinding .parse ("9004:9004" ))))
37+ .waitingFor (new LogMessageWaitStrategy ()
38+ .withRegEx (".*Proxy Application started successfully.*" ))
3939 .withEnv ("SPAWN_PROXY_LOGGER_LEVEL" , "DEBUG" )
4040 .withEnv ("SPAWN_STATESTORE_KEY" , "3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE=" )
4141 .withEnv ("PROXY_ACTOR_SYSTEM_NAME" , spawnSystemName )
@@ -76,11 +76,5 @@ public static void setup() {
7676 throw new RuntimeException (e );
7777 }
7878 }
79-
80- @ AfterAll
81- public static void teardown () {
82- SPAWN_CONTAINER .stop ();
83-
84- }
8579}
8680
0 commit comments