use of org.apache.flink.core.fs.FileSystem in project flink by apache.
the class YarnPreConfiguredMasterHaServicesTest method testCloseAndCleanup.
@Test
public void testCloseAndCleanup() throws Exception {
final Configuration flinkConfig = new Configuration();
flinkConfig.setString(YarnConfigOptions.APP_MASTER_RPC_ADDRESS, "localhost");
flinkConfig.setInteger(YarnConfigOptions.APP_MASTER_RPC_PORT, 1427);
// create the services
YarnHighAvailabilityServices services = new YarnPreConfiguredMasterNonHaServices(flinkConfig, hadoopConfig);
services.closeAndCleanupAllData();
final FileSystem fileSystem = HDFS_ROOT_PATH.getFileSystem();
final Path workDir = new Path(HDFS_CLUSTER.getFileSystem().getWorkingDirectory().toString());
try {
fileSystem.getFileStatus(new Path(workDir, YarnHighAvailabilityServices.FLINK_RECOVERY_DATA_DIR));
fail("Flink recovery data directory still exists");
} catch (FileNotFoundException e) {
// expected, because the directory should have been cleaned up
}
assertTrue(services.isClosed());
// doing another cleanup when the services are closed should fail
try {
services.closeAndCleanupAllData();
fail("should fail with an IllegalStateException");
} catch (IllegalStateException e) {
// expected
}
}
Aggregations