Search in sources :

Example 1 with BufferBuilderTestUtils.createFilledFinishedBufferConsumer

use of org.apache.flink.runtime.io.network.buffer.BufferBuilderTestUtils.createFilledFinishedBufferConsumer in project flink by apache.

the class SubpartitionTestBase method testRecycleBufferAndConsumerOnFailure.

@Test
public void testRecycleBufferAndConsumerOnFailure() throws Exception {
    final ResultSubpartition subpartition = createFailingWritesSubpartition();
    try {
        final BufferConsumer consumer = BufferBuilderTestUtils.createFilledFinishedBufferConsumer(100);
        try {
            subpartition.add(consumer);
            subpartition.flush();
            fail("should fail with an exception");
        } catch (Exception ignored) {
        // expected
        }
        assertTrue(consumer.isRecycled());
    } finally {
        subpartition.release();
    }
}
Also used : BufferConsumer(org.apache.flink.runtime.io.network.buffer.BufferConsumer) BufferBuilderTestUtils.createFilledFinishedBufferConsumer(org.apache.flink.runtime.io.network.buffer.BufferBuilderTestUtils.createFilledFinishedBufferConsumer) Test(org.junit.Test)

Aggregations

BufferBuilderTestUtils.createFilledFinishedBufferConsumer (org.apache.flink.runtime.io.network.buffer.BufferBuilderTestUtils.createFilledFinishedBufferConsumer)1 BufferConsumer (org.apache.flink.runtime.io.network.buffer.BufferConsumer)1 Test (org.junit.Test)1