@Test
public void mustClearDockerInstanceWhenContainerDestroyed() {

    DefaultDockerCloudClient client = createClient();
    DockerImage dockerImage = waitForImage(client);
    DockerInstance instance = client.startNewInstance(dockerImage, userData);
    waitForInstanceStatus(instance, InstanceStatus.RUNNING);
    TestDockerClientFacade clientFacade = testCloudSupport.getClientFacade();
    clientFacade.removeAgentHolder(instance.getAgentHolderId().get());
    // Will takes two sync to be effective (one to mark the instance in error state), and another one to remove it.
    waitUntil(() -> dockerImage.getInstances().isEmpty());
}