use of org.apache.flink.runtime.taskexecutor.TaskSubmissionTestEnvironment.Builder in project flink by apache.
the class TaskExecutorTest method testTerminationOnFatalError.
@Test(timeout = 10000L)
public void testTerminationOnFatalError() throws Throwable {
try (TaskSubmissionTestEnvironment env = new Builder(jobId).setConfiguration(configuration).build()) {
String testExceptionMsg = "Test exception of fatal error.";
env.getTaskExecutor().onFatalError(new Exception(testExceptionMsg));
Throwable exception = env.getTestingFatalErrorHandler().getErrorFuture().get();
env.getTestingFatalErrorHandler().clearError();
assertThat(exception.getMessage(), startsWith(testExceptionMsg));
}
}
use of org.apache.flink.runtime.taskexecutor.TaskSubmissionTestEnvironment.Builder in project flink by apache.
the class TaskExecutorTest method testLogNotFoundHandling.
@Test(timeout = 10000L)
public void testLogNotFoundHandling() throws Throwable {
try (NetUtils.Port port = NetUtils.getAvailablePort()) {
int dataPort = port.getPort();
configuration.setInteger(NettyShuffleEnvironmentOptions.DATA_PORT, dataPort);
configuration.setInteger(NettyShuffleEnvironmentOptions.NETWORK_REQUEST_BACKOFF_INITIAL, 100);
configuration.setInteger(NettyShuffleEnvironmentOptions.NETWORK_REQUEST_BACKOFF_MAX, 200);
configuration.setString(ConfigConstants.TASK_MANAGER_LOG_PATH_KEY, "/i/dont/exist");
try (TaskSubmissionTestEnvironment env = new Builder(jobId).setConfiguration(configuration).setLocalCommunication(false).build()) {
TaskExecutorGateway tmGateway = env.getTaskExecutorGateway();
try {
CompletableFuture<TransientBlobKey> logFuture = tmGateway.requestFileUploadByType(FileType.LOG, timeout);
logFuture.get();
} catch (Exception e) {
assertThat(e.getMessage(), containsString("The file LOG does not exist on the TaskExecutor."));
}
}
}
}
Aggregations