@Test public void replicaSetRecovered () throws ApiException { V1PodList pods = getV1PodList(randomUUID().toString()); when(coreV1Api.listNamespacedPod(anyString(), anyString(), anyBoolean(), anyString(), anyString(), anyString(), anyInt(), anyString(), anyInt(), anyBoolean())).thenReturn(getV1PodList(true)); pods.getItems().get(0).getMetadata().getOwnerReferences().get(0).setKind("ReplicationController"); pods.getItems().get(0).getMetadata().getOwnerReferences().get(0).setName("dummy"); when(coreV1Api.readNamespacedReplicationControllerStatus(eq("dummy"), eq(pods.getItems().get(0).getMetadata().getNamespace()), eq("true"))).thenReturn(new V1ReplicationControllerBuilder().withStatus(new V1ReplicationControllerStatusBuilder() .withReplicas(1) .withReadyReplicas(1) .build()).build()); KubernetesPodContainer kubernetesPodContainer = platform.fromKubernetesAPIPod(pods.getItems().get(0)); assertEquals(ContainerHealth.NORMAL, platform.replicaSetRecovered(kubernetesPodContainer)); }
public ContainerHealth replicaSetRecovered (KubernetesPodContainer kubernetesPodContainer) { return isDesiredReplicas(kubernetesPodContainer) && !podExists(kubernetesPodContainer).orElse(false) ? ContainerHealth.NORMAL : ContainerHealth.RUNNING_EXPERIMENT; }
KubernetesPlatform extends Platform implements ShellBasedExperiment<KubernetesPodContainer> { public ContainerHealth replicaSetRecovered (KubernetesPodContainer kubernetesPodContainer) { return isDesiredReplicas(kubernetesPodContainer) && !podExists(kubernetesPodContainer).orElse(false) ? ContainerHealth.NORMAL : ContainerHealth.RUNNING_EXPERIMENT; } }
KubernetesPlatform extends Platform implements ShellBasedExperiment<KubernetesPodContainer> { public ContainerHealth replicaSetRecovered (KubernetesPodContainer kubernetesPodContainer) { return isDesiredReplicas(kubernetesPodContainer) && !podExists(kubernetesPodContainer).orElse(false) ? ContainerHealth.NORMAL : ContainerHealth.RUNNING_EXPERIMENT; } @Autowired  KubernetesPlatform(ApiClient apiClient); }
KubernetesPlatform extends Platform implements ShellBasedExperiment<KubernetesPodContainer> { public ContainerHealth replicaSetRecovered (KubernetesPodContainer kubernetesPodContainer) { return isDesiredReplicas(kubernetesPodContainer) && !podExists(kubernetesPodContainer).orElse(false) ? ContainerHealth.NORMAL : ContainerHealth.RUNNING_EXPERIMENT; } @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> { public ContainerHealth replicaSetRecovered (KubernetesPodContainer kubernetesPodContainer) { return isDesiredReplicas(kubernetesPodContainer) && !podExists(kubernetesPodContainer).orElse(false) ? ContainerHealth.NORMAL : ContainerHealth.RUNNING_EXPERIMENT; } @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);  }