@@ -79,11 +79,13 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase {
7979
8080 private String index ;
8181 private String policy ;
82+ private String alias ;
8283
8384 @ Before
8485 public void refreshIndex () {
85- index = randomAlphaOfLength (10 ).toLowerCase (Locale .ROOT );
86- policy = randomAlphaOfLength (5 );
86+ index = "index-" + randomAlphaOfLength (10 ).toLowerCase (Locale .ROOT );
87+ policy = "policy-" + randomAlphaOfLength (5 );
88+ alias = "alias-" + randomAlphaOfLength (5 );
8789 }
8890
8991 public static void updatePolicy (String indexName , String policy ) throws IOException {
@@ -101,7 +103,7 @@ public void testFullPolicy() throws Exception {
101103 createIndexWithSettings (originalIndex , Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 4 )
102104 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
103105 .put ("index.routing.allocation.include._name" , "integTest-0" )
104- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ));
106+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ));
105107
106108 // create policy
107109 createFullPolicy (TimeValue .ZERO );
@@ -163,7 +165,7 @@ public void testMoveToRolloverStep() throws Exception {
163165 createIndexWithSettings (originalIndex , Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 4 )
164166 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
165167 .put ("index.routing.allocation.include._name" , "integTest-0" )
166- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ));
168+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ));
167169
168170 createFullPolicy (TimeValue .timeValueHours (10 ));
169171 // update policy on index
@@ -243,7 +245,7 @@ public void testRolloverAction() throws Exception {
243245 String secondIndex = index + "-000002" ;
244246 createIndexWithSettings (originalIndex , Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
245247 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
246- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ));
248+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ));
247249
248250 // create policy
249251 createNewSingletonPolicy ("hot" , new RolloverAction (null , null , 1L ));
@@ -261,7 +263,7 @@ public void testRolloverActionWithIndexingComplete() throws Exception {
261263 String secondIndex = index + "-000002" ;
262264 createIndexWithSettings (originalIndex , Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
263265 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
264- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ));
266+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ));
265267
266268 Request updateSettingsRequest = new Request ("PUT" , "/" + originalIndex + "/_settings" );
267269 updateSettingsRequest .setJsonEntity ("{\n " +
@@ -276,7 +278,7 @@ public void testRolloverActionWithIndexingComplete() throws Exception {
276278 " {\n " +
277279 " \" add\" : {\n " +
278280 " \" index\" : \" " + originalIndex + "\" ,\n " +
279- " \" alias\" : \" alias\" ,\n " +
281+ " \" alias\" : \" " + alias + " \" ,\n " +
280282 " \" is_write_index\" : false\n " +
281283 " }\n " +
282284 " }\n " +
@@ -352,7 +354,7 @@ public void testWaitForSnapshot() throws Exception {
352354 request = new Request ("DELETE" , "/_snapshot/" + repo );
353355 assertOK (client ().performRequest (request ));
354356 }
355-
357+
356358 public void testWaitForSnapshotSlmExecutedBefore () throws Exception {
357359 createIndexWithSettings (index , Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
358360 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 ));
@@ -776,7 +778,7 @@ public void testRemoveAndReaddPolicy() throws Exception {
776778 Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
777779 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
778780 .put (LifecycleSettings .LIFECYCLE_NAME , policy )
779- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ));
781+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ));
780782
781783 // Index a document
782784 index (client (), originalIndex , "_id" , "foo" , "bar" );
@@ -794,7 +796,7 @@ public void testRemoveAndReaddPolicy() throws Exception {
794796 addPolicyRequest .setJsonEntity ("{\n " +
795797 " \" settings\" : {\n " +
796798 " \" index.lifecycle.name\" : \" " + policy + "\" ,\n " +
797- " \" index.lifecycle.rollover_alias\" : \" alias\" \n " +
799+ " \" index.lifecycle.rollover_alias\" : \" " + alias + " \" \n " +
798800 " }\n " +
799801 "}" );
800802 client ().performRequest (addPolicyRequest );
@@ -811,7 +813,7 @@ public void testMoveToInjectedStep() throws Exception {
811813 createIndexWithSettings (index , Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 3 )
812814 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
813815 .put (LifecycleSettings .LIFECYCLE_NAME , policy )
814- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ));
816+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ));
815817
816818 assertBusy (() -> assertThat (getStepKeyForIndex (index ), equalTo (new StepKey ("new" , "complete" , "complete" ))));
817819
@@ -847,7 +849,7 @@ public void testMoveToStepRereadsPolicy() throws Exception {
847849 .put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
848850 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
849851 .put (LifecycleSettings .LIFECYCLE_NAME , policy )
850- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ),
852+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ),
851853 true );
852854
853855 assertBusy (() -> assertThat (getStepKeyForIndex ("test-1" ), equalTo (new StepKey ("hot" , "rollover" , "check-rollover-ready" ))));
@@ -924,7 +926,7 @@ public void testExplainFilters() throws Exception {
924926 }
925927
926928 createIndexWithSettings (goodIndex , Settings .builder ()
927- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" )
929+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias )
928930 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
929931 .put (LifecycleSettings .LIFECYCLE_NAME , policy )
930932 );
@@ -983,7 +985,7 @@ public void testILMRolloverRetriesOnReadOnlyBlock() throws Exception {
983985 Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
984986 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
985987 .put (LifecycleSettings .LIFECYCLE_NAME , policy )
986- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" )
988+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias )
987989 .put ("index.blocks.read_only" , true ),
988990 true
989991 );
@@ -1018,7 +1020,7 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception {
10181020 " \" number_of_shards\" : 1,\n " +
10191021 " \" number_of_replicas\" : 0,\n " +
10201022 " \" index.lifecycle.name\" : \" " + policy + "\" , \n " +
1021- " \" index.lifecycle.rollover_alias\" : \" alias\" \n " +
1023+ " \" index.lifecycle.rollover_alias\" : \" " + alias + " \" \n " +
10221024 " }\n " +
10231025 "}" );
10241026 client ().performRequest (createIndexTemplate );
@@ -1036,7 +1038,7 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception {
10361038 client ().performRequest (refreshOriginalIndex );
10371039
10381040 // Manual rollover
1039- Request rolloverRequest = new Request ("POST" , "/alias/_rollover" );
1041+ Request rolloverRequest = new Request ("POST" , "/" + alias + " /_rollover" );
10401042 rolloverRequest .setJsonEntity ("{\n " +
10411043 " \" conditions\" : {\n " +
10421044 " \" max_docs\" : \" 1\" \n " +
@@ -1057,9 +1059,9 @@ public void testILMRolloverOnManuallyRolledIndex() throws Exception {
10571059 assertBusy (() -> assertTrue ((boolean ) explainIndex (secondIndex ).getOrDefault ("managed" , true )));
10581060
10591061 // index some documents to trigger an ILM rollover
1060- index (client (), " alias" , "1" , "foo" , "bar" );
1061- index (client (), " alias" , "2" , "foo" , "bar" );
1062- index (client (), " alias" , "3" , "foo" , "bar" );
1062+ index (client (), alias , "1" , "foo" , "bar" );
1063+ index (client (), alias , "2" , "foo" , "bar" );
1064+ index (client (), alias , "3" , "foo" , "bar" );
10631065 Request refreshSecondIndex = new Request ("POST" , "/" + secondIndex + "/_refresh" );
10641066 client ().performRequest (refreshSecondIndex ).getStatusLine ();
10651067
@@ -1079,7 +1081,7 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except
10791081 rolledIndex ,
10801082 Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
10811083 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
1082- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ),
1084+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ),
10831085 false
10841086 );
10851087
@@ -1088,7 +1090,7 @@ public void testRolloverStepRetriesUntilRolledOverIndexIsDeleted() throws Except
10881090 Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
10891091 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
10901092 .put (LifecycleSettings .LIFECYCLE_NAME , policy )
1091- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ),
1093+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ),
10921094 true
10931095 );
10941096
@@ -1151,7 +1153,7 @@ public void testUpdateRolloverLifecycleDateStepRetriesWhenRolloverInfoIsMissing(
11511153 Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
11521154 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
11531155 .put (LifecycleSettings .LIFECYCLE_NAME , policy )
1154- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ),
1156+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ),
11551157 true
11561158 );
11571159
@@ -1191,7 +1193,7 @@ public void testUpdateRolloverLifecycleDateStepRetriesWhenRolloverInfoIsMissing(
11911193
11921194 // manual rollover the index so the "update-rollover-lifecycle-date" ILM step can continue and finish successfully as the index
11931195 // will have rollover information now
1194- Request rolloverRequest = new Request ("POST" , "/alias/_rollover" );
1196+ Request rolloverRequest = new Request ("POST" , "/" + alias + " /_rollover" );
11951197 rolloverRequest .setJsonEntity ("{\n " +
11961198 " \" conditions\" : {\n " +
11971199 " \" max_docs\" : \" 1\" \n " +
@@ -1207,7 +1209,7 @@ public void testWaitForActiveShardsStep() throws Exception {
12071209 String secondIndex = index + "-000002" ;
12081210 createIndexWithSettings (originalIndex , Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
12091211 .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
1210- .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , " alias" ),
1212+ .put (RolloverAction .LIFECYCLE_ROLLOVER_ALIAS , alias ),
12111213 true );
12121214
12131215 // create policy
@@ -1249,7 +1251,7 @@ public void testHistoryIsWrittenWithSuccess() throws Exception {
12491251 " \" number_of_shards\" : 1,\n " +
12501252 " \" number_of_replicas\" : 0,\n " +
12511253 " \" index.lifecycle.name\" : \" " + policy + "\" ,\n " +
1252- " \" index.lifecycle.rollover_alias\" : \" alias\" \n " +
1254+ " \" index.lifecycle.rollover_alias\" : \" " + alias + " \" \n " +
12531255 " }\n " +
12541256 "}" );
12551257 client ().performRequest (createIndexTemplate );
@@ -1402,7 +1404,7 @@ public void testRefreshablePhaseJson() throws Exception {
14021404 " \" number_of_shards\" : 1,\n " +
14031405 " \" number_of_replicas\" : 0,\n " +
14041406 " \" index.lifecycle.name\" : \" " + policy + "\" ,\n " +
1405- " \" index.lifecycle.rollover_alias\" : \" alias\" \n " +
1407+ " \" index.lifecycle.rollover_alias\" : \" " + alias + " \" \n " +
14061408 " }\n " +
14071409 "}" );
14081410 client ().performRequest (createIndexTemplate );
@@ -1584,7 +1586,7 @@ private void createIndexWithSettings(String index, Settings.Builder settings, bo
15841586 writeIndexSnippet = "\" is_write_index\" : true" ;
15851587 }
15861588 request .setJsonEntity ("{\n \" settings\" : " + Strings .toString (settings .build ())
1587- + ", \" aliases\" : { \" alias\" : { " + writeIndexSnippet + " } } }" );
1589+ + ", \" aliases\" : { \" " + alias + " \" : { " + writeIndexSnippet + " } } }" );
15881590 client ().performRequest (request );
15891591 // wait for the shards to initialize
15901592 ensureGreen (index );
0 commit comments