tillrohrmann commented on a change in pull request #15251:
URL: https://github.com/apache/flink/pull/15251#discussion_r597605404
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
##########
@@ -722,25 +727,50 @@ public void testRestoringModifiedJobFromSavepointFails()
throws Exception {
final DefaultDeclarativeSlotPool declarativeSlotPool =
createDeclarativeSlotPool(jobGraphWithNewOperator.getJobID());
- final AdaptiveScheduler adaptiveScheduler =
- new AdaptiveSchedulerBuilder(jobGraphWithNewOperator,
mainThreadExecutor)
- .setDeclarativeSlotPool(declarativeSlotPool)
- .build();
-
- adaptiveScheduler.startScheduling();
-
- offerSlots(
- declarativeSlotPool,
- createSlotOffersForResourceRequirements(
- ResourceCounter.withResource(ResourceProfile.UNKNOWN,
1)));
-
- final ArchivedExecutionGraph archivedExecutionGraph =
- adaptiveScheduler.requestJob().getArchivedExecutionGraph();
-
- assertThat(archivedExecutionGraph.getState(), is(JobStatus.FAILED));
- assertThat(
- archivedExecutionGraph.getFailureInfo().getException(),
- FlinkMatchers.containsMessage("Failed to rollback to
checkpoint/savepoint"));
+ final GloballyTerminalJobStatusListener jobStatusListener =
+ new GloballyTerminalJobStatusListener();
+
+ final ScheduledExecutorService singleThreadExecutor =
+ Executors.newSingleThreadScheduledExecutor();
+
+ try {
+ final ComponentMainThreadExecutor singleMainThreadExecutor =
+
ComponentMainThreadExecutorServiceAdapter.forSingleThreadExecutor(
Review comment:
I think the important bit is to use the manually triggered main thread
executor as little as possible. This makes things just harder to change in the
future. If the tests are build so that they can work together with a normal
`Executor`, then it is much better. In fact, I start to believe that tests
which require the manually triggered main thread executor are smelling a bit.
This can be an indicator that the class under test is not really well testable.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]