use of org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.StreamConsumerFakeKinesis in project flink by apache.
the class StreamConsumerRegistrarTest method testRegisterStreamConsumerWaitsForConsumerToBecomeActive.
@Test
public void testRegisterStreamConsumerWaitsForConsumerToBecomeActive() throws Exception {
FullJitterBackoff backoff = mock(FullJitterBackoff.class);
StreamConsumerFakeKinesis kinesis = FakeKinesisFanOutBehavioursFactory.registerExistingConsumerAndWaitToBecomeActive();
StreamConsumerRegistrar registrar = createRegistrar(kinesis, backoff);
String result = registrar.registerStreamConsumer(STREAM, "name");
// we backoff on each retry
verify(backoff, times(NUMBER_OF_DESCRIBE_REQUESTS_TO_ACTIVATE - 1)).sleep(anyLong());
assertEquals(STREAM_CONSUMER_ARN_EXISTING, result);
// We will invoke describe stream until the stream consumer is activated
assertEquals(NUMBER_OF_DESCRIBE_REQUESTS_TO_ACTIVATE, kinesis.getNumberOfDescribeStreamConsumerInvocations());
for (int i = 1; i < NUMBER_OF_DESCRIBE_REQUESTS_TO_ACTIVATE; i++) {
verify(backoff).calculateFullJitterBackoff(anyLong(), anyLong(), anyDouble(), eq(i));
}
}
use of org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.StreamConsumerFakeKinesis in project flink by apache.
the class StreamConsumerRegistrarTest method testDeregisterStreamConsumerTimeoutWaitingForConsumerToDeregister.
@Test
public void testDeregisterStreamConsumerTimeoutWaitingForConsumerToDeregister() throws Exception {
thrown.expect(FlinkKinesisTimeoutException.class);
thrown.expectMessage("Timeout waiting for stream consumer to deregister: stream-consumer-arn");
StreamConsumerFakeKinesis kinesis = FakeKinesisFanOutBehavioursFactory.existingActiveConsumer();
Properties configProps = createEfoProperties();
configProps.setProperty(DEREGISTER_STREAM_TIMEOUT_SECONDS, "1");
FanOutRecordPublisherConfiguration configuration = new FanOutRecordPublisherConfiguration(configProps, singletonList(STREAM));
StreamConsumerRegistrar registrar = new StreamConsumerRegistrar(kinesis, configuration, backoffFor(1001));
registrar.deregisterStreamConsumer(STREAM);
}
use of org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.StreamConsumerFakeKinesis in project flink by apache.
the class StreamConsumerRegistrarTest method testDeregisterStreamConsumerArnNotFound.
@Test
public void testDeregisterStreamConsumerArnNotFound() throws Exception {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Stream consumer ARN not found for stream: not-found");
FullJitterBackoff backoff = mock(FullJitterBackoff.class);
StreamConsumerFakeKinesis kinesis = FakeKinesisFanOutBehavioursFactory.streamConsumerNotFound();
StreamConsumerRegistrar registrar = createRegistrar(kinesis, backoff);
registrar.deregisterStreamConsumer("not-found");
}
use of org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.StreamConsumerFakeKinesis in project flink by apache.
the class StreamConsumerRegistrarTest method testDeregisterStreamConsumerNotFound.
@Test
public void testDeregisterStreamConsumerNotFound() throws Exception {
FullJitterBackoff backoff = mock(FullJitterBackoff.class);
StreamConsumerFakeKinesis kinesis = FakeKinesisFanOutBehavioursFactory.streamConsumerNotFound();
StreamConsumerRegistrar registrar = createRegistrar(kinesis, backoff);
registrar.deregisterStreamConsumer(STREAM);
assertEquals(1, kinesis.getNumberOfDescribeStreamConsumerInvocations());
}
use of org.apache.flink.streaming.connectors.kinesis.testutils.FakeKinesisFanOutBehavioursFactory.StreamConsumerFakeKinesis in project flink by apache.
the class StreamConsumerRegistrarTest method testDeregisterStreamConsumerAndWaitForDeletingStatus.
@Test
public void testDeregisterStreamConsumerAndWaitForDeletingStatus() throws Exception {
FullJitterBackoff backoff = mock(FullJitterBackoff.class);
StreamConsumerFakeKinesis kinesis = FakeKinesisFanOutBehavioursFactory.existingActiveConsumer();
StreamConsumerRegistrar registrar = createRegistrar(kinesis, backoff);
registrar.deregisterStreamConsumer(STREAM);
// We will invoke describe stream until the stream consumer is in the DELETING state
assertEquals(2, kinesis.getNumberOfDescribeStreamConsumerInvocations());
for (int i = 1; i < 2; i++) {
verify(backoff).calculateFullJitterBackoff(anyLong(), anyLong(), anyDouble(), eq(i));
}
}
Aggregations