|
28 | 28 | import org.elasticsearch.threadpool.ThreadPool; |
29 | 29 | import org.junit.After; |
30 | 30 | import org.junit.AfterClass; |
| 31 | +import org.junit.Before; |
31 | 32 | import org.junit.BeforeClass; |
32 | 33 |
|
33 | 34 | import java.io.IOException; |
@@ -534,7 +535,7 @@ public void testAbortingOrRunningMergeTaskHoldsUpBudget() throws Exception { |
534 | 535 | aFileStore.totalSpace = randomLongBetween(1_000L, 10_000L); |
535 | 536 | bFileStore.totalSpace = randomLongBetween(1_000L, 10_000L); |
536 | 537 | aFileStore.usableSpace = randomLongBetween(900L, aFileStore.totalSpace); |
537 | | - bFileStore.usableSpace = randomLongBetween(900L, bFileStore.totalSpace); |
| 538 | + bFileStore.usableSpace = randomValueOtherThan(aFileStore.usableSpace, () -> randomLongBetween(900L, bFileStore.totalSpace)); |
538 | 539 | boolean aHasMoreSpace = aFileStore.usableSpace > bFileStore.usableSpace; |
539 | 540 | try ( |
540 | 541 | ThreadPoolMergeExecutorService threadPoolMergeExecutorService = ThreadPoolMergeExecutorService |
@@ -613,7 +614,7 @@ public void testBackloggedMergeTasksDoNotHoldUpBudget() throws Exception { |
613 | 614 | aFileStore.totalSpace = randomLongBetween(1_000L, 10_000L); |
614 | 615 | bFileStore.totalSpace = randomLongBetween(1_000L, 10_000L); |
615 | 616 | aFileStore.usableSpace = randomLongBetween(900L, aFileStore.totalSpace); |
616 | | - bFileStore.usableSpace = randomLongBetween(900L, bFileStore.totalSpace); |
| 617 | + bFileStore.usableSpace = randomValueOtherThan(aFileStore.usableSpace, () -> randomLongBetween(900L, bFileStore.totalSpace)); |
617 | 618 | boolean aHasMoreSpace = aFileStore.usableSpace > bFileStore.usableSpace; |
618 | 619 | try ( |
619 | 620 | ThreadPoolMergeExecutorService threadPoolMergeExecutorService = ThreadPoolMergeExecutorService |
@@ -900,7 +901,7 @@ public void testEnqueuedMergeTasksAreUnblockedWhenEstimatedMergeSizeChanges() th |
900 | 901 | long diskSpaceLimitBytes = randomLongBetween(10L, 100L); |
901 | 902 | aFileStore.usableSpace = diskSpaceLimitBytes + randomLongBetween(1L, 100L); |
902 | 903 | aFileStore.totalSpace = aFileStore.usableSpace + randomLongBetween(1L, 10L); |
903 | | - bFileStore.usableSpace = diskSpaceLimitBytes + randomLongBetween(1L, 100L); |
| 904 | + bFileStore.usableSpace = randomValueOtherThan(aFileStore.usableSpace, () -> diskSpaceLimitBytes + randomLongBetween(1L, 100L)); |
904 | 905 | bFileStore.totalSpace = bFileStore.usableSpace + randomLongBetween(1L, 10L); |
905 | 906 | boolean aHasMoreSpace = aFileStore.usableSpace > bFileStore.usableSpace; |
906 | 907 | Settings.Builder settingsBuilder = Settings.builder().put(settings); |
@@ -1001,7 +1002,10 @@ public void testMergeTasksAreUnblockedWhenMoreDiskSpaceBecomesAvailable() throws |
1001 | 1002 | bFileStore.totalSpace = randomLongBetween(300L, 1_000L); |
1002 | 1003 | long grantedUsableSpaceBuffer = randomLongBetween(10L, 50L); |
1003 | 1004 | aFileStore.usableSpace = randomLongBetween(200L, aFileStore.totalSpace - grantedUsableSpaceBuffer); |
1004 | | - bFileStore.usableSpace = randomLongBetween(200L, bFileStore.totalSpace - grantedUsableSpaceBuffer); |
| 1005 | + bFileStore.usableSpace = randomValueOtherThan( |
| 1006 | + aFileStore.usableSpace, |
| 1007 | + () -> randomLongBetween(200L, bFileStore.totalSpace - grantedUsableSpaceBuffer) |
| 1008 | + ); |
1005 | 1009 | boolean aHasMoreSpace = aFileStore.usableSpace > bFileStore.usableSpace; |
1006 | 1010 | Settings.Builder settingsBuilder = Settings.builder().put(settings); |
1007 | 1011 | // change the watermark level, just for coverage and it's easier with the calculations |
|
0 commit comments