Skip to content

Commit

Permalink
Fix mutation function in JoinStatusTests (elastic#92534)
Browse files Browse the repository at this point in the history
Sometimes `mutateJoinStatus()` would fail to return a different object,
e.g. if the message was very short. Also in case 4 it was mutating both
the message and the age, but should not have been mutating the message.
  • Loading branch information
DaveCTurner committed Dec 23, 2022
1 parent fcaf082 commit d4176c4
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ private JoinStatus mutateJoinStatus(JoinStatus originalJoinStatus) {
return new JoinStatus(
originalJoinStatus.remoteNode(),
originalJoinStatus.term(),
randomAlphaOfLengthBetween(0, 30),
randomValueOtherThan(originalJoinStatus.message(), () -> randomAlphaOfLengthBetween(0, 30)),
originalJoinStatus.age()
);
}
case 3 -> {
return new JoinStatus(
originalJoinStatus.remoteNode(),
originalJoinStatus.term(),
randomAlphaOfLength(30),
randomNonNegativeTimeValue()
originalJoinStatus.message(),
randomValueOtherThan(originalJoinStatus.age(), this::randomNonNegativeTimeValue)
);
}
case 4 -> {
Expand Down

0 comments on commit d4176c4

Please sign in to comment.