Skip to content

Commit ee6f761

Browse files
committed
fix(springboot openfeign): delete pubsub subscription to make DaprSpringMessagingIT works
Signed-off-by: lony2003 <[email protected]>
1 parent 2877e86 commit ee6f761

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

sdk-tests/src/test/java/io/dapr/it/spring/feign/DaprFeignIT.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,13 @@
4848
@Testcontainers
4949
@Tag("testcontainers")
5050
public class DaprFeignIT {
51+
public static final String BINDING_NAME = "postgresbinding";
5152
private static final String CONNECTION_STRING =
5253
"host=postgres-repository user=postgres password=password port=5432 connect_timeout=10 database=dapr_db_repository";
53-
5454
private static final Map<String, String> BINDING_PROPERTIES = Map.of("connectionString", CONNECTION_STRING);
55-
5655
private static final Network DAPR_NETWORK = Network.newNetwork();
57-
58-
public static final String BINDING_NAME = "postgresbinding";
59-
6056
private static final int APP_PORT = 8080;
61-
private static final String SUBSCRIPTION_MESSAGE_PATTERN = ".*app is subscribed to the following topics.*";
57+
private static final String SUBSCRIPTION_MESSAGE_PATTERN = ".*App entered healthy status.*";
6258

6359
@Container
6460
private static final PostgreSQLContainer<?> POSTGRE_SQL_CONTAINER = new PostgreSQLContainer<>("postgres:16-alpine")
@@ -73,14 +69,17 @@ public class DaprFeignIT {
7369
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(IMAGE_TAG)
7470
.withAppName("dapr-feign-test")
7571
.withNetwork(DAPR_NETWORK)
76-
.withComponent(new Component("pubsub", "pubsub.in-memory", "v1", Collections.emptyMap()))
7772
.withComponent(new Component(BINDING_NAME, "bindings.postgresql", "v1", BINDING_PROPERTIES))
7873
.withDaprLogLevel(DaprLogLevel.DEBUG)
7974
.withAppPort(APP_PORT)
8075
.withAppHealthCheckPath("/ready")
8176
.withAppChannelAddress("host.testcontainers.internal")
8277
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
8378
.dependsOn(POSTGRE_SQL_CONTAINER);
79+
@Autowired
80+
PostgreBindingClient postgreBindingClient;
81+
@Autowired
82+
TestMethodClient testMethodClient;
8483

8584
@BeforeAll
8685
public static void beforeAll() {
@@ -93,12 +92,6 @@ public void beforeEach() {
9392
Wait.forLogMessage(SUBSCRIPTION_MESSAGE_PATTERN, 1).waitUntilReady(DAPR_CONTAINER);
9493
}
9594

96-
@Autowired
97-
PostgreBindingClient postgreBindingClient;
98-
99-
@Autowired
100-
TestMethodClient testMethodClient;
101-
10295
@Test
10396
public void invokeBindingTest() {
10497
postgreBindingClient.exec("CREATE TABLE \"demodata\" (\n" +

sdk-tests/src/test/java/io/dapr/it/spring/feign/TestRestController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public String hello() {
3434
return "hello";
3535
}
3636

37-
@Topic(name = topicName, pubsubName = pubSubName)
3837
@PostMapping("/echo")
3938
public String echo(@RequestBody String input) {
4039
return input;

0 commit comments

Comments
 (0)