From 5659b928a7190318a0239b5ddb8f7e57a64a93c6 Mon Sep 17 00:00:00 2001 From: Michael Folz Date: Thu, 12 Dec 2024 10:31:35 +0100 Subject: [PATCH 1/5] #334 - Re-enable CodeableConceptServiceIT - Update elastic search to 8.16.1 - re-enable test and see if the problem maybe miraculously disappeared due to other changes in the past --- .github/integration-test/docker-compose.yml | 2 +- docker-compose.yml | 2 +- .../terminology/es/CodeableConceptServiceIT.java | 3 +-- .../terminology/es/TerminologyEsServiceIT.java | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/integration-test/docker-compose.yml b/.github/integration-test/docker-compose.yml index ef9b191c..1ad177ae 100644 --- a/.github/integration-test/docker-compose.yml +++ b/.github/integration-test/docker-compose.yml @@ -87,7 +87,7 @@ services: POSTGRES_DB: "dataportal" dataportal-elastic: - image: docker.elastic.co/elasticsearch/elasticsearch:8.16.0 + image: docker.elastic.co/elasticsearch/elasticsearch:8.16.1 container_name: dataportal-elastic ports: - '9200:9200' diff --git a/docker-compose.yml b/docker-compose.yml index 8b7af92e..0c2aa0d3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -111,7 +111,7 @@ services: source: dataportal-postgres-data target: /var/lib/postgresql/data dataportal-elastic: - image: docker.elastic.co/elasticsearch/elasticsearch:8.16.0 + image: docker.elastic.co/elasticsearch/elasticsearch:8.16.1 container_name: dataportal-elastic ports: - '9200:9200' diff --git a/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java b/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java index 3c16d568..2347a51d 100644 --- a/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java +++ b/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java @@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertNotNull; -@Disabled("There seems to be a concurrency issue with TerminologyServiceIT. Disable this for now until it is fixed.") @Tag("terminology") @Tag("elasticsearch") @Import({CodeableConceptService.class}) @@ -46,7 +45,7 @@ public class CodeableConceptServiceIT { @Container @ServiceConnection - public static ElasticsearchContainer ELASTICSEARCH_CONTAINER = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.16.0") + public static ElasticsearchContainer ELASTICSEARCH_CONTAINER = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.16.1") .withEnv("discovery.type", "single-node") .withEnv("xpack.security.enabled", "false") .withReuse(false) diff --git a/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/TerminologyEsServiceIT.java b/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/TerminologyEsServiceIT.java index b63d4bf2..0919222f 100644 --- a/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/TerminologyEsServiceIT.java +++ b/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/TerminologyEsServiceIT.java @@ -51,7 +51,7 @@ public class TerminologyEsServiceIT { @Container @ServiceConnection - public static ElasticsearchContainer ELASTICSEARCH_CONTAINER = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.16.0") + public static ElasticsearchContainer ELASTICSEARCH_CONTAINER = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.16.1") .withEnv("discovery.type", "single-node") .withEnv("xpack.security.enabled", "false") .withReuse(false) From b58144bd5020106b977e2c5d93ed88504b2886f4 Mon Sep 17 00:00:00 2001 From: Michael Folz Date: Thu, 12 Dec 2024 11:26:42 +0100 Subject: [PATCH 2/5] #334 - Re-enable CodeableConceptServiceIT - add some debug output --- .../terminology/es/CodeableConceptService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptService.java b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptService.java index a4d97f63..b1612b21 100644 --- a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptService.java +++ b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptService.java @@ -102,6 +102,10 @@ private SearchHits findByCodeOrDisplay(String keyword, .withPageable(pageRequest) .build(); - return operations.search(query, CodeableConceptDocument.class); + log.info(query.getQuery().toString()); + + var result = operations.search(query, CodeableConceptDocument.class); + log.info(result.toString()); + return result; } } From cb001468fb705f4357e9bbd382692ce89c33bc8a Mon Sep 17 00:00:00 2001 From: Michael Folz Date: Thu, 12 Dec 2024 11:38:04 +0100 Subject: [PATCH 3/5] #334 - Re-enable CodeableConceptServiceIT - add a 5 second sleep to check if it is simply a timing issue --- .../terminology/es/CodeableConceptServiceIT.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java b/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java index 2347a51d..45cdd6ba 100644 --- a/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java +++ b/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java @@ -55,7 +55,7 @@ public class CodeableConceptServiceIT { .waitingFor(Wait.forHttp("/health").forStatusCodeMatching(c -> c >= 200 && c <= 500)); @BeforeAll - static void setUp() { + static void setUp() throws InterruptedException { ELASTICSEARCH_CONTAINER.start(); WebClient webClient = WebClient.builder().baseUrl("http://" + ELASTICSEARCH_CONTAINER.getHttpHostAddress()).build(); webClient.put() @@ -71,6 +71,7 @@ static void setUp() { .retrieve() .toBodilessEntity() .block(); + Thread.sleep(5000); } @AfterAll From 2edd2db4b0da4bc07e5d4f8367a01d4d1f02e260 Mon Sep 17 00:00:00 2001 From: Michael Folz Date: Thu, 12 Dec 2024 11:55:21 +0100 Subject: [PATCH 4/5] #334 - Re-enable CodeableConceptServiceIT - decrease the sleep to 1 sec to see if it still works --- .../terminology/es/CodeableConceptServiceIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java b/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java index 45cdd6ba..f1ec63c9 100644 --- a/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java +++ b/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java @@ -71,7 +71,7 @@ static void setUp() throws InterruptedException { .retrieve() .toBodilessEntity() .block(); - Thread.sleep(5000); + Thread.sleep(1000); } @AfterAll From 8af09a479e3216870c71c8dc772a2899e4810499 Mon Sep 17 00:00:00 2001 From: Michael Folz Date: Thu, 12 Dec 2024 12:46:19 +0100 Subject: [PATCH 5/5] #334 - Re-enable CodeableConceptServiceIT - remove debug output --- .../terminology/es/CodeableConceptService.java | 6 +----- .../terminology/es/CodeableConceptServiceIT.java | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptService.java b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptService.java index b1612b21..a4d97f63 100644 --- a/src/main/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptService.java +++ b/src/main/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptService.java @@ -102,10 +102,6 @@ private SearchHits findByCodeOrDisplay(String keyword, .withPageable(pageRequest) .build(); - log.info(query.getQuery().toString()); - - var result = operations.search(query, CodeableConceptDocument.class); - log.info(result.toString()); - return result; + return operations.search(query, CodeableConceptDocument.class); } } diff --git a/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java b/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java index f1ec63c9..27565b93 100644 --- a/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java +++ b/src/test/java/de/numcodex/feasibility_gui_backend/terminology/es/CodeableConceptServiceIT.java @@ -71,6 +71,8 @@ static void setUp() throws InterruptedException { .retrieve() .toBodilessEntity() .block(); + + // When running in github actions without a slight delay, the data might not be complete in the elastic search container (although a blocking call is used) Thread.sleep(1000); }