Add test for the grouping error message if indices and cluster can't be disambiguated
This commit is contained in:
parent
88f6ae55f5
commit
197cd7d7a9
|
@ -201,7 +201,7 @@ public final class RemoteClusterService extends AbstractComponent implements Clo
|
|||
// remote_cluster_alias:index_name - for this case we fail the request. the user can easily change the cluster alias
|
||||
// if that happens
|
||||
throw new IllegalArgumentException("Index " + index + " exists but there is also a remote cluster named: "
|
||||
+ clusterName + " can't filter indices");
|
||||
+ remoteClusterName + " can't filter indices");
|
||||
}
|
||||
indexName = index.substring(i + 1);
|
||||
clusterName = remoteClusterName;
|
||||
|
|
|
@ -141,9 +141,12 @@ public class RemoteClusterServiceTests extends ESTestCase {
|
|||
assertEquals(Arrays.asList("bar", "test"), perClusterIndices.get("cluster_1"));
|
||||
assertEquals(Arrays.asList("foo:bar", "foo*"), perClusterIndices.get("cluster_2"));
|
||||
|
||||
expectThrows(IllegalArgumentException.class, () ->
|
||||
IllegalArgumentException iae = expectThrows(IllegalArgumentException.class, () ->
|
||||
service.groupClusterIndices(new String[]{"foo:bar", "cluster_1:bar",
|
||||
"cluster_2:foo:bar", "cluster_1:test", "cluster_2:foo*", "foo"}, i -> "cluster_1:bar".equals(i)));
|
||||
|
||||
assertEquals("Index cluster_1:bar exists but there is also a remote cluster named: cluster_1 can't filter indices",
|
||||
iae.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue