Skip to content

Commit

Permalink
file: attempt atomic move to fix flakiness #3584
Browse files Browse the repository at this point in the history
  • Loading branch information
aldettinger authored and jamesnetherton committed Jun 20, 2022
1 parent 2433c34 commit 9e1a25c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -131,7 +132,7 @@ public void idempotent() throws IOException {
// move file back
Path donePath = Paths.get(fileName01.replaceFirst("target/idempotent", "target/idempotent/done"));
Path targetPath = Paths.get(fileName01);
Files.move(donePath, targetPath);
Files.move(donePath, targetPath, StandardCopyOption.ATOMIC_MOVE);
// register file for deletion after tests
pathsToDelete.add(targetPath);

Expand Down

0 comments on commit 9e1a25c

Please sign in to comment.