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
List<String> affectedResources = diagnosis.affectedResources();
        assertThat(affectedResources.size(), equalTo(numberOfRedNodes));
        assertTrue(affectedResources.containsAll(redNodeIds));
        Map<String, Object> details = xContentToMap(result.details());
        assertThat(details.get("green_nodes"), equalTo(discoveryNodes.size() - numberOfRedNodes));
        assertThat(details.get("unknown_nodes"), equalTo(0));
        assertThat(details.get("yellow_nodes"), equalTo(0));
        assertThat(details.get("red_nodes"), equalTo(numberOfRedNodes));
        assertThat(details.get("blocked_indices"), equalTo(0));
    }
    /*
     * Tests when there is an index that has a block on it but the nodes report green (so the lock is probably about to be released or
     * shards are being rebalanced).
     */
    public void testHasBlockButOtherwiseGreen() {
        Set<DiscoveryNode> discoveryNodes = createNodesWithAllRoles();
        ClusterService clusterService = createClusterService(true, discoveryNodes);
        DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService);
        {
            HealthStatus expectedStatus = HealthStatus.RED;
            HealthInfo healthInfo = createHealthInfo(HealthStatus.GREEN, discoveryNodes);
            HealthIndicatorResult result = diskHealthIndicatorService.calculate(true, healthInfo);
            assertThat(result.status(), equalTo(expectedStatus));
            assertThat(
                result.symptom(),
                equalTo(
                    "1 index is not allowed to be updated because the cluster was running out of "
                        + "disk space. The cluster is recovering and ingest capabilities should be restored within a few minutes."
                )
            );