Skip to content

Commit d198865

Browse files
artursouzaakkie
authored andcommitted
Picks a port for DaprActorITS for test containers to avoid conflict.
Signed-off-by: Artur Souza <[email protected]> Signed-off-by: Christian Kaps <[email protected]>
1 parent f0287e7 commit d198865

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

sdk-tests/src/test/java/io/dapr/it/testcontainers/DaprActorsIT.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,17 @@
4343
classes = {
4444
TestActorsApplication.class,
4545
TestDaprActorsConfiguration.class
46+
},
47+
properties = {
48+
"server.port=64080", // must be constant, not a static attribute from class below.
4649
}
4750
)
4851
@Testcontainers
4952
@Tag("testcontainers")
5053
public class DaprActorsIT {
54+
55+
private static final int APP_PORT = 64080;
56+
5157
private static final Network DAPR_NETWORK = Network.newNetwork();
5258

5359
private static final String ACTORS_MESSAGE_PATTERN = ".*Actor API level in the cluster has been updated to 10.*";
@@ -61,7 +67,7 @@ public class DaprActorsIT {
6167
.withDaprLogLevel(DaprLogLevel.DEBUG)
6268
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
6369
.withAppChannelAddress("host.testcontainers.internal")
64-
.withAppPort(8080);
70+
.withAppPort(APP_PORT);
6571

6672
/**
6773
* Expose the Dapr ports to the host.
@@ -82,7 +88,7 @@ static void daprProperties(DynamicPropertyRegistry registry) {
8288

8389
@BeforeEach
8490
public void setUp(){
85-
org.testcontainers.Testcontainers.exposeHostPorts(8080);
91+
org.testcontainers.Testcontainers.exposeHostPorts(APP_PORT);
8692
daprActorRuntime.registerActor(TestActorImpl.class);
8793
// Ensure the subscriptions are registered
8894
Wait.forLogMessage(ACTORS_MESSAGE_PATTERN, 1).waitUntilReady(DAPR_CONTAINER);

0 commit comments

Comments
 (0)