Search in sources :

Example 6 with TimeoutException

use of io.strimzi.operator.common.operator.resource.TimeoutException in project strimzi-kafka-operator by strimzi.

the class KafkaRollerTest method pod0NotReadyAfterRolling.

@Test
public void pod0NotReadyAfterRolling(VertxTestContext testContext) throws InterruptedException {
    PodOperator podOps = mockPodOps(podId -> podId == 0 ? failedFuture(new TimeoutException("Timeout")) : succeededFuture());
    StatefulSet sts = buildStatefulSet();
    TestingKafkaRoller kafkaRoller = rollerWithControllers(sts, podOps, 2);
    // What does/did the ZK algo do?
    doFailingRollingRestart(testContext, kafkaRoller, asList(0, 1, 2, 3, 4), KafkaRoller.FatalProblem.class, "Error while waiting for restarted pod c-kafka-0 to become ready", singletonList(0));
// TODO assert subsequent rolls
}
Also used : PodOperator(io.strimzi.operator.common.operator.resource.PodOperator) StatefulSet(io.fabric8.kubernetes.api.model.apps.StatefulSet) TimeoutException(io.strimzi.operator.common.operator.resource.TimeoutException) Test(org.junit.jupiter.api.Test)

Example 7 with TimeoutException

use of io.strimzi.operator.common.operator.resource.TimeoutException in project strimzi-kafka-operator by strimzi.

the class KafkaRollerTest method controllerNotReadyAfterRolling.

@Test
public void controllerNotReadyAfterRolling(VertxTestContext testContext) throws InterruptedException {
    PodOperator podOps = mockPodOps(podId -> podId == 2 ? failedFuture(new TimeoutException("Timeout")) : succeededFuture());
    StatefulSet sts = buildStatefulSet();
    TestingKafkaRoller kafkaRoller = rollerWithControllers(sts, podOps, 2);
    // On the first reconciliation we expect it to fail when rolling the controller (i.e. as rolling all the rest)
    doFailingRollingRestart(testContext, kafkaRoller, asList(0, 1, 2, 3, 4), KafkaRoller.FatalProblem.class, "Error while waiting for restarted pod c-kafka-2 to become ready", asList(0, 1, 3, 4, 2));
    // On the next reconciliation only pod 2 would need rolling, and we expect it to fail in the same way
    kafkaRoller = rollerWithControllers(sts, podOps, 2);
    clearRestarted();
    doFailingRollingRestart(testContext, kafkaRoller, singletonList(2), KafkaRoller.FatalProblem.class, "Error while waiting for restarted pod c-kafka-2 to become ready", singletonList(2));
}
Also used : PodOperator(io.strimzi.operator.common.operator.resource.PodOperator) StatefulSet(io.fabric8.kubernetes.api.model.apps.StatefulSet) TimeoutException(io.strimzi.operator.common.operator.resource.TimeoutException) Test(org.junit.jupiter.api.Test)

Example 8 with TimeoutException

use of io.strimzi.operator.common.operator.resource.TimeoutException in project strimzi-kafka-operator by strimzi.

the class KafkaRollerTest method pod1NotReadyAfterRolling.

@Test
public void pod1NotReadyAfterRolling(VertxTestContext testContext) throws InterruptedException {
    PodOperator podOps = mockPodOps(podId -> podId == 1 ? failedFuture(new TimeoutException("Timeout")) : succeededFuture());
    StatefulSet sts = buildStatefulSet();
    TestingKafkaRoller kafkaRoller = rollerWithControllers(sts, podOps, 2);
    // On the first reconciliation we expect it to abort when it gets to pod 1
    doFailingRollingRestart(testContext, kafkaRoller, asList(0, 1, 2, 3, 4), KafkaRoller.FatalProblem.class, "Error while waiting for restarted pod c-kafka-1 to become ready", asList(1));
    // On the next reconciliation only pod 2 (controller) would need rolling, and we expect it to fail in the same way
    kafkaRoller = rollerWithControllers(sts, podOps, 2);
    clearRestarted();
    doFailingRollingRestart(testContext, kafkaRoller, asList(2, 3, 4), KafkaRoller.FatalProblem.class, "Error while waiting for non-restarted pod c-kafka-1 to become ready", emptyList());
}
Also used : PodOperator(io.strimzi.operator.common.operator.resource.PodOperator) StatefulSet(io.fabric8.kubernetes.api.model.apps.StatefulSet) TimeoutException(io.strimzi.operator.common.operator.resource.TimeoutException) Test(org.junit.jupiter.api.Test)

