You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by fo...@apache.org on 2022/09/26 09:39:15 UTC
[jackrabbit-oak] branch trunk updated: Fix: Elasticsearch indexes created by common tests (oak-search module) were not being deleted at the end of the tests. (#721)
This is an automated email from the ASF dual-hosted git repository.
fortino pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push:
new a5251d0f7c Fix: Elasticsearch indexes created by common tests (oak-search module) were not being deleted at the end of the tests. (#721)
a5251d0f7c is described below
commit a5251d0f7c3784d6563933ffd32dce213f54312b
Author: Nuno Santos <ns...@adobe.com>
AuthorDate: Mon Sep 26 11:39:07 2022 +0200
Fix: Elasticsearch indexes created by common tests (oak-search module) were not being deleted at the end of the tests. (#721)
---
.../oak/plugins/index/elastic/ElasticConnectionRule.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticConnectionRule.java b/oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticConnectionRule.java
index d915493bc9..9bb4cf022d 100644
--- a/oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticConnectionRule.java
+++ b/oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticConnectionRule.java
@@ -16,6 +16,7 @@
*/
package org.apache.jackrabbit.oak.plugins.index.elastic;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.rules.ExternalResource;
import org.junit.runner.Description;
@@ -74,10 +75,11 @@ public class ElasticConnectionRule extends ExternalResource {
ElasticConnection esConnection = getElasticConnection();
if (esConnection != null) {
try {
- esConnection.getClient().indices().delete(d->d.index(esConnection.getIndexPrefix() + "*"));
- esConnection.close();
+ esConnection.getClient().indices().delete(d -> d.index(this.indexPrefix + "*"));
} catch (IOException e) {
- LOG.error("Unable to delete indexes with prefix {}", esConnection.getIndexPrefix());
+ LOG.error("Unable to delete indexes with prefix {}", this.indexPrefix);
+ } finally {
+ IOUtils.closeQuietly(esConnection, e -> LOG.debug("Error closing Elasticsearch connection", e));
}
}
}