forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert part of the change that made ES|QL not error out on explicitly
missing index in the index pattern. Adjust existing tests and add more tests.
- Loading branch information
Showing
8 changed files
with
425 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/EsqlRestValidationIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.esql.ccq; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; | ||
|
||
import org.apache.http.HttpHost; | ||
import org.elasticsearch.client.RestClient; | ||
import org.elasticsearch.core.IOUtils; | ||
import org.elasticsearch.test.TestClustersThreadFilter; | ||
import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
import org.elasticsearch.xpack.esql.qa.rest.EsqlRestValidationTestCase; | ||
import org.junit.AfterClass; | ||
import org.junit.ClassRule; | ||
import org.junit.rules.RuleChain; | ||
import org.junit.rules.TestRule; | ||
|
||
import java.io.IOException; | ||
import java.util.StringJoiner; | ||
|
||
import static org.elasticsearch.xpack.esql.ccq.Clusters.REMOTE_CLUSTER_NAME; | ||
|
||
@ThreadLeakFilters(filters = TestClustersThreadFilter.class) | ||
public class EsqlRestValidationIT extends EsqlRestValidationTestCase { | ||
static ElasticsearchCluster remoteCluster = Clusters.remoteCluster(); | ||
static ElasticsearchCluster localCluster = Clusters.localCluster(remoteCluster); | ||
|
||
@ClassRule | ||
public static TestRule clusterRule = RuleChain.outerRule(remoteCluster).around(localCluster); | ||
private static RestClient remoteClient; | ||
|
||
@Override | ||
protected String getTestRestCluster() { | ||
return localCluster.getHttpAddresses(); | ||
} | ||
|
||
@AfterClass | ||
public static void closeRemoteClients() throws IOException { | ||
try { | ||
IOUtils.close(remoteClient); | ||
} finally { | ||
remoteClient = null; | ||
} | ||
} | ||
|
||
@Override | ||
protected String clusterSpecificIndexName(String pattern) { | ||
StringJoiner sj = new StringJoiner(","); | ||
for (String index : pattern.split(",")) { | ||
sj.add(remoteClusterIndex(index)); | ||
} | ||
return sj.toString(); | ||
} | ||
|
||
private static String remoteClusterIndex(String indexName) { | ||
return REMOTE_CLUSTER_NAME + ":" + indexName; | ||
} | ||
|
||
@Override | ||
protected RestClient provisioningClient() throws IOException { | ||
return remoteClusterClient(); | ||
} | ||
|
||
@Override | ||
protected RestClient provisioningAdminClient() throws IOException { | ||
return remoteClusterClient(); | ||
} | ||
|
||
private RestClient remoteClusterClient() throws IOException { | ||
if (remoteClient == null) { | ||
var clusterHosts = parseClusterHosts(remoteCluster.getHttpAddresses()); | ||
remoteClient = buildClient(restClientSettings(), clusterHosts.toArray(new HttpHost[0])); | ||
} | ||
return remoteClient; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...rc/javaRestTest/java/org/elasticsearch/xpack/esql/qa/multi_node/EsqlRestValidationIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.esql.qa.multi_node; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; | ||
|
||
import org.elasticsearch.test.TestClustersThreadFilter; | ||
import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
import org.elasticsearch.xpack.esql.qa.rest.EsqlRestValidationTestCase; | ||
import org.junit.ClassRule; | ||
|
||
@ThreadLeakFilters(filters = TestClustersThreadFilter.class) | ||
public class EsqlRestValidationIT extends EsqlRestValidationTestCase { | ||
|
||
@ClassRule | ||
public static ElasticsearchCluster cluster = Clusters.testCluster(spec -> {}); | ||
|
||
@Override | ||
protected String getTestRestCluster() { | ||
return cluster.getHttpAddresses(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...c/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/EsqlRestValidationIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.esql.qa.single_node; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; | ||
|
||
import org.elasticsearch.test.TestClustersThreadFilter; | ||
import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
import org.elasticsearch.xpack.esql.qa.rest.EsqlRestValidationTestCase; | ||
import org.junit.ClassRule; | ||
|
||
@ThreadLeakFilters(filters = TestClustersThreadFilter.class) | ||
public class EsqlRestValidationIT extends EsqlRestValidationTestCase { | ||
|
||
@ClassRule | ||
public static ElasticsearchCluster cluster = Clusters.testCluster(); | ||
|
||
@Override | ||
protected String getTestRestCluster() { | ||
return cluster.getHttpAddresses(); | ||
} | ||
} |
Oops, something went wrong.