During the development and review process of the disk health indicator we noticed that it was hard to understand. Since we learnt a lot from the first round of development we want to go through the code one more time and restructure it.
server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java
Stream.concat(dataAndMasterNodes.stream(), pureNonDataNonMasterNodes.stream()),
            mixedNodes.stream()
        ).collect(Collectors.toSet());
        ClusterService clusterService = createClusterService(false, allNodes);
        assertThat(
            DiskHealthIndicatorService.getNodesWithNonDataNonMasterRoles(
                allNodes.stream().map(DiscoveryNode::getId).collect(Collectors.toSet()),
                clusterService.state()
            ),
            equalTo(pureNonDataNonMasterNodes.stream().map(DiscoveryNode::getId).collect(Collectors.toSet()))
        );
    }
    public void testGetIndicesForNodes() {
        Set<DiscoveryNode> discoveryNodes = createNodesWithAllRoles();
        HealthStatus expectedStatus = HealthStatus.RED;
        int numberOfRedNodes = randomIntBetween(1, discoveryNodes.size());
        HealthInfo healthInfo = createHealthInfo(expectedStatus, numberOfRedNodes, discoveryNodes);
        Set<String> redNodeIds = healthInfo.diskInfoByNode()
            .entrySet()
            .stream()
            .filter(entry -> entry.getValue().healthStatus().equals(expectedStatus))
            .map(Map.Entry::getKey)
            .collect(Collectors.toSet());
        Set<String> nonRedNodeIds = healthInfo.diskInfoByNode()
            .entrySet()
            .stream()
            .filter(entry -> entry.getValue().healthStatus().equals(expectedStatus) == false)
            .map(Map.Entry::getKey)
            .collect(Collectors.toSet());
        Map<String, Set<String>> indexNameToNodeIdsMap = new HashMap<>();