@Test public void testSuccessfulProgramAfterFailure() throws Exception { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); runConnectedComponents(env); try { runKMeans(env); fail("This program execution should have failed."); } catch (JobExecutionException e) { assertTrue(e.getCause().getMessage().contains("Insufficient number of network buffers")); } runConnectedComponents(env); }
kafkaServer.getVersion().equals("0.11") || kafkaServer.getVersion().equals("2.0")) { assertTrue(jee.getCause() instanceof TimeoutException); TimeoutException te = (TimeoutException) jee.getCause(); assertTrue(jee.getCause() instanceof RuntimeException); RuntimeException re = (RuntimeException) jee.getCause();
@Test public void testNullValues() { try { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); env.setParallelism(1); env.getConfig().disableSysoutLogging(); DataSet<String> data = env.fromElements("hallo") .map(new MapFunction<String, String>() { @Override public String map(String value) throws Exception { return null; } }); data.writeAsText("/tmp/myTest", FileSystem.WriteMode.OVERWRITE); try { env.execute(); fail("this should fail due to null values."); } catch (JobExecutionException e) { assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof NullPointerException); } } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
@Override protected void testProgram() throws Exception { //test failing version try { executeTask(new FailingTestMapper(), 1); } catch (RuntimeException e) { //expected for collection execution if (!isCollectionExecution()) { Assert.fail(); } // for collection execution, no restarts. So, exception should be appended with 0. Assert.assertEquals(EXCEPTION_STRING + ":0", e.getMessage()); } catch (JobExecutionException e) { //expected for cluster execution if (isCollectionExecution()) { Assert.fail(); } // for cluster execution, one restart. So, exception should be appended with 1. Assert.assertEquals(EXCEPTION_STRING + ":1", e.getCause().getMessage()); } //test correct version executeTask(new TestMapper(), 0); }
client.submitJob(scaledJobGraph, RescalingITCase.class.getClassLoader()); } catch (JobExecutionException exception) { if (exception.getCause() instanceof IllegalStateException) {
@Test public void testInvalidTypeAccumulator() throws Exception { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); env.getConfig().disableSysoutLogging(); // Test Exception forwarding with faulty Accumulator implementation env.generateSequence(0, 10000) .map(new IncompatibleAccumulatorTypesMapper()) .map(new IncompatibleAccumulatorTypesMapper2()) .output(new DiscardingOutputFormat<>()); try { env.execute(); fail("Should have failed."); } catch (JobExecutionException e) { assertTrue("Root cause should be:", e.getCause() instanceof Exception); assertTrue("Root cause should be:", e.getCause().getCause() instanceof UnsupportedOperationException); } }
@Test public void testIncorrectSerializer1() { try { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); env.setParallelism(PARLLELISM); env.getConfig().disableSysoutLogging(); env .generateSequence(1, 10 * PARLLELISM) .map(new MapFunction<Long, ConsumesTooMuch>() { @Override public ConsumesTooMuch map(Long value) throws Exception { return new ConsumesTooMuch(); } }) .rebalance() .output(new DiscardingOutputFormat<ConsumesTooMuch>()); env.execute(); } catch (JobExecutionException e) { Throwable rootCause = e.getCause(); assertTrue(rootCause instanceof IOException); assertTrue(rootCause.getMessage().contains("broken serialization")); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
@Test public void testIncorrectSerializer2() { try { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); env.setParallelism(PARLLELISM); env.getConfig().disableSysoutLogging(); env .generateSequence(1, 10 * PARLLELISM) .map(new MapFunction<Long, ConsumesTooMuchSpanning>() { @Override public ConsumesTooMuchSpanning map(Long value) throws Exception { return new ConsumesTooMuchSpanning(); } }) .rebalance() .output(new DiscardingOutputFormat<ConsumesTooMuchSpanning>()); env.execute(); } catch (JobExecutionException e) { Throwable rootCause = e.getCause(); assertTrue(rootCause instanceof IOException); assertTrue(rootCause.getMessage().contains("broken serialization")); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
@Test public void testIncorrectSerializer3() { try { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); env.setParallelism(PARLLELISM); env.getConfig().disableSysoutLogging(); env .generateSequence(1, 10 * PARLLELISM) .map(new MapFunction<Long, ConsumesTooLittle>() { @Override public ConsumesTooLittle map(Long value) throws Exception { return new ConsumesTooLittle(); } }) .rebalance() .output(new DiscardingOutputFormat<ConsumesTooLittle>()); env.execute(); } catch (JobExecutionException e) { Throwable rootCause = e.getCause(); assertTrue(rootCause instanceof IOException); assertTrue(rootCause.getMessage().contains("broken serialization")); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }