Search in sources :

Example 1 with ConnectorStatusSpec

use of org.bf2.cos.fleetshard.api.ConnectorStatusSpec 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)

Aggregations

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