@Test public void scaleApplication () { cloudFoundryApplication.scaleApplication(experiment); verify(experiment, times(1)).setCheckContainerHealth(ArgumentMatchers.any()); verify(experiment, times(1)).setSelfHealingMethod(ArgumentMatchers.any()); verify(experiment, times(1)).setFinalizeMethod(ArgumentMatchers.any()); Mockito.verify(cloudFoundryApplicationPlatform, times(1)).rescaleApplication(eq(name), any(Integer.class)); }
@ChaosExperiment(experimentType = ExperimentType.RESOURCE) public void scaleApplication (Experiment experiment) { experiment.setSelfHealingMethod(rescaleApplicationToDefault); experiment.setCheckContainerHealth(isAppHealthy); experiment.setFinalizeMethod(rescaleApplicationToDefault); int newScale; do { newScale = RANDOM.nextInt(MAX_INSTANCES - MIN_INSTANCES) + MIN_INSTANCES; } while (newScale == actualContainerInstances); actualContainerInstances = newScale; log.debug("Scaling {} to {} instances", name, actualContainerInstances); cloudFoundryApplicationPlatform.rescaleApplication(name, actualContainerInstances); }
CloudFoundryApplication extends Container { @ChaosExperiment(experimentType = ExperimentType.RESOURCE) public void scaleApplication (Experiment experiment) { experiment.setSelfHealingMethod(rescaleApplicationToDefault); experiment.setCheckContainerHealth(isAppHealthy); experiment.setFinalizeMethod(rescaleApplicationToDefault); int newScale; do { newScale = RANDOM.nextInt(MAX_INSTANCES - MIN_INSTANCES) + MIN_INSTANCES; } while (newScale == actualContainerInstances); actualContainerInstances = newScale; log.debug("Scaling {} to {} instances", name, actualContainerInstances); cloudFoundryApplicationPlatform.rescaleApplication(name, actualContainerInstances); } }
CloudFoundryApplication extends Container { @ChaosExperiment(experimentType = ExperimentType.RESOURCE) public void scaleApplication (Experiment experiment) { experiment.setSelfHealingMethod(rescaleApplicationToDefault); experiment.setCheckContainerHealth(isAppHealthy); experiment.setFinalizeMethod(rescaleApplicationToDefault); int newScale; do { newScale = RANDOM.nextInt(MAX_INSTANCES - MIN_INSTANCES) + MIN_INSTANCES; } while (newScale == actualContainerInstances); actualContainerInstances = newScale; log.debug("Scaling {} to {} instances", name, actualContainerInstances); cloudFoundryApplicationPlatform.rescaleApplication(name, actualContainerInstances); } CloudFoundryApplication(); }
CloudFoundryApplication extends Container { @ChaosExperiment(experimentType = ExperimentType.RESOURCE) public void scaleApplication (Experiment experiment) { experiment.setSelfHealingMethod(rescaleApplicationToDefault); experiment.setCheckContainerHealth(isAppHealthy); experiment.setFinalizeMethod(rescaleApplicationToDefault); int newScale; do { newScale = RANDOM.nextInt(MAX_INSTANCES - MIN_INSTANCES) + MIN_INSTANCES; } while (newScale == actualContainerInstances); actualContainerInstances = newScale; log.debug("Scaling {} to {} instances", name, actualContainerInstances); cloudFoundryApplicationPlatform.rescaleApplication(name, actualContainerInstances); } CloudFoundryApplication(); List<CloudFoundryApplicationRoute> getApplicationRoutes(); static CloudFoundryApplicationBuilder builder(); Integer getOriginalContainerInstances(); Integer getActualContainerInstances(); String getApplicationID(); @Override Platform getPlatform(); @Override String getSimpleName(); @Override String getAggregationIdentifier(); @Override DataDogIdentifier getDataDogIdentifier(); @ChaosExperiment(experimentType = ExperimentType.RESOURCE) void scaleApplication(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.STATE) void restartApplication(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.STATE) void restageApplication(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.NETWORK) void unmapRoute(Experiment experiment); }
CloudFoundryApplication extends Container { @ChaosExperiment(experimentType = ExperimentType.RESOURCE) public void scaleApplication (Experiment experiment) { experiment.setSelfHealingMethod(rescaleApplicationToDefault); experiment.setCheckContainerHealth(isAppHealthy); experiment.setFinalizeMethod(rescaleApplicationToDefault); int newScale; do { newScale = RANDOM.nextInt(MAX_INSTANCES - MIN_INSTANCES) + MIN_INSTANCES; } while (newScale == actualContainerInstances); actualContainerInstances = newScale; log.debug("Scaling {} to {} instances", name, actualContainerInstances); cloudFoundryApplicationPlatform.rescaleApplication(name, actualContainerInstances); } CloudFoundryApplication(); List<CloudFoundryApplicationRoute> getApplicationRoutes(); static CloudFoundryApplicationBuilder builder(); Integer getOriginalContainerInstances(); Integer getActualContainerInstances(); String getApplicationID(); @Override Platform getPlatform(); @Override String getSimpleName(); @Override String getAggregationIdentifier(); @Override DataDogIdentifier getDataDogIdentifier(); @ChaosExperiment(experimentType = ExperimentType.RESOURCE) void scaleApplication(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.STATE) void restartApplication(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.STATE) void restageApplication(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.NETWORK) void unmapRoute(Experiment experiment);  }