Search in sources :

Example 1 with DebeziumOperandSupport.computeStatus

use of org.bf2.cos.fleetshard.operator.debezium.DebeziumOperandSupport.computeStatus in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class DebeziumOperandControllerTest method computeStatus.

@ParameterizedTest
@MethodSource
void computeStatus(String connectorState, String conditionType, String conditionReason, String expectedConnectorState) {
    ConnectorStatusSpec status = new ConnectorStatusSpec();
    DebeziumOperandSupport.computeStatus(status, new KafkaConnectorBuilder().withStatus(new KafkaConnectorStatusBuilder().addToConditions(new ConditionBuilder().withType(conditionType).withReason(conditionReason).build()).addToConnectorStatus("connector", new org.bf2.cos.fleetshard.operator.debezium.model.KafkaConnectorStatusBuilder().withState(connectorState).build()).build()).build());
    assertThat(status.getPhase()).isEqualTo(expectedConnectorState);
    assertThat(status.getConditions()).anySatisfy(condition -> {
        assertThat(condition).hasFieldOrPropertyWithValue("type", conditionType).hasFieldOrPropertyWithValue("reason", conditionReason);
    });
}
Also used : ConditionBuilder(io.strimzi.api.kafka.model.status.ConditionBuilder) KafkaConnectorBuilder(io.strimzi.api.kafka.model.KafkaConnectorBuilder) ConnectorStatusSpec(org.bf2.cos.fleetshard.api.ConnectorStatusSpec) KafkaConnectorStatusBuilder(io.strimzi.api.kafka.model.status.KafkaConnectorStatusBuilder) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 2 with DebeziumOperandSupport.computeStatus

use of org.bf2.cos.fleetshard.operator.debezium.DebeziumOperandSupport.computeStatus in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class DebeziumOperandControllerTest method computeStatus.

@ParameterizedTest
@MethodSource
void computeStatus(String connectorState, List<Condition> connectorConditions, List<Condition> connectConditions, String expectedManagedConnectorState, String expectedReason) {
    ConnectorStatusSpec status = new ConnectorStatusSpec();
    DebeziumOperandSupport.computeStatus(status, new KafkaConnectBuilder().withStatus(new KafkaConnectStatusBuilder().addAllToConditions(connectConditions).build()).build(), new KafkaConnectorBuilder().withStatus(new KafkaConnectorStatusBuilder().addAllToConditions(connectorConditions).addToConnectorStatus("connector", new org.bf2.cos.fleetshard.operator.debezium.model.KafkaConnectorStatusBuilder().withState(connectorState).build()).build()).build());
    assertThat(status.getPhase()).isEqualTo(expectedManagedConnectorState);
    assertThat(status.getConditions()).anySatisfy(condition -> assertThat(condition).hasFieldOrPropertyWithValue("type", "Ready").hasFieldOrPropertyWithValue("status", null == expectedReason ? "True" : "False").hasFieldOrPropertyWithValue("reason", expectedReason));
}
Also used : KafkaConnectBuilder(io.strimzi.api.kafka.model.KafkaConnectBuilder) KafkaConnectorBuilder(io.strimzi.api.kafka.model.KafkaConnectorBuilder) KafkaConnectStatusBuilder(io.strimzi.api.kafka.model.status.KafkaConnectStatusBuilder) ConnectorStatusSpec(org.bf2.cos.fleetshard.api.ConnectorStatusSpec) KafkaConnectorStatusBuilder(io.strimzi.api.kafka.model.status.KafkaConnectorStatusBuilder) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

KafkaConnectorBuilder (io.strimzi.api.kafka.model.KafkaConnectorBuilder)2 KafkaConnectorStatusBuilder (io.strimzi.api.kafka.model.status.KafkaConnectorStatusBuilder)2 ConnectorStatusSpec (org.bf2.cos.fleetshard.api.ConnectorStatusSpec)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 KafkaConnectBuilder (io.strimzi.api.kafka.model.KafkaConnectBuilder)1 ConditionBuilder (io.strimzi.api.kafka.model.status.ConditionBuilder)1 KafkaConnectStatusBuilder (io.strimzi.api.kafka.model.status.KafkaConnectStatusBuilder)1