use of io.confluent.ksql.physical.scalablepush.PushRouting.PushConnectionsHandle in project ksql by confluentinc.
the class PushRoutingTest method shouldFail_LocaleNodeException.
@Test
public void shouldFail_LocaleNodeException() throws ExecutionException, InterruptedException {
// Given:
final AtomicReference<Set<KsqlNode>> nodes = new AtomicReference<>(ImmutableSet.of(ksqlNodeLocal, ksqlNodeRemote));
final PushRouting routing = new PushRouting(sqr -> nodes.get(), 50, true);
// When:
final PushConnectionsHandle handle = handlePushRouting(routing);
context.runOnContext(v -> {
remotePublisher.accept(REMOTE_ROW1);
remotePublisher.accept(REMOTE_ROW2);
localPublisher.error(new RuntimeException("Random local error"));
});
final Throwable throwable = waitOnException(handle);
handle.close();
// Then:
assertThat(throwable.getMessage(), containsString("Random local error"));
}
use of io.confluent.ksql.physical.scalablepush.PushRouting.PushConnectionsHandle in project ksql by confluentinc.
the class PushRoutingTest method shouldSucceed_gapDetectedLocal_noRetry.
@Test
public void shouldSucceed_gapDetectedLocal_noRetry() throws ExecutionException, InterruptedException {
// Given:
final AtomicReference<Set<KsqlNode>> nodes = new AtomicReference<>(ImmutableSet.of(ksqlNodeLocal, ksqlNodeRemote));
final PushRouting routing = new PushRouting(sqr -> nodes.get(), 50, false);
// When:
final PushConnectionsHandle handle = handlePushRouting(routing);
context.runOnContext(v -> {
localPublisher.accept(LOCAL_ROW1);
localPublisher.accept(LOCAL_CONTINUATION_TOKEN1);
localPublisher.accept(LOCAL_ROW2);
localPublisher.accept(LOCAL_CONTINUATION_TOKEN_GAP);
});
Set<List<?>> rows = waitOnRows(2);
waitOnNodeStatus(handle, ksqlNodeLocal, RoutingResultStatus.OFFSET_GAP_FOUND);
handle.close();
// Then:
assertThat(rows.contains(LOCAL_ROW1.value().values()), is(true));
assertThat(rows.contains(LOCAL_ROW2.value().values()), is(true));
assertThat(handle.get(ksqlNodeLocal).get().getStatus(), is(RoutingResultStatus.OFFSET_GAP_FOUND));
}
use of io.confluent.ksql.physical.scalablepush.PushRouting.PushConnectionsHandle in project ksql by confluentinc.
the class PushRoutingTest method shouldSucceed_justForwarded.
@Test
public void shouldSucceed_justForwarded() throws ExecutionException, InterruptedException {
// Given:
when(pushRoutingOptions.getHasBeenForwarded()).thenReturn(true);
final PushRouting routing = new PushRouting();
// When:
final PushConnectionsHandle handle = handlePushRouting(routing);
context.runOnContext(v -> {
localPublisher.accept(LOCAL_ROW1);
localPublisher.accept(LOCAL_ROW2);
});
// Then:
verify(simpleKsqlClient, never()).makeQueryRequestStreamed(any(), any(), any(), any());
Set<List<?>> rows = waitOnRows(2);
handle.close();
assertThat(rows.contains(LOCAL_ROW1.value().values()), is(true));
assertThat(rows.contains(LOCAL_ROW2.value().values()), is(true));
}
Aggregations