Skip to content

Commit 36b36c1

Browse files
committed
fix test
1 parent 940bdfe commit 36b36c1

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionReconstructForIoTV1IT.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.apache.iotdb.rpc.StatementExecutionException;
3232
import org.apache.iotdb.session.Session;
3333

34-
import org.apache.commons.io.FileUtils;
3534
import org.apache.tsfile.read.common.RowRecord;
3635
import org.awaitility.Awaitility;
3736
import org.junit.Assert;
@@ -57,6 +56,22 @@ public class IoTDBRegionReconstructForIoTV1IT extends IoTDBRegionOperationReliab
5756
private static final String RECONSTRUCT_FORMAT = "reconstruct region %d on %d";
5857
private static Logger LOGGER = LoggerFactory.getLogger(IoTDBRegionReconstructForIoTV1IT.class);
5958

59+
private boolean deleteTsFiles(File file) {
60+
if (file.isDirectory()) {
61+
File[] files = file.listFiles();
62+
if (files != null) {
63+
for (File f : files) {
64+
if (!deleteTsFiles(f)) {
65+
return false;
66+
}
67+
}
68+
}
69+
} else if (file.getName().endsWith(".tsfile")) {
70+
return file.delete();
71+
}
72+
return true;
73+
}
74+
6075
@Test
6176
public void normal1C3DTest() throws Exception {
6277
EnvFactory.getEnv()
@@ -110,7 +125,11 @@ public void normal1C3DTest() throws Exception {
110125
.get()
111126
.getDataPath());
112127

113-
FileUtils.deleteQuietly(dataDirToBeReconstructed);
128+
if (!deleteTsFiles(dataDirToBeReconstructed)) {
129+
statement.execute(FLUSH_COMMAND);
130+
deleteTsFiles(dataDirToBeReconstructed);
131+
}
132+
114133
EnvFactory.getEnv().dataNodeIdToWrapper(dataNodeToBeClosed).get().stopForcibly();
115134

116135
// now, the query should throw exception

0 commit comments

Comments
 (0)