Skip to content

Commit

Permalink
feat: fix sonar issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Oct 25, 2023
1 parent 8125f36 commit 4dcfadc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class TestApplication {
@Bean
@RestartScope
ElasticsearchContainer elasticsearchContainer() {
return new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.10.3")
return new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.10.4")
.withEnv(Map.of("xpack.security.enabled", "false"));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.example.mongoes.elasticsearch.repository;

import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;

import com.example.mongoes.common.AbstractIntegrationTest;
import com.example.mongoes.document.Address;
import com.example.mongoes.document.Grades;
import com.example.mongoes.document.Restaurant;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
Expand All @@ -36,7 +37,7 @@ class RestaurantESRepositoryIntegrationTest extends AbstractIntegrationTest {
@Autowired private RestaurantESRepository restaurantESRepository;

@BeforeAll
void setUpData() throws InterruptedException {
void setUpData() {
Restaurant restaurant = new Restaurant();
restaurant.setRestaurantId(2L);
restaurant.setName(RESTAURANT_NAME);
Expand All @@ -61,7 +62,10 @@ void setUpData() throws InterruptedException {
.log("saving restaurant")
.subscribe();

TimeUnit.SECONDS.sleep(5);
await().atMost(Duration.ofSeconds(10))
.pollInterval(Duration.ofSeconds(1))
.untilAsserted(
() -> assertThat(this.restaurantESRepository.count().block()).isEqualTo(2));
}

@Test
Expand Down

0 comments on commit 4dcfadc

Please sign in to comment.