server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java
assertThat(impact.impactDescription(), startsWith("Cannot insert or update documents in the affected indices ["));
        assertThat(result.diagnosisList().size(), equalTo(1));
        Diagnosis diagnosis = result.diagnosisList().get(0);
        List<Diagnosis.Resource> affectedResources = diagnosis.affectedResources();
        assertThat(affectedResources.size(), is(1));
        assertThat(affectedResources.get(0).getType(), is(Diagnosis.Resource.Type.INDEX));
        assertThat(affectedResources.get(0).getValues(), iterableWithSize(1));
        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(1));
    }
    /*
     * Simulates a cluster with healthy all-role nodes and a blocked index. This situation can occur when the cluster was out of space,
     * the capacity has increased but not enough for all nodes to recover, there are nodes that are currently above the high threshold
     * and they are not able to relocate their shards to another node.
     * We expect 3 impact and 1 diagnosis.
     */
    public void testRedWithBlockedIndicesAndYellowNodes() throws IOException {
        Set<DiscoveryNode> discoveryNodes = createNodesWithAllRoles();
        ClusterService clusterService = createClusterService(discoveryNodes, true);
        DiskHealthIndicatorService diskHealthIndicatorService = new DiskHealthIndicatorService(clusterService);
        HealthStatus expectedStatus = HealthStatus.RED;
        int numberOfYellowNodes = randomIntBetween(1, discoveryNodes.size());
        HealthInfo healthInfo = createHealthInfo(new HealthInfoConfig(HealthStatus.YELLOW, numberOfYellowNodes, discoveryNodes));
        HealthIndicatorResult result = diskHealthIndicatorService.calculate(true, healthInfo);
        assertThat(result.status(), equalTo(expectedStatus));
        assertThat(