[test] Fix random bounds
0 is invalid so we don't generate it any more.
This commit is contained in:
parent
b89e6cd5d8
commit
cd982ade99
|
@ -59,7 +59,6 @@ import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static java.lang.Math.abs;
|
|
||||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery;
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
|
@ -201,13 +200,13 @@ public class FunctionScoreQueryBuilderTests extends AbstractQueryTestCase<Functi
|
||||||
break;
|
break;
|
||||||
case DATE_FIELD_NAME:
|
case DATE_FIELD_NAME:
|
||||||
origin = new DateTime(System.currentTimeMillis() - randomIntBetween(0, 1000000), DateTimeZone.UTC).toString();
|
origin = new DateTime(System.currentTimeMillis() - randomIntBetween(0, 1000000), DateTimeZone.UTC).toString();
|
||||||
scale = randomTimeValue();
|
scale = randomPositiveTimeValue();
|
||||||
offset = randomTimeValue();
|
offset = randomPositiveTimeValue();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
origin = randomBoolean() ? randomInt() : randomFloat();
|
origin = randomBoolean() ? randomInt() : randomFloat();
|
||||||
scale = randomBoolean() ? abs(randomInt()) : abs(randomFloat());
|
scale = randomBoolean() ? between(1, Integer.MAX_VALUE) : randomFloat() + Float.MIN_NORMAL;
|
||||||
offset = randomBoolean() ? abs(randomInt()) : abs(randomFloat());
|
offset = randomBoolean() ? between(1, Integer.MAX_VALUE) : randomFloat() + Float.MIN_NORMAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
offset = randomBoolean() ? null : offset;
|
offset = randomBoolean() ? null : offset;
|
||||||
|
|
Loading…
Reference in New Issue