You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by we...@apache.org on 2023/10/13 08:44:03 UTC

[dolphinscheduler] branch dev updated: Delete File generated by UT (#15022)

This is an automated email from the ASF dual-hosted git repository.

wenjun pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 312c339722 Delete File generated by UT (#15022)
312c339722 is described below

commit 312c3397222a3a31590ef1983a85855a26104bf9
Author: Wenjun Ruan <we...@apache.org>
AuthorDate: Fri Oct 13 16:43:54 2023 +0800

    Delete File generated by UT (#15022)
---
 .../apache/dolphinscheduler/common/utils/FileUtilsTest.java  |  6 ++++++
 .../dolphinscheduler/dao/utils/TaskCacheUtilsTest.java       | 12 ++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/FileUtilsTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/FileUtilsTest.java
index b47ae692f6..faa99e2a32 100644
--- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/FileUtilsTest.java
+++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/FileUtilsTest.java
@@ -22,6 +22,7 @@ import static org.apache.dolphinscheduler.common.constants.DateConstants.YYYYMMD
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 
+import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
@@ -128,4 +129,9 @@ public class FileUtilsTest {
                 () -> FileUtils.getFileChecksum(dirPath));
     }
 
+    @AfterEach
+    public void tearDown() {
+        FileUtils.deleteFile("test");
+    }
+
 }
diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/utils/TaskCacheUtilsTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/utils/TaskCacheUtilsTest.java
index 1b6329b3a6..49d5a87bb6 100644
--- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/utils/TaskCacheUtilsTest.java
+++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/utils/TaskCacheUtilsTest.java
@@ -17,8 +17,6 @@
 
 package org.apache.dolphinscheduler.dao.utils;
 
-import static org.apache.dolphinscheduler.common.constants.Constants.CRC_SUFFIX;
-
 import org.apache.dolphinscheduler.common.enums.Flag;
 import org.apache.dolphinscheduler.common.utils.FileUtils;
 import org.apache.dolphinscheduler.dao.entity.TaskInstance;
@@ -36,6 +34,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -182,8 +181,8 @@ class TaskCacheUtilsTest {
     @Test
     void testReplaceWithCheckSum() {
         String content = "abcdefg";
-        String filePath = "test/testFile.txt";
-        FileUtils.writeContent2File(content, filePath + CRC_SUFFIX);
+        String filePath = "test/testFile.txt.crc";
+        FileUtils.writeContent2File(content, filePath);
 
         Property property = new Property();
         property.setProp("f1");
@@ -197,4 +196,9 @@ class TaskCacheUtilsTest {
         String crc = TaskCacheUtils.getValCheckSum(property, taskExecutionContext, storageOperate);
         Assertions.assertEquals(crc, content);
     }
+
+    @AfterEach
+    public void tearDown() {
+        FileUtils.deleteFile("test");
+    }
 }