Skip to content

Commit 12e0e55

Browse files
assert deprecation warnings in tests
1 parent 53009b2 commit 12e0e55

File tree

6 files changed

+78
-1
lines changed

6 files changed

+78
-1
lines changed

server/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationAllPermitsAcquisitionTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ void runWithPrimaryShardReference(final TransportReplicationAction.PrimaryShardR
391391
}
392392
}
393393
}
394+
assertWarnings(
395+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
396+
+ "See the breaking changes documentation for the next major version."
397+
);
394398
}
395399

396400
private void assertSuccessfulOperation(final TestAction action, final Response response) {

server/src/test/java/org/elasticsearch/index/engine/ThreadPoolMergeExecutorServiceDiskSpaceTests.java

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class ThreadPoolMergeExecutorServiceDiskSpaceTests extends ESTestCase {
6767
private static Settings settings;
6868
private static TestCapturingThreadPool testThreadPool;
6969
private static NodeEnvironment nodeEnvironment;
70+
private static boolean setThreadPoolMergeSchedulerSetting;
7071

7172
@BeforeClass
7273
public static void installMockUsableSpaceFS() throws Exception {
@@ -86,7 +87,8 @@ public static void installMockUsableSpaceFS() throws Exception {
8687
// the default of "5s" slows down testing
8788
.put(ThreadPoolMergeExecutorService.INDICES_MERGE_DISK_CHECK_INTERVAL_SETTING.getKey(), "50ms")
8889
.put(EsExecutors.NODE_PROCESSORS_SETTING.getKey(), mergeExecutorThreadCount);
89-
if (randomBoolean()) {
90+
setThreadPoolMergeSchedulerSetting = randomBoolean();
91+
if (setThreadPoolMergeSchedulerSetting) {
9092
settingsBuilder.put(ThreadPoolMergeScheduler.USE_THREAD_POOL_MERGE_SCHEDULER_SETTING.getKey(), true);
9193
}
9294
settings = settingsBuilder.build();
@@ -520,6 +522,12 @@ public void testAvailableDiskSpaceMonitorSettingsUpdate() throws Exception {
520522
}
521523
}, 5, TimeUnit.SECONDS);
522524
}
525+
if (setThreadPoolMergeSchedulerSetting) {
526+
assertWarnings(
527+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
528+
+ "See the breaking changes documentation for the next major version."
529+
);
530+
}
523531
}
524532

525533
public void testAbortingOrRunningMergeTaskHoldsUpBudget() throws Exception {
@@ -593,6 +601,12 @@ public void testAbortingOrRunningMergeTaskHoldsUpBudget() throws Exception {
593601
assertThat(threadPoolMergeExecutorService.allDone(), is(true));
594602
});
595603
}
604+
if (setThreadPoolMergeSchedulerSetting) {
605+
assertWarnings(
606+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
607+
+ "See the breaking changes documentation for the next major version."
608+
);
609+
}
596610
}
597611

598612
public void testBackloggedMergeTasksDoNotHoldUpBudget() throws Exception {
@@ -731,6 +745,12 @@ && randomBoolean()) {
731745
assertThat(threadPoolMergeExecutorService.allDone(), is(true));
732746
});
733747
}
748+
if (setThreadPoolMergeSchedulerSetting) {
749+
assertWarnings(
750+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
751+
+ "See the breaking changes documentation for the next major version."
752+
);
753+
}
734754
}
735755

736756
public void testUnavailableBudgetBlocksNewMergeTasksFromStartingExecution() throws Exception {
@@ -868,6 +888,12 @@ public void testUnavailableBudgetBlocksNewMergeTasksFromStartingExecution() thro
868888
assertThat(threadPoolMergeExecutorService.allDone(), is(true));
869889
});
870890
}
891+
if (setThreadPoolMergeSchedulerSetting) {
892+
assertWarnings(
893+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
894+
+ "See the breaking changes documentation for the next major version."
895+
);
896+
}
871897
}
872898

873899
public void testMergeTasksAreUnblockedWhenMoreDiskSpaceBecomesAvailable() throws Exception {
@@ -1019,5 +1045,11 @@ public void testMergeTasksAreUnblockedWhenMoreDiskSpaceBecomesAvailable() throws
10191045
);
10201046
});
10211047
}
1048+
if (setThreadPoolMergeSchedulerSetting) {
1049+
assertWarnings(
1050+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
1051+
+ "See the breaking changes documentation for the next major version."
1052+
);
1053+
}
10221054
}
10231055
}

