@Test public void testIsContainerRecycledNotFound () throws ApiException { KubernetesPodContainer kubernetesPodContainer = mock(KubernetesPodContainer.class); V1ReplicaSet replicaSet = new V1ReplicaSetBuilder().withStatus(new V1ReplicaSetStatusBuilder().withReplicas(1) .withReadyReplicas( 1) .build()).build(); when(coreV1Api.listNamespacedPod(anyString(), anyString(), anyBoolean(), anyString(), anyString(), anyString(), anyInt(), anyString(), anyInt(), anyBoolean())).thenReturn(new V1PodList()); when(kubernetesPodContainer.getOwnerKind()).thenReturn(REPLICA_SET); when(appsV1Api.readNamespacedReplicaSetStatus(any(), any(), any())).thenReturn(replicaSet); when(coreV1Api.readNamespacedPodStatus(any(), any(), any())).thenThrow(new ApiException(KubernetesConstants.KUBERNETES_POD_NOT_FOUND_ERROR_MESSAGE)); assertEquals("Restarted", true, platform.isContainerRecycled(kubernetesPodContainer)); }
@Override public boolean isContainerRecycled (Container container) { KubernetesPodContainer kubernetesPodContainer = (KubernetesPodContainer) container; if (podExists(kubernetesPodContainer).orElse(false)) return isContainerRestarted(kubernetesPodContainer, ((KubernetesPodContainer) container).getTargetedSubcontainer()); return isDesiredReplicas(kubernetesPodContainer); }
KubernetesPlatform extends Platform implements ShellBasedExperiment<KubernetesPodContainer> { @Override public boolean isContainerRecycled (Container container) { KubernetesPodContainer kubernetesPodContainer = (KubernetesPodContainer) container; if (podExists(kubernetesPodContainer).orElse(false)) return isContainerRestarted(kubernetesPodContainer, ((KubernetesPodContainer) container).getTargetedSubcontainer()); return isDesiredReplicas(kubernetesPodContainer); } }
KubernetesPlatform extends Platform implements ShellBasedExperiment<KubernetesPodContainer> { @Override public boolean isContainerRecycled (Container container) { KubernetesPodContainer kubernetesPodContainer = (KubernetesPodContainer) container; if (podExists(kubernetesPodContainer).orElse(false)) return isContainerRestarted(kubernetesPodContainer, ((KubernetesPodContainer) container).getTargetedSubcontainer()); return isDesiredReplicas(kubernetesPodContainer); } @Autowired  KubernetesPlatform(ApiClient apiClient); }
KubernetesPlatform extends Platform implements ShellBasedExperiment<KubernetesPodContainer> { @Override public boolean isContainerRecycled (Container container) { KubernetesPodContainer kubernetesPodContainer = (KubernetesPodContainer) container; if (podExists(kubernetesPodContainer).orElse(false)) return isContainerRestarted(kubernetesPodContainer, ((KubernetesPodContainer) container).getTargetedSubcontainer()); return isDesiredReplicas(kubernetesPodContainer); } @Autowired  KubernetesPlatform(ApiClient apiClient); String getNamespace(); void setNamespace(String namespace); ContainerHealth checkHealth(KubernetesPodContainer kubernetesPodContainer); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); @Override boolean isContainerRecycled(Container container); ContainerHealth replicaSetRecovered(KubernetesPodContainer kubernetesPodContainer); boolean isDesiredReplicas(KubernetesPodContainer instance); @Override void recycleContainer(KubernetesPodContainer container); boolean deletePod(KubernetesPodContainer instance); @Override ShellClient getConnectedShellClient(KubernetesPodContainer container); }
KubernetesPlatform extends Platform implements ShellBasedExperiment<KubernetesPodContainer> { @Override public boolean isContainerRecycled (Container container) { KubernetesPodContainer kubernetesPodContainer = (KubernetesPodContainer) container; if (podExists(kubernetesPodContainer).orElse(false)) return isContainerRestarted(kubernetesPodContainer, ((KubernetesPodContainer) container).getTargetedSubcontainer()); return isDesiredReplicas(kubernetesPodContainer); } @Autowired  KubernetesPlatform(ApiClient apiClient); String getNamespace(); void setNamespace(String namespace); ContainerHealth checkHealth(KubernetesPodContainer kubernetesPodContainer); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); @Override boolean isContainerRecycled(Container container); ContainerHealth replicaSetRecovered(KubernetesPodContainer kubernetesPodContainer); boolean isDesiredReplicas(KubernetesPodContainer instance); @Override void recycleContainer(KubernetesPodContainer container); boolean deletePod(KubernetesPodContainer instance); @Override ShellClient getConnectedShellClient(KubernetesPodContainer container);  }