Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.1.x] ISPN-11819 Prevent ContainerInfinispanServerDriver erroneous state with provided server directory #8311

Merged
merged 1 commit into from
May 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.infinispan.commons.test.Exceptions;
import org.infinispan.commons.test.ThreadLeakChecker;
import org.infinispan.commons.util.StringPropertyReplacer;
import org.infinispan.commons.util.Util;
import org.infinispan.commons.util.Version;
import org.infinispan.server.Server;
import org.infinispan.util.logging.LogFactory;
Expand Down Expand Up @@ -138,7 +139,7 @@ protected void start(String name, File rootDir, String configurationFile) {
image
.withFileFromPath("target", serverOutputPath.getParent())
.withFileFromPath("src", serverOutputPath.getParent().getParent().resolve("src"))
.withFileFromPath("build", serverOutputPath);
.withFileFromPath("build", cleanServerDirectory(serverOutputPath));
prebuiltImage = false;
log.infof("Using local image from server built at '%s'", serverOutputPath);
}
Expand Down Expand Up @@ -215,6 +216,16 @@ protected void start(String name, File rootDir, String configurationFile) {
}
}

/*
* Removing the `server/data` and `server/log` directories from the local server directory to prevent issues with
* the tests
*/
private Path cleanServerDirectory(Path serverOutputPath) {
Util.recursiveFileRemove(serverOutputPath.resolve("server").resolve("data").toString());
Util.recursiveFileRemove(serverOutputPath.resolve("server").resolve("log").toString());
return serverOutputPath;
}

private GenericContainer createContainer(int i) {

if (this.volumes[i] == null) {
Expand Down