Skip to content

Commit 15a4b10

Browse files
committed
Fix testValidFromPattern (elastic#121996)
(cherry picked from commit c92b7b5)
1 parent 8e8156c commit 15a4b10

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,6 @@ tests:
363363
- class: org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT
364364
method: testFailIfMetadataBlockSet
365365
issue: https://github.com/elastic/elasticsearch/issues/121978
366-
- class: org.elasticsearch.xpack.esql.parser.StatementParserTests
367-
method: testValidFromPattern
368-
issue: https://github.com/elastic/elasticsearch/issues/121990
369366

370367
# Examples:
371368
#

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,17 @@ public static String randomIndexPattern(Feature... features) {
7878
index.insert(0, "-");
7979
}
8080

81-
var pattern = maybeQuote(index.toString());
81+
var pattern = index.toString();
82+
if (pattern.contains("|")) {
83+
pattern = quote(pattern);
84+
}
85+
pattern = maybeQuote(pattern);
86+
8287
if (canAdd(Features.CROSS_CLUSTER, features)) {
8388
var cluster = maybeQuote(randomIdentifier());
8489
pattern = maybeQuote(cluster + ":" + pattern);
8590
}
8691

87-
if (pattern.contains("|") && pattern.contains("\"") == false) {
88-
pattern = quote(pattern);
89-
}
90-
9192
return pattern;
9293
}
9394

0 commit comments

Comments
 (0)