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
);
    }
    /*
     * In this test, there are indices with blocks on them, master nodes that report RED, non-data nodes that report RED, and data
     * nodes that report YELLOW. We expect the overall status will be RED, with 3 impacts and 3 diagnoses (for the 3 different node
     * types experiencing problems).
     */
    public void testBlockedIndexWithRedNonDataNodesAndYellowDataNodes() {
        Set<DiscoveryNodeRole> nonDataNonMasterRoles = new HashSet<>(randomNonEmptySubsetOf(OTHER_ROLES));
        Set<DiscoveryNodeRole> dataRoles = new HashSet<>(randomNonEmptySubsetOf(DATA_ROLES));
        Set<DiscoveryNodeRole> masterRole = Set.of(DiscoveryNodeRole.MASTER_ROLE);
        Set<DiscoveryNode> masterDiscoveryNodes = createNodes(masterRole);
        Set<DiscoveryNode> nonDataNonMasterDiscoveryNodes = createNodes(nonDataNonMasterRoles);
        Set<DiscoveryNode> dataDiscoveryNodes = createNodes(dataRoles);
        ClusterService clusterService = createClusterService(
            1,
            1,
            Stream.concat(
                masterDiscoveryNodes.stream(),
                (Stream.concat(nonDataNonMasterDiscoveryNodes.stream(), dataDiscoveryNodes.stream()))
            ).collect(Collectors.toSet())
        );
        DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService);
        int numberOfRedMasterNodes = randomIntBetween(1, masterDiscoveryNodes.size());
        int numberOfRedNonDataNonMasterNodes = randomIntBetween(1, nonDataNonMasterDiscoveryNodes.size());
        int numberOfYellowDataNodes = randomIntBetween(1, dataDiscoveryNodes.size());
        HealthInfo healthInfo = createHealthInfo(
            HealthStatus.RED,
            numberOfRedMasterNodes,
            masterDiscoveryNodes,