@Test(dataProvider = "deletePodsProvider") public void testDeletePods(List<Pod> podsToDelete, final int BATCH_SIZE) { final int EXPECTED_DELETE_CALLS = (int)Math.ceil((double)podsToDelete.size() / (double)BATCH_SIZE); batchedPodDeleter.setPodReapBatchSize(BATCH_SIZE); ConsumerResult<Pod> consumerResult = batchedPodDeleter.consume(podsToDelete, END_PROCESSING_TIME); Assert.assertFalse(consumerResult.isInterrupted()); verify(mockKubernetesPodsFacade, times(EXPECTED_DELETE_CALLS)).deletePods(any()); }
protected void deletePods(List<Pod> pods) { try { logger.info(ReaperMessages.POD_DELETE_ATTEMPT.getMessage(pods.stream().map(pod -> pod.getMetadata().getName()).collect(Collectors.joining(",")))); kubernetesPodFacade.deletePods(pods); } catch(Exception e) { logger.error(ReaperMessages.POD_BATCH_REAP_FAILED.getMessage(), e); } }
BatchedPodDeleter implements Consumer<Pod> { protected void deletePods(List<Pod> pods) { try { logger.info(ReaperMessages.POD_DELETE_ATTEMPT.getMessage(pods.stream().map(pod -> pod.getMetadata().getName()).collect(Collectors.joining(",")))); kubernetesPodFacade.deletePods(pods); } catch(Exception e) { logger.error(ReaperMessages.POD_BATCH_REAP_FAILED.getMessage(), e); } } }
BatchedPodDeleter implements Consumer<Pod> { protected void deletePods(List<Pod> pods) { try { logger.info(ReaperMessages.POD_DELETE_ATTEMPT.getMessage(pods.stream().map(pod -> pod.getMetadata().getName()).collect(Collectors.joining(",")))); kubernetesPodFacade.deletePods(pods); } catch(Exception e) { logger.error(ReaperMessages.POD_BATCH_REAP_FAILED.getMessage(), e); } } BatchedPodDeleter(KubernetesPodFacade kubernetesPodFacade); }
BatchedPodDeleter implements Consumer<Pod> { protected void deletePods(List<Pod> pods) { try { logger.info(ReaperMessages.POD_DELETE_ATTEMPT.getMessage(pods.stream().map(pod -> pod.getMetadata().getName()).collect(Collectors.joining(",")))); kubernetesPodFacade.deletePods(pods); } catch(Exception e) { logger.error(ReaperMessages.POD_BATCH_REAP_FAILED.getMessage(), e); } } BatchedPodDeleter(KubernetesPodFacade kubernetesPodFacade); @Override ConsumerResult<Pod> consume(Collection<Pod> collection, Instant endProcessingTime); BatchedPodDeleter setPodReapBatchSize(int podReapBatchSize); @Override String toString(); }
BatchedPodDeleter implements Consumer<Pod> { protected void deletePods(List<Pod> pods) { try { logger.info(ReaperMessages.POD_DELETE_ATTEMPT.getMessage(pods.stream().map(pod -> pod.getMetadata().getName()).collect(Collectors.joining(",")))); kubernetesPodFacade.deletePods(pods); } catch(Exception e) { logger.error(ReaperMessages.POD_BATCH_REAP_FAILED.getMessage(), e); } } BatchedPodDeleter(KubernetesPodFacade kubernetesPodFacade); @Override ConsumerResult<Pod> consume(Collection<Pod> collection, Instant endProcessingTime); BatchedPodDeleter setPodReapBatchSize(int podReapBatchSize); @Override String toString(); static final int DEFAULT_POD_REAP_BATCH_SIZE; }