Skip to content

Commit

Permalink
Make Docker test robust when removing a temp dir (#61639)
Browse files Browse the repository at this point in the history
Closes #61614. Closes #61553.

In a particular Docker test, ensure is shut down before removing the
data directory. Also add the force flag to `rm`.
  • Loading branch information
pugnascotia committed Sep 1, 2020
1 parent d94d6b5 commit 50119bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ public void test071BindMountCustomPathWithDifferentUID() throws Exception {
assertThat(nodes.at("/_nodes/successful").intValue(), equalTo(1));
assertThat(nodes.at("/_nodes/failed").intValue(), equalTo(0));

// Ensure container is stopped before we remove tempEsDataDir, so nothing
// is using the directory.
removeContainer();

rmDirWithPrivilegeEscalation(tempEsDataDir);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public static void rmDirWithPrivilegeEscalation(Path localPath) {

args.add("cd " + containerBasePath.toAbsolutePath());
args.add("&&");
args.add("rm -r " + localPath.getFileName());
args.add("rm -rf " + localPath.getFileName());
final String command = String.join(" ", args);
executePrivilegeEscalatedShellCmd(command, localPath, containerPath);
}
Expand Down

0 comments on commit 50119bb

Please sign in to comment.