Skip to content

Commit

Permalink
Define list of Nodes that have minimum two children in tests (#52957)…
Browse files Browse the repository at this point in the history
… (#52994)

(cherry picked from commit c1e43e694f02edf3e197abbab7c21008c022b516)
  • Loading branch information
astefan authored Mar 2, 2020
1 parent 49f41d1 commit 69383ac
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
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;
Expand Down Expand Up @@ -56,6 +58,7 @@
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;
Expand Down Expand Up @@ -85,6 +88,8 @@
* </ul>
*/
public class NodeSubclassTests<T extends B, B extends Node<B>> extends ESTestCase {

private static final List<Class<?>> CLASSES_WITH_MIN_TWO_CHILDREN = asList(In.class, InPipe.class);

private final Class<T> subclass;

Expand Down Expand Up @@ -153,7 +158,6 @@ public void testTransform() throws Exception {
/**
* Test {@link Node#replaceChildren} implementation on {@link #subclass}.
*/
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/52951")
public void testReplaceChildren() throws Exception {
Constructor<T> ctor = longestCtor(subclass);
Object[] nodeCtorArgs = ctorArgs(ctor);
Expand Down Expand Up @@ -564,7 +568,7 @@ private int randomSizeForCollection(Class<? extends Node<?>> toBuildClass) {
}

protected boolean hasAtLeastTwoChildren(Class<? extends Node<?>> toBuildClass) {
return false;
return CLASSES_WITH_MIN_TWO_CHILDREN.stream().anyMatch(toBuildClass::equals);
}

private List<?> makeListOfSameSizeOtherThan(Type listType, List<?> original) throws Exception {
Expand Down

0 comments on commit 69383ac

Please sign in to comment.