Github user zentol commented on a diff in the pull request: https://github.com/apache/flink/pull/5780#discussion_r181582943 --- Diff: flink-tests/src/test/java/org/apache/flink/test/classloading/ClassLoaderITCase.java --- @@ -196,21 +188,23 @@ public void testCheckpointedStreamingClassloaderJobWithCustomClassLoader() throw // the test also ensures that user specific exceptions are serializable between JobManager <--> JobClient. PackagedProgram streamingCheckpointedProg = new PackagedProgram(new File(STREAMING_CHECKPOINTED_PROG_JAR_FILE)); - TestStreamEnvironment.setAsContext( - testCluster, + TestEnvironment.setAsContext( + MINI_CLUSTER_RESOURCE, parallelism, Collections.singleton(new Path(STREAMING_CHECKPOINTED_PROG_JAR_FILE)), Collections.<URL>emptyList()); - // Program should terminate with a 'SuccessException': - // we can not access the SuccessException here when executing the tests with maven, because its not available in the jar. - expectedException.expectCause( - Matchers.<Throwable>hasProperty("cause", - hasProperty("class", - hasProperty("canonicalName", equalTo( - "org.apache.flink.test.classloading.jar.CheckpointedStreamingProgram.SuccessException"))))); - - streamingCheckpointedProg.invokeInteractiveModeForExecution(); + try { + streamingCheckpointedProg.invokeInteractiveModeForExecution(); + } catch (Exception e) { + // Program should terminate with a 'SuccessException': + // we can not access the SuccessException here when executing the tests with maven, because its not available in the jar. + Optional<Throwable> expectedCause = ExceptionUtils.findThrowable(e, + candidate -> candidate.getClass().getCanonicalName().equals("org.apache.flink.test.classloading.jar.CheckpointedStreamingProgram.SuccessException")); --- End diff -- The test failed since the `TestEnvironment` was set as the context, and not the `TestStreamEnvironment` as intended.
---