summaryrefslogtreecommitdiffstats
path: root/docker-api
diff options
context:
space:
mode:
authorHarald Musum <musum@yahoo-inc.com>2017-05-10 13:09:34 +0200
committerGitHub <noreply@github.com>2017-05-10 13:09:34 +0200
commitfc6a5364352050df8c0073cc69a32c4b2bf9a145 (patch)
tree66cc8a84b74633964ae4408a35ed92ade8cb4b13 /docker-api
parent261e0da900e697b9088b6d398ec4ff8af2cc55d1 (diff)
parentd11f293de2c09be65b0cafea08499f39c0a2372a (diff)
Merge pull request #2437 from yahoo/freva/fix-local-systemtests
Fix local systemtests
Diffstat (limited to 'docker-api')
-rw-r--r--docker-api/src/test/java/com/yahoo/vespa/hosted/dockerapi/RunSystemTests.java82
-rw-r--r--docker-api/src/test/resources/systest/Dockerfile.template2
2 files changed, 1 insertions, 83 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 9694cf83a5e..0b52d54c0dd 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
@@ -5,7 +5,6 @@ import com.github.dockerjava.api.command.ExecCreateCmdResponse;
import com.github.dockerjava.api.command.ExecStartCmd;
import com.github.dockerjava.api.command.InspectExecResponse;
import com.github.dockerjava.core.command.ExecStartResultCallback;
-import com.yahoo.collections.Pair;
import com.yahoo.system.ProcessExecuter;
import java.io.IOException;
@@ -13,18 +12,11 @@ import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import static org.junit.Assert.assertEquals;
@@ -43,9 +35,6 @@ import static org.junit.Assert.assertEquals;
RunSystemTests runSystemTests = new RunSystemTests(vespaDockerBase, pathToSystemtestsInHost);
ContainerName systemtestsHost = new ContainerName("stest-1");
- // Run maven install on newly updated modules (and the modules that depend on them), this
- // is optional and can be run from command line if you know specifically which modules need to be rebuilt
- runSystemTests.mavenInstallModules("docproc");
// Update maven local repository and /home/y/lib/jars with the current version of these modules inside container
runSystemTests.updateContainerMavenLocalRepository(systemtestsHost);
@@ -123,75 +112,6 @@ public class RunSystemTests {
"mvn jar:jar install:install");
}
- /**
- * This method runs mvn install on host inside container to update container's local repository
- *
- * @param modules list of modules to install in order
- */
- void mavenInstallModules(String... modules) throws InterruptedException, IOException, ExecutionException {
- logger.info("mvn install " + String.join(" ", modules));
- String projects = String.join(",", modules);
- Process process = new ProcessBuilder("mvn", "install", "-DskipTests", "-Dmaven.javadoc.skip=true",
- "--errors", "--projects=" + projects)
- .directory(pathToVespaRepoInHost.toFile())
- .inheritIO()
- .start();
-
- if (process.waitFor() != 0) {
- throw new RuntimeException("Failed to build modules");
- }
- }
-
- // TODO: Add support for multiple modules
- void mavenInstallModulesThatDependOn(String module) throws IOException, ExecutionException, InterruptedException {
- logger.info("Building dependency graph...");
- Path outputFile = Paths.get("/tmp/vespa-maven-dependencies");
- if (Files.exists(outputFile)) {
- Files.delete(outputFile);
- }
-
- String[] command = new String[]{"mvn", "dependency:tree", "--quiet", "-Dincludes=com.yahoo.vespa",
- "-DoutputFile=" + outputFile, "-DoutputType=dot", "-DappendOutput=true"};
- ProcessExecuter processExecuter = new ProcessExecuter();
- Pair<Integer, String> result = processExecuter.exec(command);
- if (result.getFirst() != 0) {
- throw new RuntimeException("Failed to get maven dependency tree: " + result.getSecond());
- }
-
- String modulePattern = "[a-z-]+";
- Pattern dependencyPattern = Pattern.compile("com\\.yahoo\\.vespa:(" + modulePattern + "):.* -> " +
- ".*com\\.yahoo\\.vespa:(" + modulePattern + "):.*", Pattern.CASE_INSENSITIVE);
- String dependenciesRaw = new String(Files.readAllBytes(outputFile));
- Matcher m = dependencyPattern.matcher(dependenciesRaw);
-
- Map<String, Set<String>> dependencyGraph = new HashMap<>();
- while (m.find()) {
- if (! dependencyGraph.containsKey(m.group(2))) {
- dependencyGraph.put(m.group(2), new HashSet<>());
- }
-
- dependencyGraph.get(m.group(2)).add(m.group(1));
- }
-
- List<String> buildOrder = new ArrayList<>();
- dfs(module, dependencyGraph, buildOrder);
-
- Collections.reverse(buildOrder);
- mavenInstallModules(buildOrder.stream().toArray(String[]::new));
- }
-
- private static void dfs(String root, Map<String, Set<String>> dependencies, List<String> order) {
- if (! order.contains(root)) {
- if (dependencies.containsKey(root)) {
- for (String child : dependencies.get(root)) {
- dfs(child, dependencies, order);
- }
- }
-
- order.add(root);
- }
- }
-
private void startSystemTestNodeIfNeeded(ContainerName containerName) throws IOException, InterruptedException, ExecutionException {
buildVespaSystestDockerImage(docker, vespaBaseImage);
@@ -221,8 +141,6 @@ public class RunSystemTests {
.create();
docker.startContainer(containerName);
- docker.dockerClient.copyArchiveToContainerCmd(containerName.asString())
- .withHostResource("/etc/hosts").withRemotePath("/etc/").exec();
String uid = new ProcessExecuter().exec(new String[]{"/bin/sh", "-c", "id -u " + username}).getSecond();
docker.executeInContainerAsRoot(containerName, "useradd", "-u", uid.trim(), username);
diff --git a/docker-api/src/test/resources/systest/Dockerfile.template b/docker-api/src/test/resources/systest/Dockerfile.template
index 2f388cf864a..4c58fefbc72 100644
--- a/docker-api/src/test/resources/systest/Dockerfile.template
+++ b/docker-api/src/test/resources/systest/Dockerfile.template
@@ -3,7 +3,7 @@ FROM $VESPA_BASE_IMAGE
# Don't autostart anything when building image
RUN yinst set root.autostart=off
-RUN yinst install -branch test vespa_systemtest_base vespa_systemtest_gems
+RUN yinst install -branch test yruby-2.3.1_1 vespa_test-$(yinst ls vespa | grep -Eo "[0-9]\.[0-9]+\.[0-9]+") vespa_systemtest_deps
# Start node_server through bash to avoid zombie processes, see
# https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/