[test] Fix random bounds

0 is invalid so we don't generate it any more.
This commit is contained in:
Nik Everett 2016-04-19 15:44:45 -04:00
parent b89e6cd5d8
commit cd982ade99
1 changed files with 4 additions and 5 deletions

View File

@ -59,7 +59,6 @@ import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import static java.lang.Math.abs;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
@ -201,13 +200,13 @@ public class FunctionScoreQueryBuilderTests extends AbstractQueryTestCase<Functi
break;
case DATE_FIELD_NAME:
origin = new DateTime(System.currentTimeMillis() - randomIntBetween(0, 1000000), DateTimeZone.UTC).toString();
scale = randomTimeValue();
offset = randomTimeValue();
scale = randomPositiveTimeValue();
offset = randomPositiveTimeValue();
break;
default:
origin = randomBoolean() ? randomInt() : randomFloat();
scale = randomBoolean() ? abs(randomInt()) : abs(randomFloat());
offset = randomBoolean() ? abs(randomInt()) : abs(randomFloat());
scale = randomBoolean() ? between(1, Integer.MAX_VALUE) : randomFloat() + Float.MIN_NORMAL;
offset = randomBoolean() ? between(1, Integer.MAX_VALUE) : randomFloat() + Float.MIN_NORMAL;
break;
}
offset = randomBoolean() ? null : offset;