server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java
Set<String> blockedIndices,
        Collection<DiscoveryNode> nodes,
        Map<String, Set<String>> indexNameToNodeIdsMap
    ) {
        DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder();
        for (DiscoveryNode node : nodes) {
            nodesBuilder = nodesBuilder.add(node);
        }
        nodesBuilder.localNodeId(randomFrom(nodes).getId());
        nodesBuilder.masterNodeId(randomFrom(nodes).getId());
        ClusterBlocks.Builder clusterBlocksBuilder = new ClusterBlocks.Builder();
        Metadata.Builder metadata = Metadata.builder();
        RoutingTable.Builder routingTable = RoutingTable.builder();
        for (String index : indexNameToNodeIdsMap.keySet()) {
            int numberOfShards = indexNameToNodeIdsMap.get(index).size() == 0 ? 1 : indexNameToNodeIdsMap.get(index).size();
            IndexMetadata indexMetadata = IndexMetadata.builder(index)
                .settings(
                    Settings.builder()
                        .put(SETTING_VERSION_CREATED, Version.CURRENT)
                        .put(SETTING_NUMBER_OF_SHARDS, numberOfShards)
                        .put(SETTING_NUMBER_OF_REPLICAS, 0)
                        .put(SETTING_CREATION_DATE, System.currentTimeMillis())
                        .put(IndexMetadata.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.getKey(), blockedIndices.contains(index))
                )
                .build();
            if (blockedIndices.contains(index)) {
                clusterBlocksBuilder.addBlocks(indexMetadata);
            }
            IndexRoutingTable.Builder indexRoutingTable = IndexRoutingTable.builder(indexMetadata.getIndex());
            int shardAutoincrementNumber = 0;