Commit 38ddc5d0 authored by Joerg Domaschka's avatar Joerg Domaschka

small tests and two naming bugs fixed

parent efbf3a56
......@@ -114,7 +114,7 @@ final class DockerImageHandler {
// second step: try to find matching image for prepared component
// in case a custom docker registry is configured
result = getImageFromPrivateRepository();
if(result != null) {
if(result == null) {
// third step: fall back to the operating system //
result = getImageFromDefaultLocation();
}
......
......@@ -99,7 +99,9 @@ final class ProcessBasedConnector implements DockerConnector {
@Override
public String findImage(String target) throws DockerException {
String[] split = target.split(":");
ExecResult result = ProcessWrapper.singleDockerCommand("images", "--no-trunc=true", split[0]);
String imageName = split.length == 2 ? split[0] : (split[0] + split[1]);
String tagName = split.length == 2 ? split[1] : split[2];
ExecResult result = ProcessWrapper.singleDockerCommand("images", "--no-trunc=true", imageName);
if(!result.isSuccess()) {
return null;
}
......@@ -112,7 +114,7 @@ final class ProcessBasedConnector implements DockerConnector {
line = reader.readLine();
if(line == null)
break;
String id = findTag(split[1], line);
String id = findTag(tagName, line);
if(id != null)
return id;
}
......
......@@ -2,7 +2,6 @@ package de.uniulm.omi.cloudiator.lance.lca.containers.docker;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
......@@ -10,23 +9,16 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import de.uniulm.omi.cloudiator.lance.application.DeploymentContext;
import de.uniulm.omi.cloudiator.lance.application.component.DeployableComponent;
import de.uniulm.omi.cloudiator.lance.container.spec.os.OperatingSystem;
import de.uniulm.omi.cloudiator.lance.lca.HostContext;
import de.uniulm.omi.cloudiator.lance.lca.container.ComponentInstanceId;
import de.uniulm.omi.cloudiator.lance.lca.container.ContainerException;
import de.uniulm.omi.cloudiator.lance.lca.container.port.NetworkHandler;
import de.uniulm.omi.cloudiator.lance.lca.containers.docker.connector.ConnectorFactory;
import de.uniulm.omi.cloudiator.lance.lca.containers.docker.connector.DockerConnector;
import de.uniulm.omi.cloudiator.lance.lca.containers.dummy.DummyInterceptor;
import de.uniulm.omi.cloudiator.lance.lca.registry.RegistrationException;
import de.uniulm.omi.cloudiator.lance.lifecycle.ExecutionContext;
import de.uniulm.omi.cloudiator.lance.lifecycle.HandlerType;
import de.uniulm.omi.cloudiator.lance.lifecycle.LifecycleController;
import de.uniulm.omi.cloudiator.lance.lifecycle.LifecycleException;
import de.uniulm.omi.cloudiator.lance.lifecycle.LifecycleHandlerType;
import de.uniulm.omi.cloudiator.lance.lifecycle.detector.DetectorType;
import de.uniulm.omi.cloudiator.lance.lifecycles.CoreElements;
import de.uniulm.omi.cloudiator.lance.lifecycles.LifecycleStoreCreator;
......@@ -102,5 +94,26 @@ public class DockerSnapshottingTest {
client, core.comp, core.ctx, OperatingSystem.UBUNTU_14_04,
core.networkHandler, shellFactory, dockerConfig);
logic.doCreate();
logic.doDestroy(true);
}
@Test
public void testSnapshot() throws ContainerException {
DockerConfiguration dockerConfig = DockerConfiguration.INSTANCE;
DockerConnector client = ConnectorFactory.INSTANCE.createConnector(hostname);
DockerShellFactory shellFactory = new DockerShellFactory();
DockerContainerLogic logic = new DockerContainerLogic(core.componentInstanceId,
client, core.comp, core.ctx, OperatingSystem.UBUNTU_14_04,
core.networkHandler, shellFactory, dockerConfig);
logic.doCreate();
logic.prepare(LifecycleHandlerType.PRE_INSTALL);
logic.postprocess(LifecycleHandlerType.PRE_INSTALL);
logic.doDestroy(true);
logic = new DockerContainerLogic(core.componentInstanceId,
client, core.comp, core.ctx, OperatingSystem.UBUNTU_14_04,
core.networkHandler, shellFactory, dockerConfig);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment