Avoid randomization bug in FeatureAwareTests

We compute a random version and later try to compute the version prior
that random version. If the random version is the earliest version in
our list of versions then it, by definition, does not have a previous
version. Yet trying to find its previous is someting we do and so the
test fails. This commit adds a version check to the randomization so
that we do not select the earliest version in our list.
This commit is contained in:
Jason Tedor 2018-06-01 22:49:51 -04:00
parent 3670a2ae05
commit 5bfe2ba469
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
1 changed files with 1 additions and 1 deletions

View File

@ -107,7 +107,7 @@ public class FeatureAwareTests extends ESTestCase {
}
public void testVersion() {
final Version version = VersionUtils.randomVersion(random());
final Version version = randomValueOtherThan(VersionUtils.getFirstVersion(), () -> VersionUtils.randomVersion(random()));
for (final Custom custom : Arrays.asList(new NoRequiredFeatureCustom(version), new RequiredFeatureCustom(version))) {
{
final BytesStreamOutput out = new BytesStreamOutput();