Search in sources :

Example 16 with ExpectedTestException

use of org.apache.flink.runtime.operators.testutils.ExpectedTestException in project flink by apache.

the class CachedMatchTaskTest method testFailingHashSecondMatchTask.

@Test
public void testFailingHashSecondMatchTask() {
    int keyCnt1 = 20;
    int valCnt1 = 20;
    int keyCnt2 = 20;
    int valCnt2 = 20;
    addInput(new UniformRecordGenerator(keyCnt1, valCnt1, false));
    addInput(new UniformRecordGenerator(keyCnt2, valCnt2, false));
    addDriverComparator(this.comparator1);
    addDriverComparator(this.comparator2);
    getTaskConfig().setDriverPairComparator(RecordPairComparatorFactory.get());
    setOutput(new NirvanaOutputList());
    getTaskConfig().setDriverStrategy(DriverStrategy.HYBRIDHASH_BUILD_SECOND_CACHED);
    getTaskConfig().setRelativeMemoryDriver(1.0f);
    BuildSecondCachedJoinDriver<Record, Record, Record> testTask = new BuildSecondCachedJoinDriver<Record, Record, Record>();
    try {
        testResettableDriver(testTask, MockFailingMatchStub.class, 3);
        Assert.fail("Function exception was not forwarded.");
    } catch (ExpectedTestException etex) {
    // good!
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("Test caused an exception.");
    }
}
Also used : ExpectedTestException(org.apache.flink.runtime.operators.testutils.ExpectedTestException) Record(org.apache.flink.types.Record) UniformRecordGenerator(org.apache.flink.runtime.operators.testutils.UniformRecordGenerator) NirvanaOutputList(org.apache.flink.runtime.operators.testutils.NirvanaOutputList) ExpectedTestException(org.apache.flink.runtime.operators.testutils.ExpectedTestException) Test(org.junit.Test)

Example 17 with ExpectedTestException

use of org.apache.flink.runtime.operators.testutils.ExpectedTestException in project flink by apache.

the class CachedMatchTaskTest method testFailingHashFirstMatchTask.

@Test
public void testFailingHashFirstMatchTask() {
    int keyCnt1 = 20;
    int valCnt1 = 20;
    int keyCnt2 = 20;
    int valCnt2 = 20;
    addInput(new UniformRecordGenerator(keyCnt1, valCnt1, false));
    addInput(new UniformRecordGenerator(keyCnt2, valCnt2, false));
    addDriverComparator(this.comparator1);
    addDriverComparator(this.comparator2);
    getTaskConfig().setDriverPairComparator(RecordPairComparatorFactory.get());
    setOutput(new NirvanaOutputList());
    getTaskConfig().setDriverStrategy(DriverStrategy.HYBRIDHASH_BUILD_FIRST_CACHED);
    getTaskConfig().setRelativeMemoryDriver(1.0f);
    BuildFirstCachedJoinDriver<Record, Record, Record> testTask = new BuildFirstCachedJoinDriver<Record, Record, Record>();
    try {
        testResettableDriver(testTask, MockFailingMatchStub.class, 3);
        Assert.fail("Function exception was not forwarded.");
    } catch (ExpectedTestException etex) {
    // good!
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("Test caused an exception.");
    }
}
Also used : ExpectedTestException(org.apache.flink.runtime.operators.testutils.ExpectedTestException) Record(org.apache.flink.types.Record) UniformRecordGenerator(org.apache.flink.runtime.operators.testutils.UniformRecordGenerator) NirvanaOutputList(org.apache.flink.runtime.operators.testutils.NirvanaOutputList) ExpectedTestException(org.apache.flink.runtime.operators.testutils.ExpectedTestException) Test(org.junit.Test)

Example 18 with ExpectedTestException

use of org.apache.flink.runtime.operators.testutils.ExpectedTestException in project flink by apache.

the class CombineTaskTest method testFailingCombineTask.

