Skip to content

Commit c11fbc6

Browse files
committed
Update tests for removal of ::*
1 parent 16831d7 commit c11fbc6

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -505,16 +505,15 @@ public void testStringAsIndexPattern() {
505505
clusterAndIndexAsIndexPattern(command, "*:index*");
506506
clusterAndIndexAsIndexPattern(command, "*:*");
507507
if (EsqlCapabilities.Cap.INDEX_COMPONENT_SELECTORS.isEnabled()) {
508-
assertStringAsIndexPattern("foo::*", command + " foo::*");
509508
assertStringAsIndexPattern("foo::data", command + " foo::data");
510509
assertStringAsIndexPattern("foo::failures", command + " foo::failures");
511510
assertStringAsIndexPattern("cluster:foo::failures", command + " cluster:\"foo::failures\"");
512-
assertStringAsIndexPattern("*,-foo::*", command + " *, \"-foo\"::*");
513-
assertStringAsIndexPattern("*,-foo::*", command + " *, \"-foo::*\"");
514-
assertStringAsIndexPattern("*::*", command + " *::*");
511+
assertStringAsIndexPattern("*,-foo::data", command + " *, \"-foo\"::data");
512+
assertStringAsIndexPattern("*,-foo::data", command + " *, \"-foo::data\"");
513+
assertStringAsIndexPattern("*::data", command + " *::data");
515514
assertStringAsIndexPattern(
516-
"<logstash-{now/M{yyyy.MM}}>::*,<logstash-{now/d{yyyy.MM.dd|+12:00}}>::failures",
517-
command + " <logstash-{now/M{yyyy.MM}}>::*, \"<logstash-{now/d{yyyy.MM.dd|+12:00}}>\"::failures"
515+
"<logstash-{now/M{yyyy.MM}}>::data,<logstash-{now/d{yyyy.MM.dd|+12:00}}>::failures",
516+
command + " <logstash-{now/M{yyyy.MM}}>::data, \"<logstash-{now/d{yyyy.MM.dd|+12:00}}>\"::failures"
518517
);
519518
}
520519
}
@@ -605,25 +604,16 @@ public void testInvalidCharacterInIndexPattern() {
605604

606605
// Cluster name cannot be combined with selector yet.
607606
var parseLineNumber = command.contains("FROM") ? 6 : 9;
608-
expectDoubleColonErrorWithLineNumber(command, "cluster:foo::*", parseLineNumber + 11);
609607
expectDoubleColonErrorWithLineNumber(command, "cluster:foo::data", parseLineNumber + 11);
610608
expectDoubleColonErrorWithLineNumber(command, "cluster:foo::failures", parseLineNumber + 11);
611609

612-
expectDoubleColonErrorWithLineNumber(command, "cluster:\"foo\"::*", parseLineNumber + 13);
613610
expectDoubleColonErrorWithLineNumber(command, "cluster:\"foo\"::data", parseLineNumber + 13);
614611
expectDoubleColonErrorWithLineNumber(command, "cluster:\"foo\"::failures", parseLineNumber + 13);
615612

616613
// TODO: Edge case that will be invalidated in follow up (https://github.com/elastic/elasticsearch/issues/122651)
617-
// expectDoubleColonErrorWithLineNumber(command, "\"cluster:foo\"::*", parseLineNumber + 13);
618614
// expectDoubleColonErrorWithLineNumber(command, "\"cluster:foo\"::data", parseLineNumber + 13);
619615
// expectDoubleColonErrorWithLineNumber(command, "\"cluster:foo\"::failures", parseLineNumber + 13);
620616

621-
expectErrorWithLineNumber(
622-
command,
623-
"\"cluster:foo::*\"",
624-
lineNumber,
625-
"Cannot specify remote cluster and selector in same pattern"
626-
);
627617
expectErrorWithLineNumber(
628618
command,
629619
"\"cluster:foo::data\"",
@@ -639,10 +629,13 @@ public void testInvalidCharacterInIndexPattern() {
639629

640630
// Wildcards
641631
expectDoubleColonErrorWithLineNumber(command, "cluster:*::data", parseLineNumber + 9);
632+
expectDoubleColonErrorWithLineNumber(command, "cluster:*::failures", parseLineNumber + 9);
642633
expectDoubleColonErrorWithLineNumber(command, "*:index::data", parseLineNumber + 7);
643-
expectDoubleColonErrorWithLineNumber(command, "*:index::*", parseLineNumber + 7);
644-
expectDoubleColonErrorWithLineNumber(command, "*:index*::*", parseLineNumber + 8);
645-
expectDoubleColonErrorWithLineNumber(command, "*:*::*", parseLineNumber + 3);
634+
expectDoubleColonErrorWithLineNumber(command, "*:index::failures", parseLineNumber + 7);
635+
expectDoubleColonErrorWithLineNumber(command, "*:index*::data", parseLineNumber + 8);
636+
expectDoubleColonErrorWithLineNumber(command, "*:index*::failures", parseLineNumber + 8);
637+
expectDoubleColonErrorWithLineNumber(command, "*:*::data", parseLineNumber + 3);
638+
expectDoubleColonErrorWithLineNumber(command, "*:*::failures", parseLineNumber + 3);
646639

647640
// Too many colons
648641
expectInvalidIndexNameErrorWithLineNumber(command, "\"index:::data\"", lineNumber, "index:", "must not contain ':'");
@@ -730,43 +723,43 @@ public void testInvalidCharacterInIndexPattern() {
730723
"*, -index::garbage",
731724
lineNumber,
732725
"-index::garbage",
733-
"Invalid usage of :: separator, [garbage] is not a recognized selector"
726+
"invalid usage of :: separator, [garbage] is not a recognized selector"
734727
);
735728
expectInvalidIndexNameErrorWithLineNumber(
736729
command,
737730
"index*, -index::garbage",
738731
indexStarLineNumber,
739732
"-index::garbage",
740-
"Invalid usage of :: separator, [garbage] is not a recognized selector"
733+
"invalid usage of :: separator, [garbage] is not a recognized selector"
741734
);
742735
expectInvalidIndexNameErrorWithLineNumber(
743736
command,
744737
"*, -<logstash-{now/M{yyyy.MM}}>::garbage",
745738
lineNumber,
746739
"-<logstash-{now/M{yyyy.MM}}>::garbage",
747-
"Invalid usage of :: separator, [garbage] is not a recognized selector"
740+
"invalid usage of :: separator, [garbage] is not a recognized selector"
748741
);
749742
expectInvalidIndexNameErrorWithLineNumber(
750743
command,
751744
"index*, -<logstash-{now/M{yyyy.MM}}>::garbage",
752745
indexStarLineNumber,
753746
"-<logstash-{now/M{yyyy.MM}}>::garbage",
754-
"Invalid usage of :: separator, [garbage] is not a recognized selector"
747+
"invalid usage of :: separator, [garbage] is not a recognized selector"
755748
);
756749
// Invalid selectors will throw validation errors before invalid date math
757750
expectInvalidIndexNameErrorWithLineNumber(
758751
command,
759752
"\"*, -<-logstash-{now/D}>::d\"",
760753
commands.get(command),
761754
"-<-logstash-{now/D}>::d",
762-
"Invalid usage of :: separator, [d] is not a recognized selector"
755+
"invalid usage of :: separator, [d] is not a recognized selector"
763756
);
764757
expectInvalidIndexNameErrorWithLineNumber(
765758
command,
766759
"\"*, -<-logstash-{now/D}>::\"",
767760
commands.get(command),
768761
"-<-logstash-{now/D}>::",
769-
"Invalid usage of :: separator, [] is not a recognized selector"
762+
"invalid usage of :: separator, [] is not a recognized selector"
770763
);
771764
}
772765
}

0 commit comments

Comments
 (0)