Search in sources :

Example 1 with ClusterDbOpsRestartStatus

use of io.stackgres.common.crd.sgcluster.ClusterDbOpsRestartStatus in project stackgres by ongres.

the class ClusterStateHandlerTest method verifyClusterInitializedStatus.

protected void verifyClusterInitializedStatus(List<Pod> pods, StackGresCluster cluster) {
    List<String> expectedInitialInstances = pods.stream().map(Pod::getMetadata).map(ObjectMeta::getName).sorted(String::compareTo).collect(Collectors.toUnmodifiableList());
    final ClusterDbOpsRestartStatus initializedSecurityUpgradeStatus = getRestartStatus(cluster).orElseThrow();
    Pod primaryPod = pods.stream().filter(pod -> pod.getMetadata().getName().endsWith("-0")).findAny().get();
    assertEquals(primaryPod.getMetadata().getName(), initializedSecurityUpgradeStatus.getPrimaryInstance());
    List<String> actualInitialInstances = initializedSecurityUpgradeStatus.getInitialInstances();
    assertEquals(expectedInitialInstances, actualInitialInstances);
}
Also used : ObjectMeta(io.fabric8.kubernetes.api.model.ObjectMeta) Pod(io.fabric8.kubernetes.api.model.Pod) ClusterDbOpsRestartStatus(io.stackgres.common.crd.sgcluster.ClusterDbOpsRestartStatus)

Aggregations

ObjectMeta (io.fabric8.kubernetes.api.model.ObjectMeta)1 Pod (io.fabric8.kubernetes.api.model.Pod)1 ClusterDbOpsRestartStatus (io.stackgres.common.crd.sgcluster.ClusterDbOpsRestartStatus)1