-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#326 - polish configuration to work in testcontainers
- Loading branch information
1 parent
b9882cb
commit 8474ff1
Showing
6 changed files
with
70 additions
and
85 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
order-service/src/main/java/com/example/orderservice/config/kafka/KafkaConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 12 additions & 6 deletions
18
...ervice/src/test/java/com/example/orderservice/OrderServiceApplicationIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
/* Licensed under Apache-2.0 2021-2023 */ | ||
package com.example.orderservice; | ||
|
||
import static java.util.concurrent.TimeUnit.SECONDS; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
import com.example.orderservice.common.AbstractIntegrationTest; | ||
import java.util.concurrent.TimeUnit; | ||
import java.time.Duration; | ||
import org.awaitility.Awaitility; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class OrderServiceApplicationIntegrationTest extends AbstractIntegrationTest { | ||
|
||
@Test | ||
void shouldFetchAllOrdersFromStream() throws Exception { | ||
// waiting till is kafka stream is changed from PARTITIONS_ASSIGNED to RUNNING | ||
TimeUnit.SECONDS.sleep(5); | ||
this.mockMvc | ||
.perform(get("/api/orders/all")) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$.size()", is(0))); | ||
Awaitility.await() | ||
.atMost(10, SECONDS) | ||
.pollInterval(Duration.ofSeconds(1)) | ||
.untilAsserted( | ||
() -> | ||
this.mockMvc | ||
.perform(get("/api/orders/all")) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$.size()", is(0)))); | ||
} | ||
} |
32 changes: 17 additions & 15 deletions
32
order-service/src/test/java/com/example/orderservice/TestOrderServiceApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
order-service/src/test/java/com/example/orderservice/config/MyTestContainers.java
This file was deleted.
Oops, something went wrong.