@Test public void evaluateRunningExperiment () { doReturn(NORMAL, DOES_NOT_EXIST, RUNNING_EXPERIMENT).when(experiment).checkContainerHealth(); doReturn(true).when(experiment).isOverDuration(); experiment.evaluateRunningExperiment(); assertEquals(FINALIZING, experiment.getExperimentState()); experiment.evaluateRunningExperiment(); assertEquals(FAILED, experiment.getExperimentState()); experiment.evaluateRunningExperiment(); assertEquals(SELF_HEALING, experiment.getExperimentState()); }
void evaluateRunningExperiment () { log.debug("Checking status of running experiment"); switch (checkContainerHealth()) { case NORMAL: log.info("Container restored to healthy state, going to finalizing"); setExperimentState(ExperimentState.FINALIZING); break; case RUNNING_EXPERIMENT: if (isOverDuration()) { log.warn("Container is not in a healthy state within experiment duration. Progressing to self-healing"); setExperimentState(ExperimentState.SELF_HEALING); } else { log.debug("Container is not in a healthy state, but experiment is still within time limits"); } break; case DOES_NOT_EXIST: log.warn("Container cannot be found, and this was not expected from the experiment. Experiment failed"); setExperimentState(ExperimentState.FAILED); break; } }
Experiment { void evaluateRunningExperiment () { log.debug("Checking status of running experiment"); switch (checkContainerHealth()) { case NORMAL: log.info("Container restored to healthy state, going to finalizing"); setExperimentState(ExperimentState.FINALIZING); break; case RUNNING_EXPERIMENT: if (isOverDuration()) { log.warn("Container is not in a healthy state within experiment duration. Progressing to self-healing"); setExperimentState(ExperimentState.SELF_HEALING); } else { log.debug("Container is not in a healthy state, but experiment is still within time limits"); } break; case DOES_NOT_EXIST: log.warn("Container cannot be found, and this was not expected from the experiment. Experiment failed"); setExperimentState(ExperimentState.FAILED); break; } } }
Experiment { void evaluateRunningExperiment () { log.debug("Checking status of running experiment"); switch (checkContainerHealth()) { case NORMAL: log.info("Container restored to healthy state, going to finalizing"); setExperimentState(ExperimentState.FINALIZING); break; case RUNNING_EXPERIMENT: if (isOverDuration()) { log.warn("Container is not in a healthy state within experiment duration. Progressing to self-healing"); setExperimentState(ExperimentState.SELF_HEALING); } else { log.debug("Container is not in a healthy state, but experiment is still within time limits"); } break; case DOES_NOT_EXIST: log.warn("Container cannot be found, and this was not expected from the experiment. Experiment failed"); setExperimentState(ExperimentState.FAILED); break; } } Experiment(Container container); }
Experiment { void evaluateRunningExperiment () { log.debug("Checking status of running experiment"); switch (checkContainerHealth()) { case NORMAL: log.info("Container restored to healthy state, going to finalizing"); setExperimentState(ExperimentState.FINALIZING); break; case RUNNING_EXPERIMENT: if (isOverDuration()) { log.warn("Container is not in a healthy state within experiment duration. Progressing to self-healing"); setExperimentState(ExperimentState.SELF_HEALING); } else { log.debug("Container is not in a healthy state, but experiment is still within time limits"); } break; case DOES_NOT_EXIST: log.warn("Container cannot be found, and this was not expected from the experiment. Experiment failed"); setExperimentState(ExperimentState.FAILED); break; } } Experiment(Container container); String getExperimentMethodName(); Container getContainer(); void setPreferredExperiment(String preferredExperiment); Instant getLastSelfHealingTime(); @JsonIgnore Platform getExperimentLayer(); String getExperimentLayerName(); @JsonIgnore ExperimentMethod getExperimentMethod(); Runnable getSelfHealingMethod(); void setSelfHealingMethod(Runnable selfHealingMethod); @JsonIgnore Runnable getFinalizeMethod(); void setFinalizeMethod(Runnable finalizeMethod); @JsonIgnore Callable<ContainerHealth> getCheckContainerHealth(); void setCheckContainerHealth(Callable<ContainerHealth> checkContainerHealth); void setFinalizationDuration(Duration finalizationDuration); String getId(); ExperimentType getExperimentType(); AtomicInteger getSelfHealingCounter(); ExperimentState getExperimentState(); Instant getStartTime(); void setMinimumDuration(Duration minimumDuration); void setMaximumDuration(Duration maximumDuration); Boolean getWasSelfHealingRequired(); @Override String toString(); }
Experiment { void evaluateRunningExperiment () { log.debug("Checking status of running experiment"); switch (checkContainerHealth()) { case NORMAL: log.info("Container restored to healthy state, going to finalizing"); setExperimentState(ExperimentState.FINALIZING); break; case RUNNING_EXPERIMENT: if (isOverDuration()) { log.warn("Container is not in a healthy state within experiment duration. Progressing to self-healing"); setExperimentState(ExperimentState.SELF_HEALING); } else { log.debug("Container is not in a healthy state, but experiment is still within time limits"); } break; case DOES_NOT_EXIST: log.warn("Container cannot be found, and this was not expected from the experiment. Experiment failed"); setExperimentState(ExperimentState.FAILED); break; } } Experiment(Container container); String getExperimentMethodName(); Container getContainer(); void setPreferredExperiment(String preferredExperiment); Instant getLastSelfHealingTime(); @JsonIgnore Platform getExperimentLayer(); String getExperimentLayerName(); @JsonIgnore ExperimentMethod getExperimentMethod(); Runnable getSelfHealingMethod(); void setSelfHealingMethod(Runnable selfHealingMethod); @JsonIgnore Runnable getFinalizeMethod(); void setFinalizeMethod(Runnable finalizeMethod); @JsonIgnore Callable<ContainerHealth> getCheckContainerHealth(); void setCheckContainerHealth(Callable<ContainerHealth> checkContainerHealth); void setFinalizationDuration(Duration finalizationDuration); String getId(); ExperimentType getExperimentType(); AtomicInteger getSelfHealingCounter(); ExperimentState getExperimentState(); Instant getStartTime(); void setMinimumDuration(Duration minimumDuration); void setMaximumDuration(Duration maximumDuration); Boolean getWasSelfHealingRequired(); @Override String toString();  }