In some contexts is unclear why an autoscaling policy decides to request
more resources, i.e. if there's an unassigned shard that remains unassigned
even after adding more resources. It would be help to have more information
around the decisions taken by the deciders so it is easier to understand and
track them.
x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageDeciderDecisionTests.java
verifyScale(subjectShards.size(), "not enough storage available, needs " + subjectShards.size() + "b", mockCanAllocateDiskDecider);
        verifyScale(0, "storage ok", mockCanAllocateDiskDecider, CAN_ALLOCATE_NO_DECIDER);
        verifyScale(0, "storage ok");
        verifyScale(addDataNodes(DATA_HOT_NODE_ROLE, "additional", state, hotNodes), 0, "storage ok", mockCanAllocateDiskDecider);
    }
    public void testMoveToEmpty() {
        
        allocate();
        
        withRoutingAllocation(
            allocation -> RoutingNodesHelper.shardsWithState(allocation.routingNodes(), ShardRoutingState.INITIALIZING)
                .stream()
                .filter(ShardRouting::primary)
                .forEach(shard -> allocation.routingNodes().startShard(logger, shard, allocation.changes()))
        );
        verify(ReactiveStorageDeciderService.AllocationState::storagePreventsRemainOrMove, 0, DiscoveryNodeRole.DATA_COLD_NODE_ROLE);
        Set<IndexMetadata> candidates = new HashSet<>(randomSubsetOf(allIndices()));
        int allocatedCandidateShards = candidates.stream().mapToInt(IndexMetadata::getNumberOfShards).sum();
        verify(
            moveToCold(candidates),
            ReactiveStorageDeciderService.AllocationState::storagePreventsRemainOrMove,
            allocatedCandidateShards,
            DiscoveryNodeRole.DATA_COLD_NODE_ROLE
        );
    }
    private Set<IndexMetadata> allIndices() {
        return new HashSet<>(state.metadata().getIndices().values());
    }
    private ClusterState moveToCold(Set<IndexMetadata> candidates) {
        ClusterState.Builder stateBuilder = ClusterState.builder(state);