server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java
nonDataNonMasterDiagnosisDefinition.action(),
                equalTo("Please add capacity to the current nodes, or replace them with ones with higher capacity.")
            );
        }
    }
    public void testGetIndicesForNodes() {
        Map<String, DiscoveryNode> discoveryNodes = createNodesWithAllRoles().stream()
            .collect(Collectors.toMap(DiscoveryNode::getId, Function.identity()));
        HealthStatus expectedStatus = HealthStatus.RED;
        int numberOfRedNodes = randomIntBetween(1, discoveryNodes.size());
        HealthInfo healthInfo = createHealthInfo(new HealthInfoConfig(expectedStatus, numberOfRedNodes, discoveryNodes.values()));
        List<DiscoveryNode> redNodes = healthInfo.diskInfoByNode()
            .entrySet()
            .stream()
            .filter(entry -> entry.getValue().healthStatus().equals(expectedStatus))
            .map(entry -> discoveryNodes.get(entry.getKey()))
            .collect(Collectors.toList());
        List<DiscoveryNode> nonRedNodes = healthInfo.diskInfoByNode()
            .entrySet()
            .stream()
            .filter(entry -> entry.getValue().healthStatus().equals(expectedStatus) == false)
            .map(entry -> discoveryNodes.get(entry.getKey()))
            .collect(Collectors.toList());
        Map<String, Set<String>> indexNameToNodeIdsMap = new HashMap<>();
        int numberOfIndices = randomIntBetween(1, 1000);
        Set<String> redNodeIndices = new HashSet<>();
        Set<String> nonRedNodeIndices = new HashSet<>();
        for (int i = 0; i < numberOfIndices; i++) {
            String indexName = randomAlphaOfLength(20);
            if (nonRedNodes.isEmpty() || randomBoolean()) {