server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java
diskInfoByNode.put(node.getId(), diskHealthInfo);
            }
        }
        return new HealthInfo(diskInfoByNode);
    }
    private static ClusterService createClusterService(Collection<DiscoveryNode> nodes, boolean withBlockedIndex) {
        int numberOfIndices = 1;
        int numberOfBlockedIndices = withBlockedIndex ? 1 : 0;
        Map<String, Set<String>> indexNameToNodeIdsMap = new HashMap<>();
        Set<String> blockedIndices = new HashSet<>(numberOfBlockedIndices);
        for (int i = 0; i < numberOfIndices; i++) {
            String indexName = randomAlphaOfLength(20);
            indexNameToNodeIdsMap.put(indexName, Set.of(randomFrom(nodes).getId()));
            if (i < numberOfBlockedIndices) {
                blockedIndices.add(indexName);
            }
        }
        return createClusterService(blockedIndices, nodes, indexNameToNodeIdsMap);
    }
    private static ClusterService createClusterService(
        Set<String> blockedIndices,
        Collection<DiscoveryNode> nodes,
        Map<String, Set<String>> indexNameToNodeIdsMap
    ) {
        ClusterState clusterState = createClusterState(blockedIndices, nodes, indexNameToNodeIdsMap);
        var clusterService = mock(ClusterService.class);
        when(clusterService.state()).thenReturn(clusterState);
        return clusterService;
    }
    static ClusterState createClusterState(