Skip to content

Commit c428a43

Browse files
committed
Update tests
1 parent cd2e7a6 commit c428a43

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/CrossClusterQueryWithFiltersIT.java

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99

1010
import org.elasticsearch.ElasticsearchException;
1111
import org.elasticsearch.client.internal.Client;
12+
import org.elasticsearch.cluster.RemoteException;
1213
import org.elasticsearch.common.Strings;
1314
import org.elasticsearch.common.settings.Settings;
15+
import org.elasticsearch.index.IndexNotFoundException;
1416
import org.elasticsearch.index.query.QueryBuilder;
1517
import org.elasticsearch.index.query.RangeQueryBuilder;
1618
import org.elasticsearch.test.transport.MockTransportService;
@@ -275,13 +277,13 @@ public void testFilterWithMissingIndex() {
275277
);
276278
assertThat(e.getDetailedMessage(), containsString("Unknown index [missing]"));
277279
// Local index missing + wildcards
278-
// FIXME: planner does not catch this now
279-
// e = expectThrows(VerificationException.class, () -> runQuery("from missing,logs*", randomBoolean(), filter).close());
280-
// assertThat(e.getDetailedMessage(), containsString("Unknown index [missing]"));
280+
// FIXME: planner does not catch this now, it should be VerificationException but for now it's runtime IndexNotFoundException
281+
var ie = expectThrows(IndexNotFoundException.class, () -> runQuery("from missing,logs*", randomBoolean(), filter).close());
282+
assertThat(ie.getDetailedMessage(), containsString("no such index [missing]"));
281283
// Local index missing + existing index
282-
// FIXME: planner does not catch this now
283-
// e = expectThrows(VerificationException.class, () -> runQuery("from missing,logs-1", randomBoolean(), filter).close());
284-
// assertThat(e.getDetailedMessage(), containsString("Unknown index [missing]"));
284+
// FIXME: planner does not catch this now, it should be VerificationException but for now it's runtime IndexNotFoundException
285+
ie = expectThrows(IndexNotFoundException.class, () -> runQuery("from missing,logs-1", randomBoolean(), filter).close());
286+
assertThat(ie.getDetailedMessage(), containsString("no such index [missing]"));
285287
// Local index missing + existing remote
286288
e = expectThrows(VerificationException.class, () -> runQuery("from missing,cluster-a:logs-2", randomBoolean(), filter).close());
287289
assertThat(e.getDetailedMessage(), containsString("Unknown index [missing]"));
@@ -318,15 +320,19 @@ public void testFilterWithMissingRemoteIndex() {
318320
);
319321
assertThat(e.getDetailedMessage(), containsString("Unknown index [cluster-a:missing]"));
320322
// Local index missing + wildcards
321-
// FIXME: planner does not catch this now
322-
// e = expectThrows(VerificationException.class, () -> runQuery("from cluster-a:missing,cluster-a:logs*", randomBoolean(),
323-
// filter).close());
324-
// assertThat(e.getDetailedMessage(), containsString("Unknown index [cluster-a:missing]"));
323+
// FIXME: planner does not catch this now, it should be VerificationException but for now it's runtime RemoteException
324+
var ie = expectThrows(
325+
RemoteException.class,
326+
() -> runQuery("from cluster-a:missing,cluster-a:logs*", randomBoolean(), filter).close()
327+
);
328+
assertThat(ie.getDetailedMessage(), containsString("no such index [missing]"));
325329
// Local index missing + existing index
326-
// FIXME: planner does not catch this now
327-
// e = expectThrows(VerificationException.class, () -> runQuery("from cluster-a:missing,cluster-a:logs-2", randomBoolean(),
328-
// filter).close());
329-
// assertThat(e.getDetailedMessage(), containsString("Unknown index [cluster-a:missing]"));
330+
// FIXME: planner does not catch this now, it should be VerificationException but for now it's runtime RemoteException
331+
ie = expectThrows(
332+
RemoteException.class,
333+
() -> runQuery("from cluster-a:missing,cluster-a:logs-2", randomBoolean(), filter).close()
334+
);
335+
assertThat(ie.getDetailedMessage(), containsString("no such index [missing]"));
330336
// Local index + missing remote
331337
e = expectThrows(VerificationException.class, () -> runQuery("from logs-1,cluster-a:missing", randomBoolean(), filter).close());
332338
assertThat(e.getDetailedMessage(), containsString("Unknown index [cluster-a:missing]"));

0 commit comments

Comments
 (0)