Skip to content

Commit 69a562b

Browse files
author
litiliu
committed
fix e2e
1 parent 63fb2de commit 69a562b

File tree

1 file changed

+28
-4
lines changed
  • seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e/src/test/java/org/apache/seatunnel/e2e/connector/iceberg

1 file changed

+28
-4
lines changed

Diff for: seatunnel-e2e/seatunnel-connector-v2-e2e/connector-iceberg-e2e/src/test/java/org/apache/seatunnel/e2e/connector/iceberg/IcebergSourceIT.java

+28-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@
5757

5858
import lombok.extern.slf4j.Slf4j;
5959

60-
import java.io.File;
6160
import java.io.IOException;
6261
import java.math.BigDecimal;
6362
import java.nio.ByteBuffer;
63+
import java.nio.file.FileVisitResult;
64+
import java.nio.file.Path;
65+
import java.nio.file.Paths;
66+
import java.nio.file.SimpleFileVisitor;
67+
import java.nio.file.attribute.BasicFileAttributes;
6468
import java.time.LocalDate;
6569
import java.time.LocalDateTime;
6670
import java.time.LocalTime;
@@ -135,9 +139,29 @@ public void tearDown() throws Exception {}
135139
@AfterEach
136140
public void clean() {
137141
// clean the catalog dir
138-
File catalogDir = new File(CATALOG_DIR);
139-
if (catalogDir.exists()) {
140-
catalogDir.delete();
142+
Path catalogPath = Paths.get(CATALOG_DIR);
143+
if (java.nio.file.Files.exists(catalogPath)) {
144+
try {
145+
java.nio.file.Files.walkFileTree(
146+
catalogPath,
147+
new SimpleFileVisitor<Path>() {
148+
@Override
149+
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
150+
throws IOException {
151+
java.nio.file.Files.delete(file);
152+
return FileVisitResult.CONTINUE;
153+
}
154+
155+
@Override
156+
public FileVisitResult postVisitDirectory(Path dir, IOException exc)
157+
throws IOException {
158+
java.nio.file.Files.delete(dir);
159+
return FileVisitResult.CONTINUE;
160+
}
161+
});
162+
} catch (IOException e) {
163+
throw new RuntimeException(e);
164+
}
141165
}
142166
}
143167

0 commit comments

Comments
 (0)