Fix TranslogTests.testTotalTests when n=0 (#65632)
When n=0 in TranslogTests.testTotalTests we never update earliestLastModifiedAge so it fails comparison with default value of total.getEarliestLastModifiedAge() which is 0. In this change we always check this special case and then select n>0 Closes #65629
This commit is contained in:
parent
0137c1679b
commit
bb0fcb150b
|
@ -528,9 +528,15 @@ public class TranslogTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTotalTests() {
|
public void testTotalTests() {
|
||||||
final TranslogStats total =
|
final TranslogStats total = new TranslogStats();
|
||||||
new TranslogStats();
|
|
||||||
final int n = randomIntBetween(0, 16);
|
assertThat(total.estimatedNumberOfOperations(), equalTo(0));
|
||||||
|
assertThat(total.getTranslogSizeInBytes(), equalTo(0L));
|
||||||
|
assertThat(total.getUncommittedOperations(), equalTo(0));
|
||||||
|
assertThat(total.getUncommittedSizeInBytes(), equalTo(0L));
|
||||||
|
assertThat(total.getEarliestLastModifiedAge(), equalTo(0L));
|
||||||
|
|
||||||
|
final int n = randomIntBetween(1, 16);
|
||||||
final List<TranslogStats> statsList = new ArrayList<>(n);
|
final List<TranslogStats> statsList = new ArrayList<>(n);
|
||||||
long earliestLastModifiedAge = Long.MAX_VALUE;
|
long earliestLastModifiedAge = Long.MAX_VALUE;
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
|
|
Loading…
Reference in New Issue