wangzzu commented on code in PR #23244:
URL: https://github.com/apache/flink/pull/23244#discussion_r1305805239


##########
flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/MiniClusterITCase.java:
##########
@@ -106,30 +100,26 @@ public void runJobWithMultipleRpcServices() throws 
Exception {
     }
 
     @Test
-    public void testHandleStreamingJobsWhenNotEnoughSlot() throws Exception {
-        try {
-            final JobVertex vertex1 = new JobVertex("Test Vertex1");
-            vertex1.setParallelism(1);
-            vertex1.setMaxParallelism(1);
-            vertex1.setInvokableClass(BlockingNoOpInvokable.class);
-
-            final JobVertex vertex2 = new JobVertex("Test Vertex2");
-            vertex2.setParallelism(1);
-            vertex2.setMaxParallelism(1);
-            vertex2.setInvokableClass(BlockingNoOpInvokable.class);
-
-            vertex2.connectNewDataSetAsInput(
-                    vertex1, DistributionPattern.POINTWISE, 
ResultPartitionType.PIPELINED);
-
-            final JobGraph jobGraph = 
JobGraphTestUtils.streamingJobGraph(vertex1, vertex2);
-
-            runHandleJobsWhenNotEnoughSlots(jobGraph);
-
-            fail("Job should fail.");
-        } catch (JobExecutionException e) {
-            assertThat(e, FlinkMatchers.containsMessage("Job execution 
failed"));
-            assertThat(e, 
FlinkMatchers.containsCause(NoResourceAvailableException.class));
-        }
+    void testHandleStreamingJobsWhenNotEnoughSlot() {
+        final JobVertex vertex1 = new JobVertex("Test Vertex1");
+        vertex1.setParallelism(1);
+        vertex1.setMaxParallelism(1);
+        vertex1.setInvokableClass(BlockingNoOpInvokable.class);
+
+        final JobVertex vertex2 = new JobVertex("Test Vertex2");
+        vertex2.setParallelism(1);
+        vertex2.setMaxParallelism(1);
+        vertex2.setInvokableClass(BlockingNoOpInvokable.class);
+
+        vertex2.connectNewDataSetAsInput(
+                vertex1, DistributionPattern.POINTWISE, 
ResultPartitionType.PIPELINED);
+
+        final JobGraph jobGraph = JobGraphTestUtils.streamingJobGraph(vertex1, 
vertex2);
+
+        assertThatThrownBy(() -> runHandleJobsWhenNotEnoughSlots(jobGraph))
+                .isInstanceOf(JobExecutionException.class)
+                .satisfies(anyCauseMatches(NoResourceAvailableException.class))
+                .satisfies(anyCauseMatches("Job execution failed"));

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to