Skip to content

Commit ecc4c92

Browse files
authored
Fix RequestIndexFilteringIT::testIndicesDontExist (elastic#120899) (elastic#120909)
Remote cluster is randomly picked by the test. The failure was happening as now we emit a different error when attempting a join with a remote cluster. (cherry picked from commit 084192c)
1 parent 14f2a42 commit ecc4c92

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RequestIndexFilteringTestCase.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.client.ResponseException;
1414
import org.elasticsearch.client.RestClient;
1515
import org.elasticsearch.test.rest.ESRestTestCase;
16+
import org.elasticsearch.transport.RemoteClusterAware;
1617
import org.elasticsearch.xcontent.XContentType;
1718
import org.elasticsearch.xpack.esql.AssertWarnings;
1819
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
@@ -212,13 +213,20 @@ public void testIndicesDontExist() throws IOException {
212213
assertThat(e.getMessage(), anyOf(containsString("no such index [foo]"), containsString("no such index [remote_cluster:foo]")));
213214

214215
if (EsqlCapabilities.Cap.JOIN_LOOKUP_V12.isEnabled()) {
216+
var pattern = from("test1");
215217
e = expectThrows(
216218
ResponseException.class,
217-
() -> runEsql(timestampFilter("gte", "2020-01-01").query(from("test1") + " | LOOKUP JOIN foo ON id1"))
219+
() -> runEsql(timestampFilter("gte", "2020-01-01").query(pattern + " | LOOKUP JOIN foo ON id1"))
218220
);
219221
assertEquals(400, e.getResponse().getStatusLine().getStatusCode());
220-
assertThat(e.getMessage(), containsString("verification_exception"));
221-
assertThat(e.getMessage(), containsString("Unknown index [foo]"));
222+
assertThat(
223+
e.getMessage(),
224+
// currently we don't support remote clusters in LOOKUP JOIN
225+
// this check happens before resolving actual indices and results in a different error message
226+
RemoteClusterAware.isRemoteIndexName(pattern)
227+
? allOf(containsString("parsing_exception"), containsString("remote clusters are not supported in LOOKUP JOIN"))
228+
: allOf(containsString("verification_exception"), containsString("Unknown index [foo]"))
229+
);
222230
}
223231
}
224232

0 commit comments

Comments
 (0)