Skip to content

Commit d88c15f

Browse files
committed
Delete File generated by UT
1 parent 166ef69 commit d88c15f

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/FileUtilsTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.io.FileInputStream;
2323
import java.io.FileNotFoundException;
2424

25+
import org.junit.jupiter.api.AfterEach;
2526
import org.junit.jupiter.api.Assertions;
2627
import org.junit.jupiter.api.Test;
2728
import org.junit.jupiter.api.extension.ExtendWith;
@@ -128,4 +129,9 @@ void testGetFileChecksum() throws Exception {
128129
() -> FileUtils.getFileChecksum(dirPath));
129130
}
130131

132+
@AfterEach
133+
public void tearDown() {
134+
FileUtils.deleteFile("test");
135+
}
136+
131137
}

dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/utils/TaskCacheUtilsTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package org.apache.dolphinscheduler.dao.utils;
1919

20-
import static org.apache.dolphinscheduler.common.constants.Constants.CRC_SUFFIX;
21-
2220
import org.apache.dolphinscheduler.common.enums.Flag;
2321
import org.apache.dolphinscheduler.common.utils.FileUtils;
2422
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
@@ -36,6 +34,7 @@
3634
import java.util.List;
3735
import java.util.Map;
3836

37+
import org.junit.jupiter.api.AfterEach;
3938
import org.junit.jupiter.api.Assertions;
4039
import org.junit.jupiter.api.BeforeEach;
4140
import org.junit.jupiter.api.Test;
@@ -182,8 +181,8 @@ void testGetCacheKey() {
182181
@Test
183182
void testReplaceWithCheckSum() {
184183
String content = "abcdefg";
185-
String filePath = "test/testFile.txt";
186-
FileUtils.writeContent2File(content, filePath + CRC_SUFFIX);
184+
String filePath = "test/testFile.txt.crc";
185+
FileUtils.writeContent2File(content, filePath);
187186

188187
Property property = new Property();
189188
property.setProp("f1");
@@ -197,4 +196,9 @@ void testReplaceWithCheckSum() {
197196
String crc = TaskCacheUtils.getValCheckSum(property, taskExecutionContext, storageOperate);
198197
Assertions.assertEquals(crc, content);
199198
}
199+
200+
@AfterEach
201+
public void tearDown() {
202+
FileUtils.deleteFile("test");
203+
}
200204
}

0 commit comments

Comments
 (0)