Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class TestLogInfo {

@BeforeEach
public void setup() throws Exception {
prepareCleanTestRootDir();
config.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, TEST_ROOT_DIR.toString());
HdfsConfiguration hdfsConfig = new HdfsConfiguration();
hdfsCluster = new MiniDFSCluster.Builder(hdfsConfig).numDataNodes(1).build();
Expand Down Expand Up @@ -106,7 +107,24 @@ public void tearDown() throws Exception {
jsonGenerator.close();
outStream.close();
outStreamDomain.close();

FileSystem hdfsFs = hdfsCluster.getFileSystem();
if (hdfsFs.exists(TEST_ROOT_DIR)) {
hdfsFs.delete(TEST_ROOT_DIR, true);
}
hdfsCluster.shutdown();

FileSystem localFs = FileSystem.getLocal(config);
if (localFs.exists(TEST_ROOT_DIR)) {
localFs.delete(TEST_ROOT_DIR, true);
}
}
/**
* Creates a fresh test root directory after cleanup.
*/
private void prepareCleanTestRootDir() throws IOException {
FileSystem localFs = FileSystem.getLocal(config);
localFs.mkdirs(TEST_ROOT_DIR);
}

@Test
Expand Down