Skip to content

Commit

Permalink
Fix RequestIndexFilteringIT::testIndicesDontExist (#120899)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
idegtiarenko authored Jan 27, 2025
1 parent 5b3436d commit 084192c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ tests:
issue: https://github.com/elastic/elasticsearch/issues/120810
- class: org.elasticsearch.indices.mapping.UpdateMappingIntegrationIT
issue: https://github.com/elastic/elasticsearch/issues/116126
- class: org.elasticsearch.xpack.esql.ccq.RequestIndexFilteringIT
method: testIndicesDontExist
issue: https://github.com/elastic/elasticsearch/issues/120889
- class: org.elasticsearch.datastreams.DataStreamsClientYamlTestSuiteIT
method: test {p0=data_stream/140_data_stream_aliases/Create data stream aliases using wildcard expression}
issue: https://github.com/elastic/elasticsearch/issues/120890
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.elasticsearch.client.ResponseException;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.transport.RemoteClusterAware;
import org.elasticsearch.xcontent.XContentType;
import org.elasticsearch.xpack.esql.AssertWarnings;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
Expand Down Expand Up @@ -212,13 +213,20 @@ public void testIndicesDontExist() throws IOException {
assertThat(e.getMessage(), anyOf(containsString("no such index [foo]"), containsString("no such index [remote_cluster:foo]")));

if (EsqlCapabilities.Cap.JOIN_LOOKUP_V12.isEnabled()) {
var pattern = from("test1");
e = expectThrows(
ResponseException.class,
() -> runEsql(timestampFilter("gte", "2020-01-01").query(from("test1") + " | LOOKUP JOIN foo ON id1"))
() -> runEsql(timestampFilter("gte", "2020-01-01").query(pattern + " | LOOKUP JOIN foo ON id1"))
);
assertEquals(400, e.getResponse().getStatusLine().getStatusCode());
assertThat(e.getMessage(), containsString("verification_exception"));
assertThat(e.getMessage(), containsString("Unknown index [foo]"));
assertThat(
e.getMessage(),
// currently we don't support remote clusters in LOOKUP JOIN
// this check happens before resolving actual indices and results in a different error message
RemoteClusterAware.isRemoteIndexName(pattern)
? allOf(containsString("parsing_exception"), containsString("remote clusters are not supported in LOOKUP JOIN"))
: allOf(containsString("verification_exception"), containsString("Unknown index [foo]"))
);
}
}

Expand Down

0 comments on commit 084192c

Please sign in to comment.