From 69383acecfe31172155abd4dd9f858ae1546efc3 Mon Sep 17 00:00:00 2001 From: Andrei Stefan Date: Mon, 2 Mar 2020 11:26:50 +0200 Subject: [PATCH] Define list of Nodes that have minimum two children in tests (#52957) (#52994) (cherry picked from commit c1e43e694f02edf3e197abbab7c21008c022b516) --- .../elasticsearch/xpack/ql/tree/NodeSubclassTests.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/ql/src/test/java/org/elasticsearch/xpack/ql/tree/NodeSubclassTests.java b/x-pack/plugin/ql/src/test/java/org/elasticsearch/xpack/ql/tree/NodeSubclassTests.java index e6cf3cd327e..4de4c75219d 100644 --- a/x-pack/plugin/ql/src/test/java/org/elasticsearch/xpack/ql/tree/NodeSubclassTests.java +++ b/x-pack/plugin/ql/src/test/java/org/elasticsearch/xpack/ql/tree/NodeSubclassTests.java @@ -24,6 +24,8 @@ import org.elasticsearch.xpack.ql.expression.gen.pipeline.Pipe; import org.elasticsearch.xpack.ql.expression.gen.processor.ConstantProcessor; import org.elasticsearch.xpack.ql.expression.gen.processor.Processor; import org.elasticsearch.xpack.ql.expression.predicate.fulltext.FullTextPredicate; +import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.In; +import org.elasticsearch.xpack.ql.expression.predicate.operator.comparison.InPipe; import org.elasticsearch.xpack.ql.expression.predicate.regex.Like; import org.elasticsearch.xpack.ql.expression.predicate.regex.LikePattern; import org.elasticsearch.xpack.ql.tree.NodeTests.ChildrenAreAProperty; @@ -56,6 +58,7 @@ import java.util.function.Supplier; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; +import static java.util.Arrays.asList; import static java.util.Collections.emptyList; import static java.util.stream.Collectors.toList; import static org.mockito.Mockito.mock; @@ -85,6 +88,8 @@ import static org.mockito.Mockito.mock; * */ public class NodeSubclassTests> extends ESTestCase { + + private static final List> CLASSES_WITH_MIN_TWO_CHILDREN = asList(In.class, InPipe.class); private final Class subclass; @@ -153,7 +158,6 @@ public class NodeSubclassTests> extends ESTestCas /** * Test {@link Node#replaceChildren} implementation on {@link #subclass}. */ - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/52951") public void testReplaceChildren() throws Exception { Constructor ctor = longestCtor(subclass); Object[] nodeCtorArgs = ctorArgs(ctor); @@ -564,7 +568,7 @@ public class NodeSubclassTests> extends ESTestCas } protected boolean hasAtLeastTwoChildren(Class> toBuildClass) { - return false; + return CLASSES_WITH_MIN_TWO_CHILDREN.stream().anyMatch(toBuildClass::equals); } private List makeListOfSameSizeOtherThan(Type listType, List original) throws Exception {