Skip to content

Commit b05bc13

Browse files
artur-ciocanuArtur Ciocanu
authored andcommitted
Add app health check support to Dapr Testcontainer (dapr#1213)
* Add app health check support to Dapr Testcontainer Signed-off-by: Artur Ciocanu <[email protected]> * Some minor cleanup Signed-off-by: Artur Ciocanu <[email protected]> * Move waiting to beforeEach, it looks more natural Signed-off-by: Artur Ciocanu <[email protected]> --------- Signed-off-by: Artur Ciocanu <[email protected]> Co-authored-by: Artur Ciocanu <[email protected]>
1 parent 42303e9 commit b05bc13

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

sdk-tests/src/test/java/io/dapr/it/spring/messaging/DaprSpringMessagingIT.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import io.dapr.testcontainers.Component;
2020
import io.dapr.testcontainers.DaprContainer;
2121
import io.dapr.testcontainers.DaprLogLevel;
22-
import io.dapr.testcontainers.Subscription;
2322
import org.junit.jupiter.api.BeforeAll;
2423
import org.junit.jupiter.api.BeforeEach;
2524
import org.junit.jupiter.api.Tag;
@@ -44,7 +43,7 @@
4443
webEnvironment = WebEnvironment.DEFINED_PORT,
4544
classes = {
4645
DaprClientAutoConfiguration.class,
47-
TestApplication.class, TestRestController.class
46+
TestApplication.class
4847
},
4948
properties = {"dapr.pubsub.name=pubsub"}
5049
)
@@ -61,11 +60,10 @@ public class DaprSpringMessagingIT {
6160

6261
@Container
6362
@ServiceConnection
64-
private static final DaprContainer DAPR_CONTAINER = new DaprContainer("daprio/daprd:1.14.4")
63+
private static final DaprContainer DAPR_CONTAINER = new DaprContainer("daprio/daprd:1.13.2")
6564
.withAppName("messaging-dapr-app")
6665
.withNetwork(DAPR_NETWORK)
6766
.withComponent(new Component("pubsub", "pubsub.in-memory", "v1", Collections.emptyMap()))
68-
.withSubscription(new Subscription("my-app-subscription", "pubsub", "mockTopic", "subscribe"))
6967
.withAppPort(APP_PORT)
7068
.withAppHealthCheckPath("/ready")
7169
.withDaprLogLevel(DaprLogLevel.DEBUG)
@@ -82,7 +80,7 @@ public class DaprSpringMessagingIT {
8280
public static void beforeAll(){
8381
org.testcontainers.Testcontainers.exposeHostPorts(APP_PORT);
8482
}
85-
83+
8684
@BeforeEach
8785
public void beforeEach() {
8886
// Ensure the subscriptions are registered
@@ -91,7 +89,6 @@ public void beforeEach() {
9189

9290
@Test
9391
public void testDaprMessagingTemplate() throws InterruptedException {
94-
Thread.sleep(10000);
9592
for (int i = 0; i < 10; i++) {
9693
var msg = "ProduceAndReadWithPrimitiveMessageType:" + i;
9794

@@ -107,4 +104,4 @@ public void testDaprMessagingTemplate() throws InterruptedException {
107104

108105
assertThat(events.size()).isEqualTo(10);
109106
}
110-
}
107+
}

0 commit comments

Comments
 (0)