restore randomness in test
This commit is contained in:
parent
a6fe9a4212
commit
7f06c12c7f
|
@ -19,26 +19,18 @@
|
|||
|
||||
package org.elasticsearch.index.query;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomInts;
|
||||
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.query.AbstractQueryTestCase;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryShardContext;
|
||||
import org.elasticsearch.index.query.TemplateQueryBuilder;
|
||||
import org.elasticsearch.script.Script.ScriptParseException;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.script.Template;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class TemplateQueryBuilderTests extends AbstractQueryTestCase<TemplateQueryBuilder> {
|
||||
|
||||
|
@ -49,20 +41,7 @@ public class TemplateQueryBuilderTests extends AbstractQueryTestCase<TemplateQue
|
|||
|
||||
@BeforeClass
|
||||
public static void setupClass() {
|
||||
templateBase = createQuery(getRandom());
|
||||
}
|
||||
|
||||
static QueryBuilder<?> createQuery(Random r) {
|
||||
switch (RandomInts.randomIntBetween(r, 0, 2)) {
|
||||
case 0:
|
||||
return new MatchAllQueryBuilder();
|
||||
case 1:
|
||||
return new IdsQueryBuilder();
|
||||
case 2:
|
||||
return EmptyQueryBuilder.PROTOTYPE;
|
||||
default:
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
templateBase = RandomQueryBuilder.createQuery(getRandom());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue