fabriziofortino commented on code in PR #3002:
URL: https://github.com/apache/jackrabbit-oak/pull/3002#discussion_r3528033581


##########
oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticConnectionRule.java:
##########
@@ -94,8 +96,14 @@ protected void after() {
         ElasticConnection esConnection = getElasticConnection();
         if (esConnection != null) {
             try {
-                esConnection.getClient().indices().delete(d -> 
d.index(this.indexPrefix + "*"));

Review Comment:
   The same logic is executed in other tests, which at the moment are failing.



##########
oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticTestServer.java:
##########
@@ -62,39 +65,42 @@ public static synchronized ElasticsearchContainer 
getESTestServer() {
         return CONTAINER;
     }
 
-    @SuppressWarnings("resource")
     private synchronized void setup() {
         String esDockerImageVersion = ELASTIC_DOCKER_IMAGE_VERSION != null ? 
ELASTIC_DOCKER_IMAGE_VERSION : Version.VERSION.toString();
         LOG.info("Elasticsearch test Docker image version: {}.", 
esDockerImageVersion);
         checkIfDockerClientAvailable();
-        Network network = Network.newNetwork();
+        network = Network.newNetwork();
         CONTAINER = new 
ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:" + 
esDockerImageVersion)
                 .withEnv("ES_JAVA_OPTS", "-Xms1g -Xmx1g")
+                // Keep test transport deterministic across Testcontainers/ES 
versions.
+                .withEnv("xpack.security.enabled", "false")
+                .withEnv("xpack.security.http.ssl.enabled", "false")
                 .withCopyFileToContainer(
                         
MountableFile.forClasspathResource("elasticsearch.yml"),
                         "/usr/share/elasticsearch/config/elasticsearch.yml")
                 .withNetwork(network)
                 .withNetworkAliases("elasticsearch")
+                .waitingFor(Wait.forHttp("/").forPort(9200).forStatusCode(200))

Review Comment:
   It seems that because of these changes the configuration in 
`elasticsearch.yml` is ignored. We can remove the file and set the 
configuration properties with `withEnv`. This should solve the failing tests 
and we could rollback the changes in `ElasticConnectionRule`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to