Skip to content

Commit

Permalink
Fixed flaky test after PR that disallows functions to return TEXT (el…
Browse files Browse the repository at this point in the history
…astic#115633)

* Fixed flaky test after PR that disallows functions to return TEXT

* Also ignore TEXT/KEYWORD combinations because they are now valid

* Unmute the test
  • Loading branch information
craigtaverner authored and jfreden committed Nov 4, 2024
1 parent 8f65b4d commit 3b9a9cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,6 @@ tests:
- class: org.elasticsearch.oldrepos.OldRepositoryAccessIT
method: testOldRepoAccess
issue: https://github.com/elastic/elasticsearch/issues/115631
- class: org.elasticsearch.xpack.esql.analysis.AnalyzerTests
method: testMvAppendValidation
issue: https://github.com/elastic/elasticsearch/issues/115636

# Examples:
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
Expand Down Expand Up @@ -1879,14 +1880,19 @@ public void testMvAppendValidation() {
Supplier<Integer> supplier = () -> randomInt(fields.length - 1);
int first = supplier.get();
int second = randomValueOtherThan(first, supplier);
Function<String, String> noText = (type) -> type.equals("text") ? "keyword" : type;
assumeTrue(
"Ignore tests with TEXT and KEYWORD combinations because they are now valid",
noText.apply(fields[first][0]).equals(noText.apply(fields[second][0])) == false
);

String signature = "mv_append(" + fields[first][0] + ", " + fields[second][0] + ")";
verifyUnsupported(
" from test | eval " + signature,
"second argument of ["
+ signature
+ "] must be ["
+ fields[first][1]
+ noText.apply(fields[first][1])
+ "], found value ["
+ fields[second][0]
+ "] type ["
Expand Down

0 comments on commit 3b9a9cd

Please sign in to comment.