@Test
public void timeoutMustOnlyObserveExecutionTime() {

    InstanceTestTaskDelegator task1 = new InstanceTestTaskDelegator(instance1);
    InstanceTestTaskDelegator task2 = new InstanceTestTaskDelegator(instance1);
    // Single thread, 500ms timeout.
    scheduler = new DockerTaskScheduler(1, false, Duration.ofMillis(500));
    // First task will block for a long time (beyond timeout), second task for a short time (under timeout).
    task1.fixture = () -> waitSec(3);
    task2.fixture = () -> waitMillis(200);
    // Both task are submitted nearly simultaneously.
    scheduler.scheduleInstanceTask(task1.task);
    scheduler.scheduleInstanceTask(task2.task);
    waitUntil(() -> task1.isFailed() && task2.isSuccessful());
}