From 54b069d1ce34d46d582f89a985abe05a33c8dfcb Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Sat, 2 Nov 2024 10:02:29 +0100 Subject: [PATCH] No issue: Try increasing the test cluster timeout --- inception/inception-dependencies/pom.xml | 19 ++++++++++++++ .../pom.xml | 5 ++++ .../opensearch/OpenSearchProviderTest.java | 26 ++++++++++++++++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/inception/inception-dependencies/pom.xml b/inception/inception-dependencies/pom.xml index b67b80efbd2..44dbe04e8c8 100644 --- a/inception/inception-dependencies/pom.xml +++ b/inception/inception-dependencies/pom.xml @@ -1263,6 +1263,25 @@ + + org.opensearch + opensearch-common + ${opensearch.version} + + + org.apache.lucene + lucene-spatial + + + org.apache.lucene + lucene-spatial-extras + + + org.apache.lucene + lucene-spatial3d + + + org.opensearch opensearch-core diff --git a/inception/inception-external-search-opensearch/pom.xml b/inception/inception-external-search-opensearch/pom.xml index 3284fe92e4d..16e326e8fac 100644 --- a/inception/inception-external-search-opensearch/pom.xml +++ b/inception/inception-external-search-opensearch/pom.xml @@ -147,5 +147,10 @@ inception-model test + + org.opensearch + opensearch-common + test + diff --git a/inception/inception-external-search-opensearch/src/test/java/de/tudarmstadt/ukp/inception/externalsearch/opensearch/OpenSearchProviderTest.java b/inception/inception-external-search-opensearch/src/test/java/de/tudarmstadt/ukp/inception/externalsearch/opensearch/OpenSearchProviderTest.java index 4dbae5dcc5e..e165c708f92 100644 --- a/inception/inception-external-search-opensearch/src/test/java/de/tudarmstadt/ukp/inception/externalsearch/opensearch/OpenSearchProviderTest.java +++ b/inception/inception-external-search-opensearch/src/test/java/de/tudarmstadt/ukp/inception/externalsearch/opensearch/OpenSearchProviderTest.java @@ -24,12 +24,18 @@ import java.util.List; import org.codelibs.opensearch.runner.OpenSearchRunner; +import org.codelibs.opensearch.runner.OpenSearchRunnerException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.opensearch.LegacyESVersion; +import org.opensearch.action.admin.cluster.health.ClusterHealthResponse; +import org.opensearch.client.Requests; +import org.opensearch.cluster.health.ClusterHealthStatus; +import org.opensearch.common.Priority; import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings.Builder; +import org.opensearch.common.unit.TimeValue; import de.tudarmstadt.ukp.inception.externalsearch.ExternalSearchResult; import de.tudarmstadt.ukp.inception.externalsearch.model.DocumentRepository; @@ -52,7 +58,25 @@ public class OpenSearchProviderTest @BeforeEach public void setup() { - osRunner = new OpenSearchRunner(); + osRunner = new OpenSearchRunner() + { + @Override + public ClusterHealthStatus ensureYellow(final String... indices) + { + final ClusterHealthResponse actionGet = client().admin().cluster() + .health(Requests.clusterHealthRequest(indices) + .waitForNoRelocatingShards(true).waitForYellowStatus() + .waitForEvents(Priority.LANGUID)) + .actionGet(TimeValue.timeValueSeconds(60)); + if (actionGet.isTimedOut()) { + throw new OpenSearchRunnerException("ensureYellow timed out, cluster state:\n" + + "\n" + client().admin().cluster().prepareState().get().getState() + + "\n" + client().admin().cluster().preparePendingClusterTasks().get(), + actionGet); + } + return actionGet.getStatus(); + } + }; osRunner.onBuild(new OpenSearchRunner.Builder() { @Override