@Test
public void testAgentInstanceCloudUpdate() {

    Instance updatedInstance = testConnector.takeInstance(0, 0).toBuilder()
            .withInstanceState(Instance.InstanceState.Terminated)
            .build();
    testConnector.addInstance(updatedInstance);
    testScheduler.advanceTimeBy(CACHE_REFRESH_INTERVAL_MS, TimeUnit.MILLISECONDS);
    assertThat(cache.getAgentInstance(updatedInstance.getId()).getLifecycleStatus().getState()).isEqualTo(InstanceLifecycleState.Stopped);
    expectInstanceGroupUpdateEvent(eventSubscriber, testConnector.takeInstanceGroup(0).getId());
}