@Test
public void testResolver() {

    assertThat(agentOperations.getInstanceGroups()).isNotNull();
    assertThat(agentOperations.getInstanceGroups()).isNotEmpty();
    AgentInstanceGroup agentInstanceGroup = agentOperations.getInstanceGroups().get(0);
    List<AgentInstance> agentInstances = agentOperations.getAgentInstances(agentInstanceGroup.getId());
    assertThat(agentInstances).isNotNull();
    assertThat(agentInstances).isNotEmpty();
    String k8sNodeId = agentInstances.get(0).getId();
    V1Node k8sNode = TestDataFactory.newNode(k8sNodeId);
    addNodeTaint(k8sNode, KubeConstants.TAINT_SCHEDULER, KubeConstants.TAINT_SCHEDULER_VALUE_FENZO, KubeConstants.TAINT_EFFECT_NO_EXECUTE);
    addNodeCondition(k8sNode, "CorrectableMemoryFailure", "True");
    AgentManagementNodeDataResolver resolver = new AgentManagementNodeDataResolver(agentOperations, agentDataReplicator, instance -> true,
            relocationConfiguration, TestDataFactory.mockKubeApiFacade(k8sNode));
    Map<String, Node> resolved = resolver.resolve();
    int expectedCount = agentOperations.findAgentInstances(pair -> true).stream().mapToInt(p -> p.getRight().size()).sum();
    assertThat(resolved).hasSize(expectedCount);
    // Nothing is flagged yet
    String instanceId = CollectionsExt.first(resolved.keySet());
    assertThat(resolver.resolve().get(instanceId).isRelocationRequired()).isFalse();
    assertThat(resolver.resolve().get(instanceId).isRelocationRequiredImmediately()).isFalse();
    assertThat(resolver.resolve().get(instanceId).isRelocationNotAllowed()).isFalse();
    assertThat(resolver.resolve().get(instanceId).isInBadCondition()).isFalse();
    // Tag one as removable
    relocationConnectorStubs.addInstanceAttribute(instanceId, RelocationAttributes.RELOCATION_REQUIRED, "true");
    assertThat(resolver.resolve().get(instanceId).isRelocationRequired()).isTrue();
    assertThat(resolver.resolve().get(instanceId).isRelocationRequiredImmediately()).isFalse();
    assertThat(resolver.resolve().get(instanceId).isRelocationNotAllowed()).isFalse();
    assertThat(resolver.resolve().get(instanceId).isInBadCondition()).isFalse();
    // Now removable immediately
    relocationConnectorStubs.addInstanceAttribute(instanceId, RelocationAttributes.RELOCATION_REQUIRED_IMMEDIATELY, "true");
    assertThat(resolver.resolve().get(instanceId).isRelocationRequiredImmediately()).isTrue();
    assertThat(resolver.resolve().get(instanceId).isRelocationNotAllowed()).isFalse();
    assertThat(resolver.resolve().get(instanceId).isInBadCondition()).isFalse();
    // Relocation not allowed
    relocationConnectorStubs.addInstanceAttribute(instanceId, RelocationAttributes.RELOCATION_NOT_ALLOWED, "true");
    assertThat(resolver.resolve().get(instanceId).isRelocationNotAllowed()).isTrue();
    assertThat(resolver.resolve().get(instanceId).isInBadCondition()).isFalse();
    // Bad Node condition detected on k8s node
    assertThat(resolver.resolve().get(k8sNodeId).isInBadCondition()).isTrue();
}