File tree 5 files changed +42
-5
lines changed
everything-app/src/test/java/org/example/app
everything-jakarta-app/src/test/java/org/example/app
kafka-app/src/test/java/org/example/app
quarkus-app/src/test/java/org/example/app/it
5 files changed +42
-5
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ mvn clean install
56
56
57
57
NOTE: The first run will take longer due to downloading required container layers. Subsequent runs will be faster.
58
58
59
+ NOTE: If a container is consistantly timing out on your system you can set a longer timeout (in seconds) with the system property
60
+ ` microshed.testing.startup.timeout ` default value is 60 seconds.
61
+
62
+ NOTE: If a mockserver has started, but HTTP calls are consistantly timint out on your system you can set a longer timeout (in milliseconds)
63
+ with the system property ` mockserver.maxSocketTimeout ` default value is 120000 milliseconds.
64
+
59
65
### Tested with:
60
66
- OpenLiberty
61
67
- Wildfly
Original file line number Diff line number Diff line change 18
18
*/
19
19
package org .example .app ;
20
20
21
+ import java .time .Duration ;
22
+
21
23
import org .microshed .testing .SharedContainerConfiguration ;
22
24
import org .microshed .testing .testcontainers .ApplicationContainer ;
23
25
import org .testcontainers .containers .GenericContainer ;
27
29
28
30
public class AppContainerConfig implements SharedContainerConfiguration {
29
31
32
+ public static final Duration TIMEOUT = Duration .ofSeconds (
33
+ Long .parseLong (
34
+ System .getProperty ("microshed.testing.startup.timeout" , "60" )
35
+ )
36
+ );
37
+
30
38
@ Container
31
39
public static ApplicationContainer app = new ApplicationContainer ()
32
40
.withAppContextRoot ("/myservice" )
@@ -40,11 +48,13 @@ public class AppContainerConfig implements SharedContainerConfiguration {
40
48
41
49
@ Container
42
50
public static MockServerContainer mockServer = new MockServerContainer (MOCK_SERVER_IMAGE_NAME )
43
- .withNetworkAliases ("mockserver" );
51
+ .withNetworkAliases ("mockserver" )
52
+ .withStartupTimeout (TIMEOUT );
44
53
45
54
@ Container
46
55
public static GenericContainer <?> mongo = new GenericContainer <>("mongo:3.4" )
47
- .withNetworkAliases ("testmongo" );
56
+ .withNetworkAliases ("testmongo" )
57
+ .withStartupTimeout (TIMEOUT );
48
58
49
59
@ Override
50
60
public void startContainers () {
Original file line number Diff line number Diff line change 18
18
*/
19
19
package org .example .app ;
20
20
21
+ import java .time .Duration ;
22
+
21
23
import org .microshed .testing .SharedContainerConfiguration ;
22
24
import org .microshed .testing .testcontainers .ApplicationContainer ;
23
25
import org .testcontainers .containers .GenericContainer ;
27
29
28
30
public class AppContainerConfig implements SharedContainerConfiguration {
29
31
32
+ public static final Duration TIMEOUT = Duration .ofSeconds (
33
+ Long .parseLong (
34
+ System .getProperty ("microshed.testing.startup.timeout" , "60" )
35
+ )
36
+ );
37
+
30
38
@ Container
31
39
public static ApplicationContainer app = new ApplicationContainer ()
32
40
.withAppContextRoot ("/myservice" )
@@ -40,11 +48,13 @@ public class AppContainerConfig implements SharedContainerConfiguration {
40
48
41
49
@ Container
42
50
public static MockServerContainer mockServer = new MockServerContainer (MOCK_SERVER_IMAGE_NAME )
43
- .withNetworkAliases ("mockserver" );
51
+ .withNetworkAliases ("mockserver" )
52
+ .withStartupTimeout (TIMEOUT );
44
53
45
54
@ Container
46
55
public static GenericContainer <?> mongo = new GenericContainer <>("mongo:3.4" )
47
- .withNetworkAliases ("testmongo" );
56
+ .withNetworkAliases ("testmongo" )
57
+ .withStartupTimeout (TIMEOUT );
48
58
49
59
@ Override
50
60
public void startContainers () {
Original file line number Diff line number Diff line change 18
18
*/
19
19
package org .example .app ;
20
20
21
+ import java .time .Duration ;
22
+
21
23
import org .microshed .testing .SharedContainerConfiguration ;
22
24
import org .microshed .testing .testcontainers .ApplicationContainer ;
23
25
import org .testcontainers .containers .KafkaContainer ;
27
29
28
30
public class AppContainerConfig implements SharedContainerConfiguration {
29
31
32
+ public static final Duration TIMEOUT = Duration .ofSeconds (
33
+ Long .parseLong (
34
+ System .getProperty ("microshed.testing.startup.timeout" , "60" )
35
+ )
36
+ );
37
+
30
38
private static Network network = Network .newNetwork ();
31
39
32
40
private static final DockerImageName KAFKA_IMAGE_NAME =
@@ -35,7 +43,8 @@ public class AppContainerConfig implements SharedContainerConfiguration {
35
43
@ Container
36
44
public static KafkaContainer kafka = new KafkaContainer (KAFKA_IMAGE_NAME )
37
45
.withNetworkAliases ("kafka" )
38
- .withNetwork (network );
46
+ .withNetwork (network )
47
+ .withStartupTimeout (TIMEOUT );
39
48
40
49
@ Container
41
50
public static ApplicationContainer app = new ApplicationContainer ()
Original file line number Diff line number Diff line change 18
18
*/
19
19
package org .example .app .it ;
20
20
21
+ import java .time .Duration ;
22
+
21
23
import org .microshed .testing .SharedContainerConfiguration ;
22
24
import org .testcontainers .containers .GenericContainer ;
23
25
import org .testcontainers .containers .PostgreSQLContainer ;
You can’t perform that action at this time.
0 commit comments