@@ -83,9 +83,10 @@ public void testHandleSpaces() { // see #21449
83
83
public void testAutoCreationDisabled () {
84
84
Settings settings = Settings .builder ().put (AutoCreateIndex .AUTO_CREATE_INDEX_SETTING .getKey (), false ).build ();
85
85
AutoCreateIndex autoCreateIndex = newAutoCreateIndex (settings );
86
+ String randomIndex = randomAlphaOfLengthBetween (1 , 10 );
86
87
IndexNotFoundException e = expectThrows (IndexNotFoundException .class , () ->
87
- autoCreateIndex .shouldAutoCreate (randomAlphaOfLengthBetween ( 1 , 10 ) , buildClusterState ()));
88
- assertEquals ("no such index and [action.auto_create_index] is [false]" , e .getMessage ());
88
+ autoCreateIndex .shouldAutoCreate (randomIndex , buildClusterState ()));
89
+ assertEquals ("no such index [" + randomIndex + "] and [action.auto_create_index] is [false]" , e .getMessage ());
89
90
}
90
91
91
92
public void testAutoCreationEnabled () {
@@ -207,14 +208,15 @@ private AutoCreateIndex newAutoCreateIndex(Settings settings) {
207
208
private void expectNotMatch (ClusterState clusterState , AutoCreateIndex autoCreateIndex , String index ) {
208
209
IndexNotFoundException e = expectThrows (IndexNotFoundException .class , () ->
209
210
autoCreateIndex .shouldAutoCreate (index , clusterState ));
210
- assertEquals ("no such index and [action.auto_create_index] ([" + autoCreateIndex .getAutoCreate () + "]) doesn't match" ,
211
- e .getMessage ());
211
+ assertEquals (
212
+ "no such index [" + index + "] and [action.auto_create_index] ([" + autoCreateIndex .getAutoCreate () + "]) doesn't match" ,
213
+ e .getMessage ());
212
214
}
213
215
214
216
private void expectForbidden (ClusterState clusterState , AutoCreateIndex autoCreateIndex , String index , String forbiddingPattern ) {
215
217
IndexNotFoundException e = expectThrows (IndexNotFoundException .class , () ->
216
218
autoCreateIndex .shouldAutoCreate (index , clusterState ));
217
- assertEquals ("no such index and [action.auto_create_index] contains [" + forbiddingPattern
219
+ assertEquals ("no such index [" + index + "] and [action.auto_create_index] contains [" + forbiddingPattern
218
220
+ "] which forbids automatic creation of the index" , e .getMessage ());
219
221
}
220
222
}
0 commit comments