Skip to content

Commit

Permalink
Fix testUpgradesLegitimateVersions (elastic#106248)
Browse files Browse the repository at this point in the history
DefaultBuildVersion has an assertion to only accept versions that are >=
0. This change updates a test generator to create versions accordingly.

Closes: elastic#106213
  • Loading branch information
idegtiarenko authored Mar 12, 2024
1 parent e42e47e commit 39779b7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class NodeMetadataTests extends ESTestCase {
// (Index)VersionUtils.randomVersion() only returns known versions, which are necessarily no later than (Index)Version.CURRENT;
// however we want to also consider our behaviour with all versions, so occasionally pick up a truly random version.
private Version randomVersion() {
return rarely() ? Version.fromId(randomInt()) : VersionUtils.randomVersion(random());
return rarely() ? Version.fromId(randomNonNegativeInt()) : VersionUtils.randomVersion(random());
}

private BuildVersion randomBuildVersion() {
Expand Down

0 comments on commit 39779b7

Please sign in to comment.