use of org.apache.flink.runtime.io.network.api.writer.RoundRobinChannelSelector in project flink by apache.
the class StreamRecordWriterTest method testPropagateAsyncFlushError.
/**
* Verifies that exceptions during flush from the output flush thread are
* recognized in the writer.
*/
@Test
public void testPropagateAsyncFlushError() {
FailingWriter<LongValue> testWriter = null;
try {
ResultPartitionWriter mockResultPartitionWriter = getMockWriter(5);
// test writer that flushes every 5ms and fails after 3 flushes
testWriter = new FailingWriter<LongValue>(mockResultPartitionWriter, new RoundRobinChannelSelector<LongValue>(), 5, 3);
try {
// in max 20 seconds (conservative)
long deadline = System.currentTimeMillis() + 20000;
long l = 0L;
while (System.currentTimeMillis() < deadline) {
testWriter.emit(new LongValue(l++));
}
fail("This should have failed with an exception");
} catch (IOException e) {
assertNotNull(e.getCause());
assertTrue(e.getCause().getMessage().contains("Test Exception"));
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
} finally {
if (testWriter != null) {
testWriter.close();
}
}
}
use of org.apache.flink.runtime.io.network.api.writer.RoundRobinChannelSelector in project flink by apache.
the class DefaultChannelSelectorTest method channelSelect.
/**
* This test checks the channel selection.
*/
@Test
public void channelSelect() {
final StringValue dummyRecord = new StringValue("abc");
final RoundRobinChannelSelector<StringValue> selector = new RoundRobinChannelSelector<>();
selector.setup(2);
assertSelectedChannel(selector, dummyRecord, 0);
assertSelectedChannel(selector, dummyRecord, 1);
}
Aggregations