Skip to content

Commit

Permalink
[FLINK-14246][runtime] Annotate MiniClusterITCase with AlsoRunWithSch…
Browse files Browse the repository at this point in the history
…edulerNG and fix broken tests

The tests broke because the error messages of NoResourceAvailableExceptions from
LegacyScheduler and DefaultScheduler are different.
  • Loading branch information
zhuzhurk authored and GJL committed Oct 15, 2019
1 parent 73ec89b commit 3437918
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
import org.apache.flink.runtime.testtasks.BlockingNoOpInvokable;
import org.apache.flink.runtime.testtasks.NoOpInvokable;
import org.apache.flink.runtime.testtasks.WaitingNoOpInvokable;
import org.apache.flink.testutils.junit.category.AlsoRunWithSchedulerNG;
import org.apache.flink.util.TestLogger;

import org.junit.Test;
import org.junit.experimental.categories.Category;

import java.io.IOException;
import java.util.concurrent.CompletableFuture;
Expand All @@ -62,6 +64,7 @@
/**
* Integration test cases for the {@link MiniCluster}.
*/
@Category(AlsoRunWithSchedulerNG.class)
public class MiniClusterITCase extends TestLogger {

@Test
Expand Down Expand Up @@ -110,7 +113,12 @@ public void testHandleStreamingJobsWhenNotEnoughSlot() throws Exception {
} catch (JobExecutionException e) {
assertTrue(findThrowableWithMessage(e, "Job execution failed.").isPresent());
assertTrue(findThrowable(e, NoResourceAvailableException.class).isPresent());
assertTrue(findThrowableWithMessage(e, "Slots required: 2, slots allocated: 1").isPresent());

//TODO: remove the legacy scheduler message check once legacy scheduler is removed
final String legacySchedulerErrorMessage = "Slots required: 2, slots allocated: 1";
final String ngSchedulerErrorMessage = "Could not allocate the required slot within slot request timeout";
assertTrue(findThrowableWithMessage(e, legacySchedulerErrorMessage).isPresent() ||
findThrowableWithMessage(e, ngSchedulerErrorMessage).isPresent());
}
}

Expand All @@ -122,7 +130,12 @@ public void testHandleBatchJobsWhenNotEnoughSlot() throws Exception {
} catch (JobExecutionException e) {
assertTrue(findThrowableWithMessage(e, "Job execution failed.").isPresent());
assertTrue(findThrowable(e, NoResourceAvailableException.class).isPresent());
assertTrue(findThrowableWithMessage(e, "Could not allocate enough slots").isPresent());

//TODO: remove the legacy scheduler message check once legacy scheduler is removed
final String legacySchedulerErrorMessage = "Could not allocate enough slots";
final String ngSchedulerErrorMessage = "Could not allocate the required slot within slot request timeout";
assertTrue(findThrowableWithMessage(e, legacySchedulerErrorMessage).isPresent() ||
findThrowableWithMessage(e, ngSchedulerErrorMessage).isPresent());
}
}

Expand Down

0 comments on commit 3437918

Please sign in to comment.