Example 9 with TimeoutException

use of io.strimzi.operator.common.operator.resource.TimeoutException in project strimzi by strimzi.

the class KafkaRollerTest method pod0NotReadyAfterRolling.

@Test
public void pod0NotReadyAfterRolling(VertxTestContext testContext) throws InterruptedException {
    PodOperator podOps = mockPodOps(podId -> podId == 0 ? failedFuture(new TimeoutException("Timeout")) : succeededFuture());
    StatefulSet sts = buildStatefulSet();
    TestingKafkaRoller kafkaRoller = rollerWithControllers(sts, podOps, 2);
    // What does/did the ZK algo do?
    doFailingRollingRestart(testContext, kafkaRoller, asList(0, 1, 2, 3, 4), KafkaRoller.FatalProblem.class, "Error while waiting for restarted pod c-kafka-0 to become ready", singletonList(0));
// TODO assert subsequent rolls
}
Also used : PodOperator(io.strimzi.operator.common.operator.resource.PodOperator) StatefulSet(io.fabric8.kubernetes.api.model.apps.StatefulSet) TimeoutException(io.strimzi.operator.common.operator.resource.TimeoutException) Test(org.junit.jupiter.api.Test)

Example 10 with TimeoutException

use of io.strimzi.operator.common.operator.resource.TimeoutException in project strimzi by strimzi.

the class KafkaRollerTest method controllerNotReadyAfterRolling.

@Test
public void controllerNotReadyAfterRolling(VertxTestContext testContext) throws InterruptedException {
    PodOperator podOps = mockPodOps(podId -> podId == 2 ? failedFuture(new TimeoutException("Timeout")) : succeededFuture());
    StatefulSet sts = buildStatefulSet();
    TestingKafkaRoller kafkaRoller = rollerWithControllers(sts, podOps, 2);
    // On the first reconciliation we expect it to fail when rolling the controller (i.e. as rolling all the rest)
    doFailingRollingRestart(testContext, kafkaRoller, asList(0, 1, 2, 3, 4), KafkaRoller.FatalProblem.class, "Error while waiting for restarted pod c-kafka-2 to become ready", asList(0, 1, 3, 4, 2));
    // On the next reconciliation only pod 2 would need rolling, and we expect it to fail in the same way
    kafkaRoller = rollerWithControllers(sts, podOps, 2);
    clearRestarted();
    doFailingRollingRestart(testContext, kafkaRoller, singletonList(2), KafkaRoller.FatalProblem.class, "Error while waiting for restarted pod c-kafka-2 to become ready", singletonList(2));
}
Also used : PodOperator(io.strimzi.operator.common.operator.resource.PodOperator) StatefulSet(io.fabric8.kubernetes.api.model.apps.StatefulSet) TimeoutException(io.strimzi.operator.common.operator.resource.TimeoutException) Test(org.junit.jupiter.api.Test)

Aggregations

TimeoutException (io.strimzi.operator.common.operator.resource.TimeoutException)12 PodOperator (io.strimzi.operator.common.operator.resource.PodOperator)10 StatefulSet (io.fabric8.kubernetes.api.model.apps.StatefulSet)8 Test (org.junit.jupiter.api.Test)8 PodBuilder (io.fabric8.kubernetes.api.model.PodBuilder)2 Handler (io.vertx.core.Handler)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2