@Test
public void testFailingCombineTask() {
    try {
        int keyCnt = 100;
        int valCnt = 20;
        setInput(new UniformIntTupleGenerator(keyCnt, valCnt, false), serializer);
        addDriverComparator(this.comparator);
        addDriverComparator(this.comparator);
        setOutput(new DiscardingOutputCollector<Tuple2<Integer, Integer>>());
        getTaskConfig().setDriverStrategy(DriverStrategy.SORTED_GROUP_COMBINE);
        getTaskConfig().setRelativeMemoryDriver(combine_frac);
        getTaskConfig().setFilehandlesDriver(2);
        final GroupReduceCombineDriver<Tuple2<Integer, Integer>, Tuple2<Integer, Integer>> testTask = new GroupReduceCombineDriver<>();
        try {
            testDriver(testTask, MockFailingCombiningReduceStub.class);
            fail("Exception not forwarded.");
        } catch (ExpectedTestException etex) {
        // good!
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : UniformIntTupleGenerator(org.apache.flink.runtime.operators.testutils.UniformIntTupleGenerator) ExpectedTestException(org.apache.flink.runtime.operators.testutils.ExpectedTestException) Tuple2(org.apache.flink.api.java.tuple.Tuple2) ExpectedTestException(org.apache.flink.runtime.operators.testutils.ExpectedTestException) Test(org.junit.Test)

Example 19 with ExpectedTestException

use of org.apache.flink.runtime.operators.testutils.ExpectedTestException in project flink by apache.

the class FlatMapTaskTest method testFailingMapTask.

@Test
public void testFailingMapTask() {
    final int keyCnt = 100;
    final int valCnt = 20;
    addInput(new UniformRecordGenerator(keyCnt, valCnt, false));
    setOutput(new DiscardingOutputCollector<Record>());
    final FlatMapDriver<Record, Record> testTask = new FlatMapDriver<>();
    try {
        testDriver(testTask, MockFailingMapStub.class);
        Assert.fail("Function exception was not forwarded.");
    } catch (ExpectedTestException e) {
    // good!
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("Exception in test.");
    }
}
Also used : ExpectedTestException(org.apache.flink.runtime.operators.testutils.ExpectedTestException) Record(org.apache.flink.types.Record) UniformRecordGenerator(org.apache.flink.runtime.operators.testutils.UniformRecordGenerator) ExpectedTestException(org.apache.flink.runtime.operators.testutils.ExpectedTestException) Test(org.junit.Test)

Example 20 with ExpectedTestException

use of org.apache.flink.runtime.operators.testutils.ExpectedTestException in project flink by apache.

the class CrossTaskTest method testFailingBlockCrossTask.

@Test
public void testFailingBlockCrossTask() {
    int keyCnt1 = 10;
    int valCnt1 = 1;
    int keyCnt2 = 100;
    int valCnt2 = 4;
    setOutput(this.output);
    addInput(new UniformRecordGenerator(keyCnt1, valCnt1, false));
    addInput(new UniformRecordGenerator(keyCnt2, valCnt2, false));
    getTaskConfig().setDriverStrategy(DriverStrategy.NESTEDLOOP_BLOCKED_OUTER_FIRST);
    getTaskConfig().setRelativeMemoryDriver(cross_frac);
    final CrossDriver<Record, Record, Record> testTask = new CrossDriver<>();
    try {
        testDriver(testTask, MockFailingCrossStub.class);
        Assert.fail("Exception not forwarded.");
    } catch (ExpectedTestException etex) {
    // good!
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("Test failed due to an exception.");
    }
}
Also used : ExpectedTestException(org.apache.flink.runtime.operators.testutils.ExpectedTestException) Record(org.apache.flink.types.Record) UniformRecordGenerator(org.apache.flink.runtime.operators.testutils.UniformRecordGenerator) ExpectedTestException(org.apache.flink.runtime.operators.testutils.ExpectedTestException) Test(org.junit.Test)

Aggregations

ExpectedTestException (org.apache.flink.runtime.operators.testutils.ExpectedTestException)23 Test (org.junit.Test)21 UniformRecordGenerator (org.apache.flink.runtime.operators.testutils.UniformRecordGenerator)12 Record (org.apache.flink.types.Record)12 IOException (java.io.IOException)4 NirvanaOutputList (org.apache.flink.runtime.operators.testutils.NirvanaOutputList)4 CheckpointException (org.apache.flink.runtime.checkpoint.CheckpointException)3 TimeoutException (java.util.concurrent.TimeoutException)2 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)2 JobID (org.apache.flink.api.common.JobID)2 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)2 CancelTaskException (org.apache.flink.runtime.execution.CancelTaskException)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Collections.emptyList (java.util.Collections.emptyList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 CompletableFuture (java.util.concurrent.CompletableFuture)1