@Test void testGetFilteredPodsForLogs() { String controllerUid = "controller-uid-ejofjeofer"; PodList podList = getMockPodList(controllerUid); List<PodResource<Pod, DoneablePod>> podResourceList = PodOperationUtil.getFilteredPodsForLogs(podOperations, podList, controllerUid); assertNotNull(podResourceList); assertEquals(1, podResourceList.size()); verify(podOperations, times(1)).withName(any()); }
public static List<PodResource<Pod, DoneablePod>> getFilteredPodsForLogs(PodOperationsImpl podOperations, PodList controllerPodList, String controllerUid) { List<PodResource<Pod, DoneablePod>> pods = new ArrayList<>(); for (Pod pod : controllerPodList.getItems()) { OwnerReference ownerReference = KubernetesResourceUtil.getControllerUid(pod); if (ownerReference != null && ownerReference.getUid().equals(controllerUid)) { pods.add(podOperations.withName(pod.getMetadata().getName())); } } return pods; }
PodOperationUtil { public static List<PodResource<Pod, DoneablePod>> getFilteredPodsForLogs(PodOperationsImpl podOperations, PodList controllerPodList, String controllerUid) { List<PodResource<Pod, DoneablePod>> pods = new ArrayList<>(); for (Pod pod : controllerPodList.getItems()) { OwnerReference ownerReference = KubernetesResourceUtil.getControllerUid(pod); if (ownerReference != null && ownerReference.getUid().equals(controllerUid)) { pods.add(podOperations.withName(pod.getMetadata().getName())); } } return pods; } }
PodOperationUtil { public static List<PodResource<Pod, DoneablePod>> getFilteredPodsForLogs(PodOperationsImpl podOperations, PodList controllerPodList, String controllerUid) { List<PodResource<Pod, DoneablePod>> pods = new ArrayList<>(); for (Pod pod : controllerPodList.getItems()) { OwnerReference ownerReference = KubernetesResourceUtil.getControllerUid(pod); if (ownerReference != null && ownerReference.getUid().equals(controllerUid)) { pods.add(podOperations.withName(pod.getMetadata().getName())); } } return pods; } private  PodOperationUtil(); }
PodOperationUtil { public static List<PodResource<Pod, DoneablePod>> getFilteredPodsForLogs(PodOperationsImpl podOperations, PodList controllerPodList, String controllerUid) { List<PodResource<Pod, DoneablePod>> pods = new ArrayList<>(); for (Pod pod : controllerPodList.getItems()) { OwnerReference ownerReference = KubernetesResourceUtil.getControllerUid(pod); if (ownerReference != null && ownerReference.getUid().equals(controllerUid)) { pods.add(podOperations.withName(pod.getMetadata().getName())); } } return pods; } private  PodOperationUtil(); static List<PodResource<Pod, DoneablePod>> getFilteredPodsForLogs(PodOperationsImpl podOperations, PodList controllerPodList, String controllerUid); static PodOperationsImpl getGenericPodOperations(OperationContext context, boolean isPretty, Integer podLogWaitTimeout); static List<PodResource<Pod, DoneablePod>> getPodOperationsForController(OperationContext context, String controllerUid, Map<String, String> selectorLabels, boolean isPretty, Integer podLogWaitTimeout); static void waitUntilReadyBeforeFetchingLogs(PodResource<Pod, DoneablePod> podOperation, Integer logWaitTimeout); }
PodOperationUtil { public static List<PodResource<Pod, DoneablePod>> getFilteredPodsForLogs(PodOperationsImpl podOperations, PodList controllerPodList, String controllerUid) { List<PodResource<Pod, DoneablePod>> pods = new ArrayList<>(); for (Pod pod : controllerPodList.getItems()) { OwnerReference ownerReference = KubernetesResourceUtil.getControllerUid(pod); if (ownerReference != null && ownerReference.getUid().equals(controllerUid)) { pods.add(podOperations.withName(pod.getMetadata().getName())); } } return pods; } private  PodOperationUtil(); static List<PodResource<Pod, DoneablePod>> getFilteredPodsForLogs(PodOperationsImpl podOperations, PodList controllerPodList, String controllerUid); static PodOperationsImpl getGenericPodOperations(OperationContext context, boolean isPretty, Integer podLogWaitTimeout); static List<PodResource<Pod, DoneablePod>> getPodOperationsForController(OperationContext context, String controllerUid, Map<String, String> selectorLabels, boolean isPretty, Integer podLogWaitTimeout); static void waitUntilReadyBeforeFetchingLogs(PodResource<Pod, DoneablePod> podOperation, Integer logWaitTimeout);  }