server/src/test/java/org/elasticsearch/index/engine/ThreadPoolMergeExecutorServiceTests.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ public void testEnqueuedAndBackloggedMergesAreStillExecutedWhenThreadPoolIsShutd
211211
});
212212
assertThat(countingListener.aborted.get() + countingListener.completed.get(), equalTo(doneMergesCount.get()));
213213
assertThat(countingListener.aborted.get(), equalTo(abortedMergesCount.get()));
214+
assertWarnings(
215+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
216+
+ "See the breaking changes documentation for the next major version."
217+
);
214218
}
215219

216220
public void testTargetIORateChangesWhenSubmittingMergeTasks() throws Exception {
@@ -298,6 +302,10 @@ public void testTargetIORateChangesWhenSubmittingMergeTasks() throws Exception {
298302
}
299303
assertBusy(() -> assertTrue(threadPoolMergeExecutorService.allDone()));
300304
}
305+
assertWarnings(
306+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
307+
+ "See the breaking changes documentation for the next major version."
308+
);
301309
}
302310

303311
public void testIORateIsAdjustedForAllRunningMergeTasks() throws Exception {
@@ -386,6 +394,10 @@ public void testIORateIsAdjustedForAllRunningMergeTasks() throws Exception {
386394
}
387395
assertBusy(() -> assertTrue(threadPoolMergeExecutorService.allDone()));
388396
}
397+
assertWarnings(
398+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
399+
+ "See the breaking changes documentation for the next major version."
400+
);
389401
}
390402

391403
public void testIORateAdjustedForSubmittedTasksWhenExecutionRateIsSpeedy() throws IOException {
@@ -567,6 +579,10 @@ public void testMergeTasksRunConcurrently() throws Exception {
567579
}
568580
assertBusy(() -> assertTrue(threadPoolMergeExecutorService.allDone()));
569581
}
582+
assertWarnings(
583+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
584+
+ "See the breaking changes documentation for the next major version."
585+
);
570586
}
571587

572588
public void testThreadPoolStatsWithBackloggedMergeTasks() throws Exception {
@@ -626,6 +642,10 @@ public void testThreadPoolStatsWithBackloggedMergeTasks() throws Exception {
626642
assertTrue(threadPoolMergeExecutorService.allDone());
627643
});
628644
}
645+
assertWarnings(
646+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
647+
+ "See the breaking changes documentation for the next major version."
648+
);
629649
}
630650

631651
public void testBackloggedMergeTasksExecuteExactlyOnce() throws Exception {
@@ -697,6 +717,10 @@ public void testBackloggedMergeTasksExecuteExactlyOnce() throws Exception {
697717
assertTrue(threadPoolMergeExecutorService.allDone());
698718
});
699719
}
720+
assertWarnings(
721+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
722+
+ "See the breaking changes documentation for the next major version."
723+
);
700724
}
701725

702726
public void testMergeTasksExecuteInSizeOrder() throws IOException {

server/src/test/java/org/elasticsearch/index/replication/IndexLevelReplicationTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,10 @@ public void testLateDeliveryAfterGCTriggeredOnReplica() throws Exception {
666666
indexOnReplica(indexRequest, shards, replica); // index arrives on replica lately.
667667
shards.assertAllEqual(0);
668668
}
669+
assertWarnings(
670+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
671+
+ "See the breaking changes documentation for the next major version."
672+
);
669673
}
670674

671675
private void updateGCDeleteCycle(IndexShard shard, TimeValue interval) {

server/src/test/java/org/elasticsearch/index/shard/RefreshListenersTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ public void onFailedEngine(String reason, @Nullable Exception e) {
186186

187187
@After
188188
public void tearDownListeners() throws Exception {
189+
assertWarnings(
190+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
191+
+ "See the breaking changes documentation for the next major version."
192+
);
189193
IOUtils.close(engine, store, nodeEnvironment, () -> terminate(threadPool));
190194
}
191195

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/repository/CcrRestoreSourceServiceTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.index.store.Store;
2525
import org.elasticsearch.index.store.StoreFileMetadata;
2626
import org.elasticsearch.xpack.ccr.CcrSettings;
27+
import org.junit.After;
2728
import org.junit.Before;
2829

2930
import java.io.IOException;
@@ -49,6 +50,14 @@ public void setUp() throws Exception {
4950
restoreSourceService = new CcrRestoreSourceService(taskQueue.getThreadPool(), new CcrSettings(Settings.EMPTY, clusterSettings));
5051
}
5152

53+
@After
54+
public void assertWarnings() {
55+
assertWarnings(
56+
"[indices.merge.scheduler.use_thread_pool] setting was deprecated in Elasticsearch and will be removed in a future release. "
57+
+ "See the breaking changes documentation for the next major version."
58+
);
59+
}
60+
5261
public void testOpenSession() throws IOException {
5362
IndexShard indexShard1 = newStartedShard(true);
5463
IndexShard indexShard2 = newStartedShard(true);

0 commit comments

Comments
 (0)