server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java
indexNameToNodeIdsMap.put(indexName, Set.of(randomFrom(redNodes).getId()));
                redNodeIndices.add(indexName);
            } else {
                indexNameToNodeIdsMap.put(indexName, Set.of(randomFrom(nonRedNodes).getId()));
                nonRedNodeIndices.add(indexName);
            }
        }
        try (ClusterService clusterService = createClusterService(Set.of(), discoveryNodes.values(), indexNameToNodeIdsMap)) {
            assertThat(
                DiskHealthIndicatorService.DiskHealthAnalyzer.getIndicesForNodes(redNodes, clusterService.state()),
                equalTo(redNodeIndices)
            );
            assertThat(
                DiskHealthIndicatorService.DiskHealthAnalyzer.getIndicesForNodes(nonRedNodes, clusterService.state()),
                equalTo(nonRedNodeIndices)
            );
        }
    }
    private Set<DiscoveryNode> createNodesWithAllRoles() {
        return createNodes(DiscoveryNodeRole.roles());
    }
    private Set<DiscoveryNode> createNodes(Set<DiscoveryNodeRole> roles) {
        int numberOfNodes = randomIntBetween(1, 200);
        Set<DiscoveryNode> discoveryNodes = new HashSet<>();
        for (int i = 0; i < numberOfNodes; i++) {
            discoveryNodes.add(
                new DiscoveryNode(
                    randomAlphaOfLength(30),
                    UUID.randomUUID().toString(),
                    buildNewFakeTransportAddress(),