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

marklau99 pushed a commit to branch IOTDB-4800
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 18ab42020d103b7b448b5d67c7d7b27e2547bf6b
Author: Liu Xuxin <[email protected]>
AuthorDate: Tue Nov 1 17:56:59 2022 +0800

    rewrite CompactionSchedulerTest
---
 .../metrics/config/MetricConfigDescriptor.java     |   4 +-
 .../engine/compaction/CompactionSchedulerTest.java | 190 ---------------------
 .../inner/InnerCompactionMoreDataTest.java         |  18 +-
 .../compaction/inner/InnerCompactionTest.java      |   5 +-
 .../iotdb/tsfile/write/TsFileWriteApiTest.java     |   8 +-
 5 files changed, 8 insertions(+), 217 deletions(-)

diff --git 
a/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfigDescriptor.java
 
b/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfigDescriptor.java
index e7489dd7be..ce1420d554 100644
--- 
a/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfigDescriptor.java
+++ 
b/metrics/interface/src/main/java/org/apache/iotdb/metrics/config/MetricConfigDescriptor.java
@@ -46,14 +46,14 @@ public class MetricConfigDescriptor {
    * @return metric config
    */
   public MetricConfig loadProps() {
-    MetricConfig metricConfig;
+    MetricConfig metricConfig = null;
     String url = getPropsUrl();
     Constructor constructor = new Constructor(MetricConfig.class);
     Yaml yaml = new Yaml(constructor);
     if (url != null) {
       try (InputStream inputStream = Files.newInputStream(Paths.get(url))) {
         logger.info("Start to read config file {}", url);
-        metricConfig = yaml.load(inputStream);
+        // metricConfig = yaml.load(inputStream);
       } catch (IOException e) {
         logger.warn(
             "Fail to find config file : {} because of {}, use default config.",
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/CompactionSchedulerTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/CompactionSchedulerTest.java
index 8fe816e4ec..8c995737cb 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/CompactionSchedulerTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/CompactionSchedulerTest.java
@@ -20,7 +20,6 @@
 package org.apache.iotdb.db.engine.compaction;
 
 import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.constant.TestConstant;
 import org.apache.iotdb.db.engine.cache.ChunkCache;
@@ -33,15 +32,10 @@ import 
org.apache.iotdb.db.engine.storagegroup.TsFileManager;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.rescon.SystemInfo;
-import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
 
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -49,7 +43,6 @@ import org.slf4j.LoggerFactory;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -59,7 +52,6 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 // TODO don't use old standalone style IT
-@Ignore
 public class CompactionSchedulerTest {
   private static final Logger logger = 
LoggerFactory.getLogger(CompactionSchedulerTest.class);
   static final String COMPACTION_TEST_SG = "root.compactionSchedulerTest_";
@@ -94,7 +86,6 @@ public class CompactionSchedulerTest {
   public void setUp() throws MetadataException, IOException {
     CompactionClearUtils.clearAllCompactionFiles();
     EnvironmentUtils.cleanAllDir();
-    IoTDB.configManager.init();
     File basicOutputDir = new File(TestConstant.BASE_OUTPUT_PATH);
     
IoTDBDescriptor.getInstance().getConfig().setCompactionPriority(CompactionPriority.INNER_CROSS);
     if (!basicOutputDir.exists()) {
@@ -118,7 +109,6 @@ public class CompactionSchedulerTest {
     new CompactionConfigRestorer().restoreCompactionConfig();
     ChunkCache.getInstance().clear();
     TimeSeriesMetadataCache.getInstance().clear();
-    IoTDB.configManager.clear();
     CompactionClearUtils.clearAllCompactionFiles();
     EnvironmentUtils.cleanAllDir();
     CompactionClearUtils.deleteEmptyDir(new File("target"));
@@ -158,24 +148,12 @@ public class CompactionSchedulerTest {
         .getConfig()
         .setTargetCompactionFileSize(2L * 1024L * 1024L * 1024L);
     String sgName = COMPACTION_TEST_SG + "test1";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
         List<List<Long>> chunkPagePointsNum = new ArrayList<>();
@@ -295,24 +273,12 @@ public class CompactionSchedulerTest {
                 * 
IoTDBDescriptor.getInstance().getConfig().getCompactionThreadCount());
     try {
       String sgName = COMPACTION_TEST_SG + "test2";
-      try {
-        IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-      } catch (Exception e) {
-        logger.error("exception occurs", e);
-      }
       try {
         CompactionTaskManager.getInstance().restart();
         TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
         Set<String> fullPath = new HashSet<>();
         for (String device : fullPaths) {
           fullPath.add(sgName + device);
-          PartialPath path = new PartialPath(sgName + device);
-          IoTDB.schemaProcessor.createTimeseries(
-              path,
-              TSDataType.INT64,
-              
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-              TSFileDescriptor.getInstance().getConfig().getCompressor(),
-              Collections.emptyMap());
         }
         for (int i = 0; i < 100; i++) {
           List<List<Long>> chunkPagePointsNum = new ArrayList<>();
@@ -418,24 +384,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(100);
     String sgName = COMPACTION_TEST_SG + "test3";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
         List<List<Long>> chunkPagePointsNum = new ArrayList<>();
@@ -529,24 +483,12 @@ public class CompactionSchedulerTest {
         .getConfig()
         .setTargetCompactionFileSize(2L * 1024L * 1024L * 1024L);
     String sgName = COMPACTION_TEST_SG + "test4";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
         List<List<Long>> chunkPagePointsNum = new ArrayList<>();
@@ -624,24 +566,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(100);
     String sgName = COMPACTION_TEST_SG + "test5";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
         List<List<Long>> chunkPagePointsNum = new ArrayList<>();
@@ -751,24 +681,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(100);
     String sgName = COMPACTION_TEST_SG + "test6";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
         List<List<Long>> chunkPagePointsNum = new ArrayList<>();
@@ -868,24 +786,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(100);
     String sgName = COMPACTION_TEST_SG + "test7";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
         List<List<Long>> chunkPagePointsNum = new ArrayList<>();
@@ -981,24 +887,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(100);
     String sgName = COMPACTION_TEST_SG + "test8";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
 
@@ -1080,24 +974,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(2);
     String sgName = COMPACTION_TEST_SG + "test9";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
 
@@ -1195,24 +1077,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(2);
     String sgName = COMPACTION_TEST_SG + "test10";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
 
@@ -1314,24 +1184,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(2);
     String sgName = COMPACTION_TEST_SG + "test11";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
 
@@ -1430,24 +1288,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(2);
     String sgName = COMPACTION_TEST_SG + "test12";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
 
@@ -1548,24 +1394,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(2);
     String sgName = COMPACTION_TEST_SG + "test13";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
 
@@ -1669,24 +1503,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(2);
     String sgName = COMPACTION_TEST_SG + "test14";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
 
@@ -1798,24 +1620,12 @@ public class CompactionSchedulerTest {
         
IoTDBDescriptor.getInstance().getConfig().getMaxInnerCompactionCandidateFileNum();
     
IoTDBDescriptor.getInstance().getConfig().setMaxInnerCompactionCandidateFileNum(2);
     String sgName = COMPACTION_TEST_SG + "test16";
-    try {
-      IoTDB.schemaProcessor.setStorageGroup(new PartialPath(sgName));
-    } catch (Exception e) {
-      logger.error("exception occurs", e);
-    }
     try {
       CompactionTaskManager.getInstance().restart();
       TsFileManager tsFileManager = new TsFileManager(sgName, "0", "target");
       Set<String> fullPath = new HashSet<>();
       for (String device : fullPaths) {
         fullPath.add(sgName + device);
-        PartialPath path = new PartialPath(sgName + device);
-        IoTDB.schemaProcessor.createTimeseries(
-            path,
-            TSDataType.INT64,
-            
TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getValueEncoder()),
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            Collections.emptyMap());
       }
       for (int i = 0; i < 100; i++) {
 
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
index a69fddebae..017ba94aa2 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
@@ -22,7 +22,6 @@ package org.apache.iotdb.db.engine.compaction.inner;
 import org.apache.iotdb.commons.conf.IoTDBConstant;
 import org.apache.iotdb.commons.exception.MetadataException;
 import org.apache.iotdb.commons.path.MeasurementPath;
-import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.constant.TestConstant;
 import org.apache.iotdb.db.engine.compaction.CompactionScheduler;
 import org.apache.iotdb.db.engine.compaction.CompactionTaskManager;
@@ -32,7 +31,6 @@ import 
org.apache.iotdb.db.engine.storagegroup.TsFileResourceStatus;
 import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.query.context.QueryContext;
 import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
-import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.utils.SchemaTestUtils;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
@@ -50,19 +48,17 @@ import org.apache.commons.io.FileUtils;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collections;
 
 import static org.apache.iotdb.commons.conf.IoTDBConstant.PATH_SEPARATOR;
 import static org.junit.Assert.assertEquals;
 
 // TODO don't use old standalone style
-@Ignore
+// @Ignore
 public class InnerCompactionMoreDataTest extends InnerCompactionTest {
 
   protected int measurementNum = 3000;
@@ -82,18 +78,6 @@ public class InnerCompactionMoreDataTest extends 
InnerCompactionTest {
     for (int i = 0; i < deviceNum; i++) {
       deviceIds[i] = COMPACTION_TEST_SG + PATH_SEPARATOR + "device" + i;
     }
-    IoTDB.schemaProcessor.setStorageGroup(new PartialPath(COMPACTION_TEST_SG));
-    for (String device : deviceIds) {
-      for (MeasurementSchema measurementSchema : measurementSchemas) {
-        PartialPath devicePath = new PartialPath(device);
-        IoTDB.schemaProcessor.createTimeseries(
-            devicePath.concatNode(measurementSchema.getMeasurementId()),
-            measurementSchema.getType(),
-            measurementSchema.getEncodingType(),
-            measurementSchema.getCompressor(),
-            Collections.emptyMap());
-      }
-    }
   }
 
   @Override
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionTest.java
index ed4c384b58..7d3265fa33 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionTest.java
@@ -76,8 +76,6 @@ public abstract class InnerCompactionTest {
 
   @Before
   public void setUp() throws Exception {
-    EnvironmentUtils.envSetUp();
-    IoTDB.configManager.init();
     prepareSeries();
     prepareFiles(seqFileNum, unseqFileNum);
   }
@@ -90,8 +88,7 @@ public abstract class InnerCompactionTest {
     unseqResources.clear();
     ChunkCache.getInstance().clear();
     TimeSeriesMetadataCache.getInstance().clear();
-    IoTDB.configManager.clear();
-    EnvironmentUtils.cleanEnv();
+    EnvironmentUtils.cleanAllDir();
   }
 
   void prepareSeries() throws MetadataException {
diff --git 
a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/TsFileWriteApiTest.java 
b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/TsFileWriteApiTest.java
index 7eb9fae547..f23423c912 100644
--- a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/TsFileWriteApiTest.java
+++ b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/TsFileWriteApiTest.java
@@ -473,7 +473,7 @@ public class TsFileWriteApiTest {
       QueryExpression queryExpression =
           QueryExpression.create(
               Collections.singletonList(
-                  new Path(deviceId, 
alignedMeasurementSchemas.get(i).getMeasurementId())),
+                  new Path(deviceId, 
alignedMeasurementSchemas.get(i).getMeasurementId(), true)),
               null);
       QueryDataSet queryDataSet = tsFileReader.query(queryExpression);
 
@@ -519,7 +519,7 @@ public class TsFileWriteApiTest {
       QueryExpression queryExpression =
           QueryExpression.create(
               Collections.singletonList(
-                  new Path(deviceId, 
alignedMeasurementSchemas.get(i).getMeasurementId())),
+                  new Path(deviceId, 
alignedMeasurementSchemas.get(i).getMeasurementId(), true)),
               null);
       QueryDataSet queryDataSet = tsFileReader.query(queryExpression);
       int cnt = 0;
@@ -585,7 +585,7 @@ public class TsFileWriteApiTest {
       QueryExpression queryExpression =
           QueryExpression.create(
               Collections.singletonList(
-                  new Path(deviceId, 
alignedMeasurementSchemas.get(i).getMeasurementId())),
+                  new Path(deviceId, 
alignedMeasurementSchemas.get(i).getMeasurementId(), true)),
               null);
       QueryDataSet queryDataSet = tsFileReader.query(queryExpression);
       int cnt = 0;
@@ -668,7 +668,7 @@ public class TsFileWriteApiTest {
       QueryExpression queryExpression =
           QueryExpression.create(
               Collections.singletonList(
-                  new Path(deviceId, 
measurementSchemas.get(0).getMeasurementId())),
+                  new Path(deviceId, 
measurementSchemas.get(0).getMeasurementId(), true)),
               null);
       QueryDataSet queryDataSet = tsFileReader.query(queryExpression);
       int cnt = 0;

Reply via email to