Skip to content

Commit

Permalink
Avoid randomization bug in FeatureAwareTests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jasontedor committed Jun 2, 2018
1 parent ac9c154 commit 6539863
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public Optional<String> getRequiredFeature() {
}

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();
Expand Down

0 comments on commit 6539863

Please sign in to comment.