server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java
public void testGreen() throws IOException {
        Set<DiscoveryNode> discoveryNodes = createNodesWithAllRoles();
        ClusterService clusterService = createClusterService(discoveryNodes, false);
        DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService);
        HealthStatus expectedStatus = HealthStatus.GREEN;
        HealthInfo healthInfo = createHealthInfoWithOneUnhealthyNode(expectedStatus, discoveryNodes);
        HealthIndicatorResult result = diskHealthIndicatorService.calculate(true, healthInfo);
        assertThat(result.status(), equalTo(expectedStatus));
        assertThat(result.symptom(), equalTo("The cluster has enough available disk space."));
        assertThat(result.impacts().size(), equalTo(0));
        assertThat(result.diagnosisList().size(), equalTo(0));
        Map<String, Object> details = xContentToMap(result.details());
        assertThat(details.get("green_nodes"), equalTo(discoveryNodes.size()));
        assertThat(details.get("unknown_nodes"), equalTo(0));
        assertThat(details.get("yellow_nodes"), equalTo(0));
        assertThat(details.get("red_nodes"), equalTo(0));
        assertThat(details.get("blocked_indices"), equalTo(0));
    }
    /*
     * Simulates a cluster with data nodes, dedicated master nodes and other nodes that are YELLOW.
     * We expect 3 impacts and 3 diagnosis.
     */
    public void testYellowMixedNodes() throws IOException {
        Set<DiscoveryNode> dataNodes = createNodes(DATA_ROLES);
        Set<DiscoveryNode> masterNodes = createNodes(NON_DATA_ROLES);
        Set<DiscoveryNode> otherNodes = createNodes(OTHER_ROLES);
        Map<String, Set<String>> indexNameToNodeIdsMap = new HashMap<>();
        Set<String> nodeIds = dataNodes.stream().map(DiscoveryNode::getId).collect(Collectors.toSet());
        for (int i = 0; i < randomIntBetween(1, 20); i++) {
            String indexName = randomAlphaOfLength(20);