summaryrefslogtreecommitdiffstats
path: root/docker-api
diff options
context:
space:
mode:
authorfreva <valerijf@yahoo-inc.com>2017-02-09 09:27:20 +0100
committerfreva <valerijf@yahoo-inc.com>2017-02-09 09:27:20 +0100
commit2f1e45519a55ded1e27a7d254bc197417b74323d (patch)
treeda53367f282f8e0c6e2c0a32f564c4a756355a56 /docker-api
parentd497ddedf86f9d3e5c2a32573b13dc8e2fa37bce (diff)
Run tests as root
Diffstat (limited to 'docker-api')
-rw-r--r--docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/RunSystemTests.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/RunSystemTests.java b/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/RunSystemTests.java
index a5991ee159a..bb973d9fe9a 100644
--- a/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/RunSystemTests.java
+++ b/docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/RunSystemTests.java
@@ -12,7 +12,6 @@ import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@@ -115,7 +114,7 @@ public class RunSystemTests {
docker.executeInContainerAsRoot(containerName, "/bin/sh", "-c", "rsync --archive --existing --update " +
sources + " " + pathToLibJars.toString() + "/");
- executeInContainer(containerName, "/bin/sh", "-c", "cd " + pathToVespaRepoInContainer + ";" +
+ executeInContainer(containerName, username, "/bin/sh", "-c", "cd " + pathToVespaRepoInContainer + ";" +
"mvn jar:jar install:install");
}
@@ -125,7 +124,6 @@ public class RunSystemTests {
* @param modules list of modules to install in order
*/
void mavenInstallModules(String... modules) throws InterruptedException, IOException, ExecutionException {
- System.out.println("Installing " + Arrays.toString(modules));
String projects = String.join(",", modules);
Process process = new ProcessBuilder("mvn", "-DskipTests", "-Dmaven.javadoc.skip=true", "--errors",
"--projects=" + projects, "--also-make", "install")
@@ -133,9 +131,7 @@ public class RunSystemTests {
.inheritIO()
.start();
- int exitValue = process.waitFor();
- assert exitValue == 0;
- System.out.println(process.exitValue());
+ assertEquals("Failed to build modules", 0, process.waitFor());
}
private void startSystemTestNodeIfNeeded(ContainerName containerName) throws IOException, InterruptedException, ExecutionException {
@@ -194,13 +190,13 @@ public class RunSystemTests {
docker.buildImage(systestDockerfile.toFile(), SYSTEMTESTS_DOCKER_IMAGE);
}
- private Integer executeInContainer(ContainerName containerName, String... args) throws InterruptedException {
+ private Integer executeInContainer(ContainerName containerName, String runAsUser, String... args) throws InterruptedException {
logger.info("Executing in container: " + String.join(" ", args));
ExecCreateCmdResponse response = docker.dockerClient.execCreateCmd(containerName.asString())
.withCmd(args)
.withAttachStdout(true)
.withAttachStderr(true)
- .withUser(username)
+ .withUser(runAsUser)
.exec();
ExecStartCmd execStartCmd = docker.dockerClient.execStartCmd(response.getId());
@@ -216,6 +212,6 @@ public class RunSystemTests {
combinedArgs[1] = testToRun.toString();
System.arraycopy(args, 0, combinedArgs, 2, args.length);
- return executeInContainer(containerName, combinedArgs);
+ return executeInContainer(containerName, "root", combinedArgs);
}
}