JAVA-31141:- Fix spring-cloud-eureka-feign-client-integration-test - ServiceDiscoveryBooksClientLiveTest (#16407)

This commit is contained in:
Amit Pandey 2024-04-17 14:45:48 +05:30 committed by GitHub
parent 1f2c8a5c3d
commit f36ab6c06b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 2 deletions

View File

@ -79,7 +79,7 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.14.3</version>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -108,6 +108,7 @@
<maven.compiler.target>17</maven.compiler.target>
<wiremock.version>3.3.1</wiremock.version>
<junit-jupiter.version>5.10.2</junit-jupiter.version>
<testcontainers.version>1.17.3</testcontainers.version>
</properties>
</project>

View File

@ -24,7 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
@EnableConfigurationProperties
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ContextConfiguration(classes = { MockBookServiceConfig.class }, initializers = { EurekaContainerConfig.Initializer.class })
@ContextConfiguration(classes = { MockBookServiceConfig.class })
class ServiceDiscoveryBooksClientLiveTest {
@Autowired
@ -39,6 +39,11 @@ class ServiceDiscoveryBooksClientLiveTest {
await().atMost(60, SECONDS).until(() -> eurekaClient.getApplications().size() > 0);
}
/**
* Please ensure that Eureka is running on port , 8761 for this test to pass.
* The EurekaServerApplication.main in spring-cloud-eureka-server project can be
* run to make an Eureka Server available.
*/
@Test
public void whenGetBooks_thenTheCorrectBooksAreReturned() {
List<Book> books = booksClient.getBooks();

View File

@ -1,3 +1,8 @@
spring:
application:
name: books-service
eureka:
client:
serviceUrl:
defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}