@Test public void unmapRoute () throws Exception { cloudFoundryApplication.unmapRoute(experiment); verify(experiment, times(1)).setCheckContainerHealth(ArgumentMatchers.any()); verify(experiment, times(1)).setSelfHealingMethod(ArgumentMatchers.any()); Mockito.verify(cloudFoundryApplicationPlatform, times(1)).unmapRoute(ArgumentMatchers.any()); experiment.getSelfHealingMethod().run(); }
@ChaosExperiment(experimentType = ExperimentType.NETWORK) public void unmapRoute (Experiment experiment) { experiment.setCheckContainerHealth(isAppHealthy); if (!applicationRoutes.isEmpty()) { int routeIndex = RANDOM.nextInt(applicationRoutes.size()); this.routeUnderExperiment = applicationRoutes.get(routeIndex); experiment.setSelfHealingMethod(mapApplicationRoute); experiment.setFinalizeMethod(mapApplicationRoute); log.debug("Unmapping application route: {}", routeUnderExperiment); cloudFoundryApplicationPlatform.unmapRoute(routeUnderExperiment.getUnmapRouteRequest()); } else { log.warn("Application {} has no routes set, stopping the experiment {}", name, experiment.getId()); throw new ChaosException(CloudFoundryChaosErrorCode.NO_ROUTES); } }
CloudFoundryApplication extends Container { @ChaosExperiment(experimentType = ExperimentType.NETWORK) public void unmapRoute (Experiment experiment) { experiment.setCheckContainerHealth(isAppHealthy); if (!applicationRoutes.isEmpty()) { int routeIndex = RANDOM.nextInt(applicationRoutes.size()); this.routeUnderExperiment = applicationRoutes.get(routeIndex); experiment.setSelfHealingMethod(mapApplicationRoute); experiment.setFinalizeMethod(mapApplicationRoute); log.debug("Unmapping application route: {}", routeUnderExperiment); cloudFoundryApplicationPlatform.unmapRoute(routeUnderExperiment.getUnmapRouteRequest()); } else { log.warn("Application {} has no routes set, stopping the experiment {}", name, experiment.getId()); throw new ChaosException(CloudFoundryChaosErrorCode.NO_ROUTES); } } }
CloudFoundryApplication extends Container { @ChaosExperiment(experimentType = ExperimentType.NETWORK) public void unmapRoute (Experiment experiment) { experiment.setCheckContainerHealth(isAppHealthy); if (!applicationRoutes.isEmpty()) { int routeIndex = RANDOM.nextInt(applicationRoutes.size()); this.routeUnderExperiment = applicationRoutes.get(routeIndex); experiment.setSelfHealingMethod(mapApplicationRoute); experiment.setFinalizeMethod(mapApplicationRoute); log.debug("Unmapping application route: {}", routeUnderExperiment); cloudFoundryApplicationPlatform.unmapRoute(routeUnderExperiment.getUnmapRouteRequest()); } else { log.warn("Application {} has no routes set, stopping the experiment {}", name, experiment.getId()); throw new ChaosException(CloudFoundryChaosErrorCode.NO_ROUTES); } } CloudFoundryApplication(); }
CloudFoundryApplication extends Container { @ChaosExperiment(experimentType = ExperimentType.NETWORK) public void unmapRoute (Experiment experiment) { experiment.setCheckContainerHealth(isAppHealthy); if (!applicationRoutes.isEmpty()) { int routeIndex = RANDOM.nextInt(applicationRoutes.size()); this.routeUnderExperiment = applicationRoutes.get(routeIndex); experiment.setSelfHealingMethod(mapApplicationRoute); experiment.setFinalizeMethod(mapApplicationRoute); log.debug("Unmapping application route: {}", routeUnderExperiment); cloudFoundryApplicationPlatform.unmapRoute(routeUnderExperiment.getUnmapRouteRequest()); } else { log.warn("Application {} has no routes set, stopping the experiment {}", name, experiment.getId()); throw new ChaosException(CloudFoundryChaosErrorCode.NO_ROUTES); } } 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.NETWORK) public void unmapRoute (Experiment experiment) { experiment.setCheckContainerHealth(isAppHealthy); if (!applicationRoutes.isEmpty()) { int routeIndex = RANDOM.nextInt(applicationRoutes.size()); this.routeUnderExperiment = applicationRoutes.get(routeIndex); experiment.setSelfHealingMethod(mapApplicationRoute); experiment.setFinalizeMethod(mapApplicationRoute); log.debug("Unmapping application route: {}", routeUnderExperiment); cloudFoundryApplicationPlatform.unmapRoute(routeUnderExperiment.getUnmapRouteRequest()); } else { log.warn("Application {} has no routes set, stopping the experiment {}", name, experiment.getId()); throw new ChaosException(CloudFoundryChaosErrorCode.NO_ROUTES); } } 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);  }