@@ -114,10 +114,11 @@ public void testSearchableSnapshotAction() throws Exception {
114
114
}
115
115
}, 30 , TimeUnit .SECONDS ));
116
116
117
- assertBusy (() -> {
118
- triggerStateChange ();
119
- assertThat (explainIndex (client (), restoredIndexName ).get ("step" ), is (PhaseCompleteStep .NAME ));
120
- }, 30 , TimeUnit .SECONDS );
117
+ assertBusy (
118
+ () -> { assertThat (explainIndex (client (), restoredIndexName ).get ("step" ), is (PhaseCompleteStep .NAME )); },
119
+ 30 ,
120
+ TimeUnit .SECONDS
121
+ );
121
122
}
122
123
123
124
public void testSearchableSnapshotForceMergesIndexToOneSegment () throws Exception {
@@ -174,10 +175,11 @@ public void testSearchableSnapshotForceMergesIndexToOneSegment() throws Exceptio
174
175
}
175
176
}, 60 , TimeUnit .SECONDS ));
176
177
177
- assertBusy (() -> {
178
- triggerStateChange ();
179
- assertThat (explainIndex (client (), restoredIndexName ).get ("step" ), is (PhaseCompleteStep .NAME ));
180
- }, 30 , TimeUnit .SECONDS );
178
+ assertBusy (
179
+ () -> { assertThat (explainIndex (client (), restoredIndexName ).get ("step" ), is (PhaseCompleteStep .NAME )); },
180
+ 30 ,
181
+ TimeUnit .SECONDS
182
+ );
181
183
}
182
184
183
185
@ SuppressWarnings ("unchecked" )
@@ -315,7 +317,6 @@ public void testUpdatePolicyToAddPhasesYieldsInvalidActionsToBeSkipped() throws
315
317
}, 30 , TimeUnit .SECONDS ));
316
318
317
319
assertBusy (() -> {
318
- triggerStateChange ();
319
320
Step .StepKey stepKeyForIndex = getStepKeyForIndex (client (), restoredIndexName );
320
321
assertThat (stepKeyForIndex .phase (), is ("hot" ));
321
322
assertThat (stepKeyForIndex .name (), is (PhaseCompleteStep .NAME ));
@@ -338,7 +339,6 @@ public void testUpdatePolicyToAddPhasesYieldsInvalidActionsToBeSkipped() throws
338
339
// even though the index is now mounted as a searchable snapshot, the actions that can't operate on it should
339
340
// skip and ILM should not be blocked (not should the managed index move into the ERROR step)
340
341
assertBusy (() -> {
341
- triggerStateChange ();
342
342
Step .StepKey stepKeyForIndex = getStepKeyForIndex (client (), restoredIndexName );
343
343
assertThat (stepKeyForIndex .phase (), is ("cold" ));
344
344
assertThat (stepKeyForIndex .name (), is (PhaseCompleteStep .NAME ));
@@ -394,7 +394,6 @@ public void testRestoredIndexManagedByLocalPolicySkipsIllegalActions() throws Ex
394
394
}, 30 , TimeUnit .SECONDS ));
395
395
396
396
assertBusy (() -> {
397
- triggerStateChange ();
398
397
Step .StepKey stepKeyForIndex = getStepKeyForIndex (client (), searchableSnapMountedIndexName );
399
398
assertThat (stepKeyForIndex .phase (), is ("hot" ));
400
399
assertThat (stepKeyForIndex .name (), is (PhaseCompleteStep .NAME ));
@@ -499,7 +498,6 @@ public void testIdenticalSearchableSnapshotActionIsNoop() throws Exception {
499
498
}, 30 , TimeUnit .SECONDS );
500
499
501
500
assertBusy (() -> {
502
- triggerStateChange ();
503
501
Step .StepKey stepKeyForIndex = getStepKeyForIndex (client (), searchableSnapMountedIndexName );
504
502
assertThat (stepKeyForIndex .phase (), is ("cold" ));
505
503
assertThat (stepKeyForIndex .name (), is (PhaseCompleteStep .NAME ));
@@ -561,7 +559,6 @@ public void testConvertingSearchableSnapshotFromFullToPartial() throws Exception
561
559
}, 30 , TimeUnit .SECONDS );
562
560
563
561
assertBusy (() -> {
564
- triggerStateChange ();
565
562
Step .StepKey stepKeyForIndex = getStepKeyForIndex (client (), searchableSnapMountedIndexName );
566
563
assertThat (stepKeyForIndex .phase (), is ("frozen" ));
567
564
assertThat (stepKeyForIndex .name (), is (PhaseCompleteStep .NAME ));
@@ -644,7 +641,6 @@ public void testResumingSearchableSnapshotFromFullToPartial() throws Exception {
644
641
}, 30 , TimeUnit .SECONDS );
645
642
646
643
assertBusy (() -> {
647
- triggerStateChange ();
648
644
Step .StepKey stepKeyForIndex = getStepKeyForIndex (client (), fullMountedIndexName );
649
645
assertThat (stepKeyForIndex .phase (), is ("cold" ));
650
646
assertThat (stepKeyForIndex .name (), is (PhaseCompleteStep .NAME ));
@@ -665,7 +661,6 @@ public void testResumingSearchableSnapshotFromFullToPartial() throws Exception {
665
661
}, 30 , TimeUnit .SECONDS );
666
662
667
663
assertBusy (() -> {
668
- triggerStateChange ();
669
664
Step .StepKey stepKeyForIndex = getStepKeyForIndex (client (), partiallyMountedIndexName );
670
665
assertThat (stepKeyForIndex .phase (), is ("frozen" ));
671
666
assertThat (stepKeyForIndex .name (), is (PhaseCompleteStep .NAME ));
@@ -755,7 +750,6 @@ public void testResumingSearchableSnapshotFromPartialToFull() throws Exception {
755
750
}, 30 , TimeUnit .SECONDS );
756
751
757
752
assertBusy (() -> {
758
- triggerStateChange ();
759
753
Step .StepKey stepKeyForIndex = getStepKeyForIndex (client (), partialMountedIndexName );
760
754
assertThat (stepKeyForIndex .phase (), is ("frozen" ));
761
755
assertThat (stepKeyForIndex .name (), is (PhaseCompleteStep .NAME ));
@@ -776,7 +770,6 @@ public void testResumingSearchableSnapshotFromPartialToFull() throws Exception {
776
770
}, 30 , TimeUnit .SECONDS );
777
771
778
772
assertBusy (() -> {
779
- triggerStateChange ();
780
773
Step .StepKey stepKeyForIndex = getStepKeyForIndex (client (), restoredPartiallyMountedIndexName );
781
774
assertThat (stepKeyForIndex .phase (), is ("cold" ));
782
775
assertThat (stepKeyForIndex .name (), is (PhaseCompleteStep .NAME ));
@@ -936,10 +929,11 @@ public void testSearchableSnapshotInvokesAsyncActionOnNewIndex() throws Exceptio
936
929
}
937
930
}, 30 , TimeUnit .SECONDS ));
938
931
939
- assertBusy (() -> {
940
- triggerStateChange ();
941
- assertThat (explainIndex (client (), restoredIndexName ).get ("step" ), is (PhaseCompleteStep .NAME ));
942
- }, 30 , TimeUnit .SECONDS );
932
+ assertBusy (
933
+ () -> { assertThat (explainIndex (client (), restoredIndexName ).get ("step" ), is (PhaseCompleteStep .NAME )); },
934
+ 30 ,
935
+ TimeUnit .SECONDS
936
+ );
943
937
}
944
938
945
939
public void testSearchableSnapshotTotalShardsPerNode () throws Exception {
@@ -980,7 +974,6 @@ public void testSearchableSnapshotTotalShardsPerNode() throws Exception {
980
974
assertTrue (indexExists (searchableSnapMountedIndexName ));
981
975
}, 30 , TimeUnit .SECONDS );
982
976
assertBusy (() -> {
983
- triggerStateChange ();
984
977
Step .StepKey stepKeyForIndex = getStepKeyForIndex (client (), searchableSnapMountedIndexName );
985
978
assertThat (stepKeyForIndex .phase (), is ("frozen" ));
986
979
assertThat (stepKeyForIndex .name (), is (PhaseCompleteStep .NAME ));
@@ -1044,7 +1037,6 @@ public void testSearchableSnapshotReplicateFor() throws Exception {
1044
1037
1045
1038
// check that the index is in the expected step and has the expected step_info.message
1046
1039
assertBusy (() -> {
1047
- triggerStateChange ();
1048
1040
Map <String , Object > explainResponse = explainIndex (client (), restoredIndexName );
1049
1041
assertThat (explainResponse .get ("step" ), is (WaitUntilReplicateForTimePassesStep .NAME ));
1050
1042
@ SuppressWarnings ("unchecked" )
@@ -1082,7 +1074,6 @@ public void testSearchableSnapshotReplicateFor() throws Exception {
1082
1074
1083
1075
// check that the index has progressed because enough time has passed now that the policy is different
1084
1076
assertBusy (() -> {
1085
- triggerStateChange ();
1086
1077
Map <String , Object > explainResponse = explainIndex (client (), restoredIndexName );
1087
1078
assertThat (explainResponse .get ("phase" ), is ("cold" ));
1088
1079
assertThat (explainResponse .get ("step" ), is (PhaseCompleteStep .NAME ));
@@ -1097,15 +1088,6 @@ public void testSearchableSnapshotReplicateFor() throws Exception {
1097
1088
}
1098
1089
}
1099
1090
1100
- /**
1101
- * Cause a bit of cluster activity using an empty reroute call in case the `wait-for-index-colour` ILM step missed the
1102
- * notification that partial-index is now GREEN.
1103
- */
1104
- private void triggerStateChange () throws IOException {
1105
- Request rerouteRequest = new Request ("POST" , "/_cluster/reroute" );
1106
- client ().performRequest (rerouteRequest );
1107
- }
1108
-
1109
1091
private Step .StepKey getKeyForIndex (Response response , String indexName ) throws IOException {
1110
1092
Map <String , Object > responseMap ;
1111
1093
try (InputStream is = response .getEntity ().getContent ()) {
0 commit comments