@Test
  public void testCompact() throws Exception {
    TsFileResource targetTsFileResource =
        new TsFileResource(
            new File(
                TestConstant.getTestTsFileDir("root.compactionTest", 0, 0)
                    .concat(
                        0
                            + IoTDBConstant.FILE_NAME_SEPARATOR
                            + 0
                            + IoTDBConstant.FILE_NAME_SEPARATOR
                            + 1
                            + IoTDBConstant.FILE_NAME_SEPARATOR
                            + 0
                            + IoTDBConstant.INNER_COMPACTION_TMP_FILE_SUFFIX)));
    File targetFile =
        new File(
            TestConstant.getTestTsFileDir("root.compactionTest", 0, 0)
                .concat(
                    0
                        + IoTDBConstant.FILE_NAME_SEPARATOR
                        + 0
                        + IoTDBConstant.FILE_NAME_SEPARATOR
                        + 1
                        + IoTDBConstant.FILE_NAME_SEPARATOR
                        + 0
                        + ".tsfile"));
    if (targetFile.exists()) {
      assertTrue(targetFile.delete());
    }
    CompactionLogger sizeTieredCompactionLogger =
        new CompactionLogger(
            new File(targetTsFileResource.getTsFilePath().concat(".compaction.log")));
    sizeTieredCompactionLogger.logFiles(seqResources, CompactionLogger.STR_SOURCE_FILES);
    ICompactionPerformer performer =
        new ReadChunkCompactionPerformer(seqResources, targetTsFileResource);
    performer.setSummary(new CompactionTaskSummary());
    performer.perform();
    CompactionUtils.moveTargetFile(
        Collections.singletonList(targetTsFileResource),
        CompactionTaskType.INNER_SEQ,
        COMPACTION_TEST_SG);
    sizeTieredCompactionLogger.close();
    Path path = new Path(deviceIds[0], measurementSchemas[0].getMeasurementName(), true);
    try (TsFileSequenceReader reader =
            new TsFileSequenceReader(targetTsFileResource.getTsFilePath());
        TsFileReader readTsFile = new TsFileReader(reader)) {
      QueryExpression queryExpression =
          QueryExpression.create(Collections.singletonList(path), null);
      QueryDataSet queryDataSet = readTsFile.query(queryExpression);
      int cut = 0;
      RowRecord record;
      while (queryDataSet.hasNext()) {
        record = queryDataSet.next();
        assertEquals(record.getTimestamp(), record.getFields().get(0).getDoubleV(), 0.001);
        cut++;
      }
      assertEquals(600, cut);
    }
  }
This test is used for old version of inner space compact. We leave it as it still validates the
current compaction. However, due to this test's strong coupling with an older version of
compaction, we may remove it in the future.
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/inner/ReadChunkCompactionPerformerOldTest.java