use of com.yahoo.vespa.hosted.dockerapi.Container in project vespa by vespa-engine.
the class DockerMock method stopContainer.
@Override
public void stopContainer(ContainerName containerName) {
synchronized (monitor) {
callOrderVerifier.add("stopContainer with " + containerName);
Container container = containersByContainerName.get(containerName);
containersByContainerName.put(containerName, new Container(container.hostname, container.image, container.resources, container.name, Container.State.EXITED, 0));
}
}
use of com.yahoo.vespa.hosted.dockerapi.Container in project vespa by vespa-engine.
the class DockerMock method createContainerCommand.
@Override
public CreateContainerCommand createContainerCommand(DockerImage dockerImage, ContainerResources containerResources, ContainerName containerName, String hostName) {
synchronized (monitor) {
callOrderVerifier.add("createContainerCommand with " + dockerImage + ", HostName: " + hostName + ", " + containerName);
containersByContainerName.put(containerName, new Container(hostName, dockerImage, containerResources, containerName, Container.State.RUNNING, 2));
}
return new StartContainerCommandMock();
}
use of com.yahoo.vespa.hosted.dockerapi.Container in project vespa by vespa-engine.
the class AclMaintainerTest method makeContainer.
private Container makeContainer(String hostname, Container.State state, int pid) {
final ContainerName containerName = new ContainerName(hostname);
final Container container = new Container(hostname, new DockerImage("mock"), null, containerName, state, pid);
containers.add(container);
return container;
}
use of com.yahoo.vespa.hosted.dockerapi.Container in project vespa by vespa-engine.
the class AclMaintainerTest method reconfigures_acl_when_container_pid_changes.
@Test
public void reconfigures_acl_when_container_pid_changes() {
Container container = makeContainer("container-1");
List<ContainerAclSpec> aclSpecs = makeAclSpecs(3, container.name);
when(nodeRepository.getContainerAclSpecs(NODE_ADMIN_HOSTNAME)).thenReturn(aclSpecs);
aclMaintainer.run();
assertAclsApplied(container.name, aclSpecs);
// Container is restarted and PID changes
makeContainer(container.name.asString(), Container.State.RUNNING, 43);
aclMaintainer.run();
assertAclsApplied(container.name, aclSpecs, times(2));
}
use of com.yahoo.vespa.hosted.dockerapi.Container in project vespa by vespa-engine.
the class AclMaintainerTest method does_not_configure_acl_for_stopped_container.
@Test
public void does_not_configure_acl_for_stopped_container() {
Container stoppedContainer = makeContainer("container-1", Container.State.EXITED, 0);
List<ContainerAclSpec> aclSpecs = makeAclSpecs(1, stoppedContainer.name);
when(nodeRepository.getContainerAclSpecs(NODE_ADMIN_HOSTNAME)).thenReturn(aclSpecs);
aclMaintainer.run();
assertAclsApplied(stoppedContainer.name, aclSpecs, never());
}
Aggregations