Skip to content

Commit

Permalink
capability gate match command tests (elastic#111657)
Browse files Browse the repository at this point in the history
Some of the Match command tests were failing against the release build. This should disable them when the capability is not enabled.
  • Loading branch information
not-napoleon authored Aug 7, 2024
1 parent 8f590c8 commit 7e5960b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.elasticsearch.Build;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.esql.VerificationException;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
import org.elasticsearch.xpack.esql.core.type.DataType;
import org.elasticsearch.xpack.esql.parser.EsqlParser;
import org.elasticsearch.xpack.esql.parser.QueryParam;
Expand Down Expand Up @@ -663,6 +664,7 @@ public void testMatchFilter() throws Exception {
}

public void testMatchCommand() throws Exception {
assumeTrue("skipping because MATCH_COMMAND is not enabled", EsqlCapabilities.Cap.MATCH_COMMAND.isEnabled());
assertEquals("1:24: MATCH cannot be used after LIMIT", error("from test | limit 10 | match \"Anna\""));
assertEquals("1:13: MATCH cannot be used after SHOW", error("show info | match \"8.16.0\""));
assertEquals("1:17: MATCH cannot be used after ROW", error("row a= \"Anna\" | match \"Anna\""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.elasticsearch.xpack.core.enrich.EnrichPolicy;
import org.elasticsearch.xpack.esql.EsqlTestUtils;
import org.elasticsearch.xpack.esql.EsqlTestUtils.TestSearchStats;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
import org.elasticsearch.xpack.esql.analysis.Analyzer;
import org.elasticsearch.xpack.esql.analysis.AnalyzerContext;
import org.elasticsearch.xpack.esql.analysis.EnrichResolution;
Expand Down Expand Up @@ -384,6 +385,7 @@ public void testMultiCountAllWithFilter() {
* \_EsQueryExec[test], indexMode[standard], query[{"query_string":{"query":"\"last_name: Smith\""
*/
public void testMatchCommand() {
assumeTrue("skipping because MATCH_COMMAND is not enabled", EsqlCapabilities.Cap.MATCH_COMMAND.isEnabled());
var plan = plannerOptimizer.plan("""
from test
| match "last_name: Smith"
Expand Down Expand Up @@ -412,6 +414,7 @@ public void testMatchCommand() {
* }]
*/
public void testMatchCommandWithWhereClause() {
assumeTrue("skipping because MATCH_COMMAND is not enabled", EsqlCapabilities.Cap.MATCH_COMMAND.isEnabled());
var plan = plannerOptimizer.plan("""
from test
| where emp_no > 10010
Expand Down Expand Up @@ -444,6 +447,7 @@ public void testMatchCommandWithWhereClause() {
* sort[[FieldSort[field=emp_no{f}#3, direction=ASC, nulls=LAST]]]
*/
public void testMatchCommandWithMultipleMatches() {
assumeTrue("skipping because MATCH_COMMAND is not enabled", EsqlCapabilities.Cap.MATCH_COMMAND.isEnabled());
var plan = plannerOptimizer.plan("""
from test
| match "last_name: Smith"
Expand Down

0 comments on commit 7e5960b

Please sign in to comment.